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

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:17:34 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 44fae3ba95e57e68b1361a7c5f087ca9d740f725
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 10 04:09:52 2003 +0000

            Reviewed by John.
    
    	<rdar://problem/3487195>: Implement responseXML property for XMLHttpRequest
    
            * khtml/ecma/xmlhttprequest.cpp:
            (KJS::XMLHttpRequest::getValueProperty): Implemented responseXML by parsing the
    	document and returning it.
            (KJS::XMLHttpRequest::XMLHttpRequest): Initialize new field
            * khtml/ecma/xmlhttprequest.h:
    
            * khtml/ecma/kjs_window.cpp:
    	(Windw::get): Forgot this in last commit; add XMLSerializer
    	constructor.
            * khtml/ecma/kjs_window.lut.h:
    	* khtml/ecma/Makefile.am: Forgot to include this in the last commit.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5741 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 9a16884..65199f4 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,23 @@
 2003-12-09  Maciej Stachowiak  <mjs at apple.com>
 
+        Reviewed by John.
+
+	<rdar://problem/3487195>: Implement responseXML property for XMLHttpRequest
+        
+        * khtml/ecma/xmlhttprequest.cpp:
+        (KJS::XMLHttpRequest::getValueProperty): Implemented responseXML by parsing the
+	document and returning it.
+        (KJS::XMLHttpRequest::XMLHttpRequest): Initialize new field
+        * khtml/ecma/xmlhttprequest.h:
+
+        * khtml/ecma/kjs_window.cpp: 
+	(Windw::get): Forgot this in last commit; add XMLSerializer
+	constructor.
+        * khtml/ecma/kjs_window.lut.h:
+	* khtml/ecma/Makefile.am: Forgot to include this in the last commit.
+
+2003-12-09  Maciej Stachowiak  <mjs at apple.com>
+
         Reviewed by Richard.
 
 	<rdar://problem/3504049>: XMLSerializer object and serializeToString method needed for XMLHttpRequest testing
diff --git a/WebCore/khtml/ecma/Makefile.am b/WebCore/khtml/ecma/Makefile.am
index 6f00baf..5eb9f2d 100644
--- a/WebCore/khtml/ecma/Makefile.am
+++ b/WebCore/khtml/ecma/Makefile.am
@@ -11,6 +11,7 @@ LUT_FILES = \
 	kjs_views.lut.h \
 	kjs_window.lut.h \
 	xmlhttprequest.lut.h \
+	xmlserializer.lut.h \
 	$(NULL)
 
 CREATE_HASH_TABLE = $(top_srcdir)/JavaScriptCore/kjs/create_hash_table
diff --git a/WebCore/khtml/ecma/kjs_window.cpp b/WebCore/khtml/ecma/kjs_window.cpp
index 574acfa..f365f42 100644
--- a/WebCore/khtml/ecma/kjs_window.cpp
+++ b/WebCore/khtml/ecma/kjs_window.cpp
@@ -49,6 +49,7 @@
 #include "kjs_css.h"
 #include "kjs_events.h"
 #include "xmlhttprequest.h"
+#include "xmlserializer.h"
 
 #include "khtmlview.h"
 #include "khtml_part.h"
@@ -229,6 +230,7 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 };
   Image		Window::Image		DontDelete|ReadOnly
   Option	Window::Option		DontDelete|ReadOnly
   XMLHttpRequest	Window::XMLHttpRequest	DontDelete|ReadOnly
+  XMLSerializer	Window::XMLSerializer	DontDelete|ReadOnly
   alert		Window::Alert		DontDelete|Function 1
   confirm	Window::Confirm		DontDelete|Function 1
   prompt	Window::Prompt		DontDelete|Function 2
@@ -545,6 +547,8 @@ Value Window::get(ExecState *exec, const Identifier &p) const
       return Value(new OptionConstructorImp(exec, m_part->document()));
     case XMLHttpRequest:
       return Value(new XMLHttpRequestConstructorImp(exec, m_part->document()));
+    case XMLSerializer:
+      return Value(new XMLSerializerConstructorImp(exec));
     case Alert:
     case Confirm:
     case Prompt:
diff --git a/WebCore/khtml/ecma/kjs_window.h b/WebCore/khtml/ecma/kjs_window.h
index cfa5104..28195af 100644
--- a/WebCore/khtml/ecma/kjs_window.h
+++ b/WebCore/khtml/ecma/kjs_window.h
@@ -120,7 +120,7 @@ namespace KJS {
            ScrollTo, ScrollX, ScrollY, MoveBy, MoveTo, ResizeBy, ResizeTo, Self, _Window, Top, _Screen,
            Image, Option, Alert, Confirm, Prompt, Open, Print, SetTimeout, ClearTimeout,
            Focus, GetSelection, Blur, Close, SetInterval, ClearInterval, CaptureEvents, 
-           ReleaseEvents, AddEventListener, RemoveEventListener, XMLHttpRequest,
+           ReleaseEvents, AddEventListener, RemoveEventListener, XMLHttpRequest, XMLSerializer,
 	   Onabort, Onblur, Onchange, Onclick, Ondblclick, Ondragdrop, Onerror, 
 	   Onfocus, Onkeydown, Onkeypress, Onkeyup, Onload, Onmousedown, Onmousemove,
            Onmouseout, Onmouseover, Onmouseup, Onmove, Onreset, Onresize,
diff --git a/WebCore/khtml/ecma/kjs_window.lut.h b/WebCore/khtml/ecma/kjs_window.lut.h
index 366630f..6a41e1c 100644
--- a/WebCore/khtml/ecma/kjs_window.lut.h
+++ b/WebCore/khtml/ecma/kjs_window.lut.h
@@ -53,7 +53,7 @@ const struct HashEntry WindowTableEntries[] = {
    { "onblur", Window::Onblur, DontDelete, 0, 0 },
    { "addEventListener", Window::AddEventListener, DontDelete|Function, 3, 0 },
    { "Node", Window::Node, DontDelete, 0, &WindowTableEntries[100] },
-   { 0, 0, 0, 0, 0 },
+   { "XMLSerializer", Window::XMLSerializer, DontDelete|ReadOnly, 0, 0 },
    { "scrollBy", Window::ScrollBy, DontDelete|Function, 2, 0 },
    { "Image", Window::Image, DontDelete|ReadOnly, 0, 0 },
    { "window", Window::_Window, DontDelete|ReadOnly, 0, 0 },
diff --git a/WebCore/khtml/ecma/xmlhttprequest.cpp b/WebCore/khtml/ecma/xmlhttprequest.cpp
index 3b2e85d..2c3b501 100644
--- a/WebCore/khtml/ecma/xmlhttprequest.cpp
+++ b/WebCore/khtml/ecma/xmlhttprequest.cpp
@@ -23,6 +23,7 @@
 #include "kjs_window.h"
 #include "kjs_events.h"
 
+#include "dom/dom_doc.h"
 #include "dom/dom_exception.h"
 #include "dom/dom_string.h"
 #include "misc/loader.h"
@@ -122,7 +123,7 @@ Value XMLHttpRequest::tryGet(ExecState *exec, const Identifier &propertyName) co
   return DOMObjectLookupGetValue<XMLHttpRequest,DOMObject>(exec, propertyName, &XMLHttpRequestTable, this);
 }
 
-Value XMLHttpRequest::getValueProperty(ExecState *, int token) const
+Value XMLHttpRequest::getValueProperty(ExecState *exec, int token) const
 {
   switch (token) {
   case ReadyState:
@@ -130,7 +131,33 @@ Value XMLHttpRequest::getValueProperty(ExecState *, int token) const
   case ResponseText:
     return getStringOrNull(DOM::DOMString(response));
   case ResponseXML:
-    return Undefined();
+    if (state != Completed) {
+      return Undefined();
+    }
+    if (!createdDocument) {
+      QString mimeType = "text/xml";
+      
+      Value header = getResponseHeader("Content-Type");
+      if (header.type() != UndefinedType) {
+	mimeType = QStringList::split(";", header.toString(exec).qstring())[0].stripWhiteSpace();
+      }
+      
+      if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "application/xhtml+xml") {
+	responseXML = DOM::Document(doc->implementation()->createDocument());
+      } else {
+	responseXML = DOM::Document(doc->implementation()->createHTMLDocument());
+      }
+
+      DOM::DocumentImpl *docImpl = static_cast<DOM::DocumentImpl *>(responseXML.handle());
+      
+      docImpl->open();
+      docImpl->write(response);
+      docImpl->finishParsing();
+      docImpl->close();
+      createdDocument = true;
+    }
+
+    return getDOMNode(exec,responseXML);
   case Status:
     return getStatus();
   case StatusText:
@@ -183,7 +210,8 @@ XMLHttpRequest::XMLHttpRequest(ExecState *exec, const DOM::Document &d)
     state(Uninitialized),
     onReadyStateChangeListener(0),
     onLoadListener(0),
-    decoder(0)
+    decoder(0),
+    createdDocument(false)
 {
 }
 
diff --git a/WebCore/khtml/ecma/xmlhttprequest.h b/WebCore/khtml/ecma/xmlhttprequest.h
index 297dd3c..6351699 100644
--- a/WebCore/khtml/ecma/xmlhttprequest.h
+++ b/WebCore/khtml/ecma/xmlhttprequest.h
@@ -104,9 +104,11 @@ namespace KJS {
 
     khtml::Decoder *decoder;
     QString encoding;
-    QString response;
-
     QString responseHeaders;
+
+    QString response;
+    mutable bool createdDocument;
+    mutable DOM::Document responseXML;
   };
 
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list