Reviewed by Darin.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Dec 2003 01:32:59 +0000 (01:32 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Dec 2003 01:32:59 +0000 (01:32 +0000)
<rdar://problem/3507863>: XMLHttpRequest should not parse response if HTML

* khtml/ecma/xmlhttprequest.cpp:
        (KJS::XMLHttpRequest::getValueProperty):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@5775 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/ecma/xmlhttprequest.cpp
WebCore/khtml/ecma/xmlhttprequest.h

index 36f6b69..f19f4b2 100644 (file)
@@ -1,3 +1,12 @@
+2003-12-11  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Darin. 
+
+       <rdar://problem/3507863>: XMLHttpRequest should not parse response if HTML
+        
+       * khtml/ecma/xmlhttprequest.cpp:
+        (KJS::XMLHttpRequest::getValueProperty):
+
 2003-12-11  Richard Williamson   <rjw@apple.com>
 
        Cleaned up and verified reference counting scheme, and
index 34593e0..da510bd 100644 (file)
@@ -144,19 +144,24 @@ Value XMLHttpRequest::getValueProperty(ExecState *exec, int token) const
       
       if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "application/xhtml+xml") {
        responseXML = DOM::Document(doc->implementation()->createDocument());
+
+       DOM::DocumentImpl *docImpl = static_cast<DOM::DocumentImpl *>(responseXML.handle());
+       
+       docImpl->open();
+       docImpl->write(response);
+       docImpl->finishParsing();
+       docImpl->close();
+       typeIsXML = true;
       } else {
-       responseXML = DOM::Document(doc->implementation()->createHTMLDocument());
+       typeIsXML = false;
       }
-
-      DOM::DocumentImpl *docImpl = static_cast<DOM::DocumentImpl *>(responseXML.handle());
-      
-      docImpl->open();
-      docImpl->write(response);
-      docImpl->finishParsing();
-      docImpl->close();
       createdDocument = true;
     }
 
+    if (!typeIsXML) {
+      return Undefined();
+    }
+
     return getDOMNode(exec,responseXML);
   case Status:
     return getStatus();
index cab43d3..c920013 100644 (file)
@@ -112,6 +112,7 @@ namespace KJS {
 
     QString response;
     mutable bool createdDocument;
+    mutable bool typeIsXML;
     mutable DOM::Document responseXML;
 
     bool aborted;