[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:36:52 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 2b2ad00c871770fc4c7a92e0ce1436a27480ad32
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Apr 26 02:33:32 2004 +0000

            Reviewed by Dave.
    
            - fixed <rdar://problem/3633091>: "add overrideMimeType function to XMLHttpRequest"
    
            * khtml/ecma/xmlhttprequest.cpp:
            (KJS::XMLHttpRequest::getValueProperty): Add logic to override MIME type if
            OverrideMIMEType was called.
            (KJS::XMLHttpRequestProtoFunc::tryCall): Store the MIME type when overrideMimeType is called.
            * khtml/ecma/xmlhttprequest.h: Add OverrideMIMEType to the XMLHttpRequest property enum,
            and also add a MIMETypeOverride data member to the class.
            * khtml/ecma/xmlhttprequest.lut.h: Regenerated.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6481 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index c67912c..d44b0e5 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,17 @@
+2004-04-25  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dave.
+
+        - fixed <rdar://problem/3633091>: "add overrideMimeType function to XMLHttpRequest"
+
+        * khtml/ecma/xmlhttprequest.cpp:
+        (KJS::XMLHttpRequest::getValueProperty): Add logic to override MIME type if
+        OverrideMIMEType was called.
+        (KJS::XMLHttpRequestProtoFunc::tryCall): Store the MIME type when overrideMimeType is called.
+        * khtml/ecma/xmlhttprequest.h: Add OverrideMIMEType to the XMLHttpRequest property enum,
+        and also add a MIMETypeOverride data member to the class.
+        * khtml/ecma/xmlhttprequest.lut.h: Regenerated.
+
 2004-04-25  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Darin.
diff --git a/WebCore/khtml/ecma/xmlhttprequest.cpp b/WebCore/khtml/ecma/xmlhttprequest.cpp
index 0c62866..975c891 100644
--- a/WebCore/khtml/ecma/xmlhttprequest.cpp
+++ b/WebCore/khtml/ecma/xmlhttprequest.cpp
@@ -52,6 +52,7 @@ using khtml::Decoder;
   getAllResponseHeaders	XMLHttpRequest::GetAllResponseHeaders	DontDelete|Function 0
   getResponseHeader	XMLHttpRequest::GetResponseHeader	DontDelete|Function 1
   open			XMLHttpRequest::Open			DontDelete|Function 5
+  overrideMimeType      XMLHttpRequest::OverrideMIMEType        DontDelete|Function 1
   send			XMLHttpRequest::Send			DontDelete|Function 1
   setRequestHeader	XMLHttpRequest::SetRequestHeader	DontDelete|Function 2
 @end
@@ -135,11 +136,17 @@ Value XMLHttpRequest::getValueProperty(ExecState *exec, int token) const
       return Undefined();
     }
     if (!createdDocument) {
-      QString mimeType = "text/xml";
+      QString mimeType;
       
-      Value header = getResponseHeader("Content-Type");
-      if (header.type() != UndefinedType) {
-	mimeType = QStringList::split(";", header.toString(exec).qstring())[0].stripWhiteSpace();
+      if (MIMETypeOverride.isEmpty()) {
+        Value header = getResponseHeader("Content-Type");
+        if (header.type() == UndefinedType) {
+          mimeType = "text/xml";
+        } else {
+	  mimeType = QStringList::split(";", header.toString(exec).qstring())[0].stripWhiteSpace();
+        }
+      } else {
+        mimeType = MIMETypeOverride;
       }
       
       if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "application/xhtml+xml") {
@@ -647,6 +654,12 @@ Value XMLHttpRequestProtoFunc::tryCall(ExecState *exec, Object &thisObj, const L
     request->setRequestHeader(args[0].toString(exec).qstring(), args[1].toString(exec).qstring());
     
     return Undefined();
+  case XMLHttpRequest::OverrideMIMEType:
+    if (args.size() != 1) {
+      return Undefined();
+    }
+    request->MIMETypeOverride = args[0].toString(exec).qstring();
+    return Undefined();
   }
 
   return Undefined();
diff --git a/WebCore/khtml/ecma/xmlhttprequest.h b/WebCore/khtml/ecma/xmlhttprequest.h
index c920013..78fedeb 100644
--- a/WebCore/khtml/ecma/xmlhttprequest.h
+++ b/WebCore/khtml/ecma/xmlhttprequest.h
@@ -60,7 +60,9 @@ namespace KJS {
     virtual bool toBoolean(ExecState *) const { return true; }
     virtual const ClassInfo* classInfo() const { return &info; }
     static const ClassInfo info;
-    enum { Onload, Onreadystatechange, ReadyState, ResponseText, ResponseXML, Status, StatusText, Abort, GetAllResponseHeaders, GetResponseHeader, Open, Send, SetRequestHeader };
+    enum { Onload, Onreadystatechange, ReadyState, ResponseText, ResponseXML, Status,
+        StatusText, Abort, GetAllResponseHeaders, GetResponseHeader, Open, Send, SetRequestHeader,
+        OverrideMIMEType };
 
   private:
     friend class XMLHttpRequestProtoFunc;
@@ -109,6 +111,7 @@ namespace KJS {
     khtml::Decoder *decoder;
     QString encoding;
     QString responseHeaders;
+    QString MIMETypeOverride;
 
     QString response;
     mutable bool createdDocument;
diff --git a/WebCore/khtml/ecma/xmlhttprequest.lut.h b/WebCore/khtml/ecma/xmlhttprequest.lut.h
index f3fd803..85f241b 100644
--- a/WebCore/khtml/ecma/xmlhttprequest.lut.h
+++ b/WebCore/khtml/ecma/xmlhttprequest.lut.h
@@ -4,7 +4,7 @@ namespace KJS {
 
 const struct HashEntry XMLHttpRequestProtoTableEntries[] = {
    { "open", XMLHttpRequest::Open, DontDelete|Function, 5, 0 },
-   { 0, 0, 0, 0, 0 },
+   { "overrideMimeType", XMLHttpRequest::OverrideMIMEType, DontDelete|Function, 1, 0 },
    { "getResponseHeader", XMLHttpRequest::GetResponseHeader, DontDelete|Function, 1, 0 },
    { "setRequestHeader", XMLHttpRequest::SetRequestHeader, DontDelete|Function, 2, 0 },
    { "abort", XMLHttpRequest::Abort, DontDelete|Function, 0, 0 },

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list