An XMLDocument interface should be exposed on the global Window object
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Jan 2016 01:11:35 +0000 (01:11 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Jan 2016 01:11:35 +0000 (01:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153378
<rdar://problem/24315465>

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline several W3C DOM and HTML tests now that more checks are
passing.

* web-platform-tests/dom/interfaces-expected.txt:
* web-platform-tests/dom/nodes/Document-constructor-expected.txt:
* web-platform-tests/html/dom/interfaces-expected.txt:

Source/WebCore:

Expose an XMLDocument interface on the global Window object, as per:
- https://dom.spec.whatwg.org/#xmldocument

DOMImplementation.createDocument() now returns an XMLDocument instead
of a Document, as per:
- https://dom.spec.whatwg.org/#dom-domimplementation-createdocument

Previously, WebKit would alias XMLDocument to Document which caused
some W3C tests to fail.

Chrome and Firefox already match the specification here.

No new tests, already covered by existing tests.

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSDocumentCustom.cpp:
(WebCore::createNewDocumentWrapper):
* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::createDocument):
* dom/DOMImplementation.h:
* dom/DOMImplementation.idl:
* dom/Document.cpp:
(WebCore::Document::cloneDocumentWithoutChildren):
* dom/Document.h:
(WebCore::Document::isXMLDocument):
(WebCore::Document::create): Deleted.
(WebCore::Document::createNonRenderedPlaceholder): Deleted.
* dom/XMLDocument.h: Added.
(WebCore::XMLDocument::create):
(WebCore::XMLDocument::createXHTML):
(WebCore::XMLDocument::XMLDocument):
(isType):
* dom/XMLDocument.idl: Added.
* inspector/DOMPatchSupport.cpp:
(WebCore::DOMPatchSupport::patchDocument):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::setOuterHTML):
* page/DOMWindow.idl:
* page/PageSerializer.cpp:
(WebCore::SerializerMarkupAccumulator::SerializerMarkupAccumulator):
* svg/SVGDocument.cpp:
(WebCore::SVGDocument::SVGDocument):
* svg/SVGDocument.h:
* svg/SVGDocument.idl:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::responseXML):
* xml/XSLTProcessor.cpp:
(WebCore::XSLTProcessor::createDocumentFromSource):

LayoutTests:

Rebaseline some layout tests now that XMLDocument is exposed.

* fast/dom/DOMImplementation/createDocument-namespace-err-expected.txt:
* fast/dom/DOMImplementation/script-tests/createDocument-namespace-err.js:
* fast/dom/Document/clone-node-expected.txt:
* fast/dom/Document/clone-node.html:
* fast/dom/Document/xml-document-focus-expected.txt:
* fast/dom/Document/xml-document-focus.xml:
* fast/dom/dom-parse-serialize-display-expected.txt:
* fast/dom/dom-parse-serialize-expected.txt:
* fast/dom/wrapper-classes-expected.txt:
* fast/dom/wrapper-classes.html:
* fast/dom/xmlserializer-serialize-to-string-exception-expected.txt:
* fast/xmlhttprequest/xmlhttprequest-bad-mimetype-expected.txt:
* http/tests/xmlhttprequest/supported-xml-content-types-expected.txt:
* platform/mac/fast/dom/Window/window-lookup-precedence-expected.txt:

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

47 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/DOMImplementation/createDocument-namespace-err-expected.txt
LayoutTests/fast/dom/DOMImplementation/script-tests/createDocument-namespace-err.js
LayoutTests/fast/dom/Document/clone-node-expected.txt
LayoutTests/fast/dom/Document/clone-node.html
LayoutTests/fast/dom/Document/xml-document-focus-expected.txt
LayoutTests/fast/dom/Document/xml-document-focus.xml
LayoutTests/fast/dom/dom-parse-serialize-display-expected.txt
LayoutTests/fast/dom/dom-parse-serialize-expected.txt
LayoutTests/fast/dom/wrapper-classes-expected.txt
LayoutTests/fast/dom/wrapper-classes.html
LayoutTests/fast/dom/xmlserializer-serialize-to-string-exception-expected.txt
LayoutTests/fast/xmlhttprequest/xmlhttprequest-bad-mimetype-expected.txt
LayoutTests/http/tests/security/cross-frame-access-put-expected.txt
LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types-expected.txt
LayoutTests/http/tests/xmlhttprequest/svg-created-by-xhr-allowed-in-dashboard-expected.txt
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-constructor-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt
LayoutTests/platform/mac/fast/dom/Window/window-lookup-precedence-expected.txt
LayoutTests/svg/custom/manually-parsed-embedded-svg-allowed-in-dashboard-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSDocumentCustom.cpp
Source/WebCore/dom/DOMImplementation.cpp
Source/WebCore/dom/DOMImplementation.h
Source/WebCore/dom/DOMImplementation.idl
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/XMLDocument.h [new file with mode: 0644]
Source/WebCore/dom/XMLDocument.idl [new file with mode: 0644]
Source/WebCore/inspector/DOMPatchSupport.cpp
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/page/DOMWindow.idl
Source/WebCore/page/PageSerializer.cpp
Source/WebCore/svg/SVGDocument.cpp
Source/WebCore/svg/SVGDocument.h
Source/WebCore/svg/SVGDocument.idl
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XSLTProcessor.cpp

index 2296054..59ae2ef 100644 (file)
@@ -1,3 +1,28 @@
+2016-01-24  Chris Dumez  <cdumez@apple.com>
+
+        An XMLDocument interface should be exposed on the global Window object
+        https://bugs.webkit.org/show_bug.cgi?id=153378
+        <rdar://problem/24315465>
+
+        Reviewed by Darin Adler.
+
+        Rebaseline some layout tests now that XMLDocument is exposed.
+
+        * fast/dom/DOMImplementation/createDocument-namespace-err-expected.txt:
+        * fast/dom/DOMImplementation/script-tests/createDocument-namespace-err.js:
+        * fast/dom/Document/clone-node-expected.txt:
+        * fast/dom/Document/clone-node.html:
+        * fast/dom/Document/xml-document-focus-expected.txt:
+        * fast/dom/Document/xml-document-focus.xml:
+        * fast/dom/dom-parse-serialize-display-expected.txt:
+        * fast/dom/dom-parse-serialize-expected.txt:
+        * fast/dom/wrapper-classes-expected.txt:
+        * fast/dom/wrapper-classes.html:
+        * fast/dom/xmlserializer-serialize-to-string-exception-expected.txt:
+        * fast/xmlhttprequest/xmlhttprequest-bad-mimetype-expected.txt:
+        * http/tests/xmlhttprequest/supported-xml-content-types-expected.txt:
+        * platform/mac/fast/dom/Window/window-lookup-precedence-expected.txt:
+
 2016-01-24  Simon Fraser  <simon.fraser@apple.com>
 
         New WK1 baselines.
index 09d4bdc..c713fbb 100644 (file)
@@ -3,8 +3,8 @@ createDocument tests modeled after createElementNS tests from mozilla which were
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS document.implementation.createDocument().toString() is "[object Document]"
-PASS document.implementation.createDocument("http://www.example.com").toString() is "[object Document]"
+PASS document.implementation.createDocument().toString() is "[object XMLDocument]"
+PASS document.implementation.createDocument("http://www.example.com").toString() is "[object XMLDocument]"
 PASS createDocument(, , null)
 PASS createDocument(null, , null)
 FAIL createDocument(, null, null)
index bc36f55..f5a4862 100644 (file)
@@ -138,7 +138,7 @@ function runNSTests(tests, doc, createFunctionName)
 }
 
 // Moz throws a "Not enough arguments" exception in these, we don't:
-shouldBeEqualToString("document.implementation.createDocument().toString()", "[object Document]");
-shouldBeEqualToString("document.implementation.createDocument(\"http://www.example.com\").toString()", "[object Document]");
+shouldBeEqualToString("document.implementation.createDocument().toString()", "[object XMLDocument]");
+shouldBeEqualToString("document.implementation.createDocument(\"http://www.example.com\").toString()", "[object XMLDocument]");
 
 runNSTests(allNSTests, document.implementation, "createDocument");
index 4b95180..df98b99 100644 (file)
@@ -3,8 +3,8 @@ Tests cloneNode for Document.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS doc.cloneNode(false).__proto__ is Document.prototype
-PASS className(doc.cloneNode(false)) is "Document"
+PASS doc.cloneNode(false).__proto__ is XMLDocument.prototype
+PASS className(doc.cloneNode(false)) is "XMLDocument"
 PASS doc.cloneNode(true).documentElement.localName is "root"
 PASS doc.cloneNode(true).contentType is "application/xml"
 PASS document.cloneNode(true).compatMode is "CSS1Compat"
index aabee58..356f81c 100644 (file)
@@ -11,8 +11,8 @@ function className(object) {
 
 var doc = document.implementation.createDocument('', 'root', null);
 
-shouldBe('doc.cloneNode(false).__proto__', 'Document.prototype');
-shouldBeEqualToString('className(doc.cloneNode(false))', 'Document');
+shouldBe('doc.cloneNode(false).__proto__', 'XMLDocument.prototype');
+shouldBeEqualToString('className(doc.cloneNode(false))', 'XMLDocument');
 shouldBeEqualToString('doc.cloneNode(true).documentElement.localName', 'root');
 shouldBeEqualToString('doc.cloneNode(true).contentType', 'application/xml');
 shouldBeEqualToString('document.cloneNode(true).compatMode', 'CSS1Compat');
index 987e547..7ec88b4 100644 (file)
@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 PASS document.__proto__ is not HTMLDocument.prototype
-PASS document.__proto__ is Document.prototype
+PASS document.__proto__ is XMLDocument.prototype
 PASS document.hasFocus() is true
 PASS document.activeElement is document.body
 PASS document.activeElement is testElement
index f11f94c..6608903 100644 (file)
@@ -11,7 +11,7 @@
 description("Make sure the focus management API is available to XML documents.");
 
 shouldNotBe("document.__proto__", "HTMLDocument.prototype");
-shouldBe("document.__proto__", "Document.prototype");
+shouldBe("document.__proto__", "XMLDocument.prototype");
 shouldBeTrue("document.hasFocus()");
 shouldBe("document.activeElement", "document.body");
 var testElement = document.getElementById("testElement");
index de44f75..3f1edd4 100644 (file)
@@ -14,7 +14,7 @@ text to parse
 
 document object
 
-[object Document]
+[object XMLDocument]
 
 document object serialized
 
index f6b59bd..a9cea30 100644 (file)
@@ -38,9 +38,9 @@ PASS jsWrapperClass(document.createTreeWalker(root, 0, null, false).constructor)
 
 XML
 
-PASS jsWrapperClass(xmlDocument) is 'Document'
-PASS jsWrapperClass(xmlDocument.__proto__) is 'DocumentPrototype'
-PASS jsWrapperClass(xmlDocument.constructor) is 'DocumentConstructor'
+PASS jsWrapperClass(xmlDocument) is 'XMLDocument'
+PASS jsWrapperClass(xmlDocument.__proto__) is 'XMLDocumentPrototype'
+PASS jsWrapperClass(xmlDocument.constructor) is 'XMLDocumentConstructor'
 PASS jsWrapperClass(xmlDocument.createCDATASection()) is 'CDATASection'
 PASS jsWrapperClass(xmlDocument.createCDATASection().__proto__) is 'CDATASectionPrototype'
 PASS jsWrapperClass(xmlDocument.createCDATASection().constructor) is 'CDATASectionConstructor'
index 14bab59..ca7c341 100644 (file)
@@ -87,7 +87,7 @@ function runTest()
     debug('XML');
     debug('');
 
-    test("xmlDocument", "Document");
+    test("xmlDocument", "XMLDocument");
     test("xmlDocument.createCDATASection()", "CDATASection");
     test("xmlDocument.createElementNS('x', 'x', 'x')", "Element");
     test("xmlDocument.createProcessingInstruction()", "ProcessingInstruction");
index 986b8f5..2c0bd1c 100644 (file)
@@ -40,7 +40,7 @@ PASS
 12. Verifying XMLSerializer.serializeToString() should NOT-THROW exception with node value = [object HTMLHtmlElement]
 PASS
 
-13. Verifying XMLSerializer.serializeToString() should NOT-THROW exception with node value = [object Document]
+13. Verifying XMLSerializer.serializeToString() should NOT-THROW exception with node value = [object XMLDocument]
 PASS
 
 14. Verifying XMLSerializer.serializeToString() should NOT-THROW exception with node value = [object Element]
index 5cb5717..6e5a883 100644 (file)
@@ -3,7 +3,7 @@ This test checks for <rdar://problem/5303567> REGRESSION: XMLHttpRequest.respons
 PASS: No exception.
 readyState: 4 (number)
 responseText: <?xml version="1.0" encoding="UTF-8"?>... (string)
-responseXML: [object Document] (object)
+responseXML: [object XMLDocument] (object)
 status: 0 (number)
 statusText:  (string)
 
index 2799946..90978fd 100644 (file)
@@ -82,7 +82,7 @@ ALERT: PASS: window.SyntaxError should be 'function SyntaxError() {    [native c
 ALERT: PASS: window.Text should be '[object TextConstructor]' and is.
 ALERT: PASS: window.TypeError should be 'function TypeError() {    [native code]}' and is.
 ALERT: PASS: window.URIError should be 'function URIError() {    [native code]}' and is.
-ALERT: PASS: window.XMLDocument should be '[object DocumentConstructor]' and is.
+ALERT: PASS: window.XMLDocument should be '[object XMLDocumentConstructor]' and is.
 ALERT: PASS: window.XMLSerializer should be '[object XMLSerializerConstructor]' and is.
 ALERT: PASS: window.XPathEvaluator should be '[object XPathEvaluatorConstructor]' and is.
 ALERT: PASS: window.XPathResult should be '[object XPathResultConstructor]' and is.
index fcdaa40..2308e39 100644 (file)
@@ -1,44 +1,44 @@
-PASS -- testing: text/xml -- responseXML: [object Document]
+PASS -- testing: text/xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: image/svg+xml -- responseXML: [object Document]
+PASS -- testing: image/svg+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: application/soap+xml -- responseXML: [object Document]
+PASS -- testing: application/soap+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo/bar+xml -- responseXML: [object Document]
+PASS -- testing: foo/bar+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: 123/BAR+xml -- responseXML: [object Document]
+PASS -- testing: 123/BAR+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo_bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo_bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo-bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo-bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo+bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo+bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo~bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo~bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo!bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo!bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo$bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo$bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo^bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo^bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo{bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo{bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo}bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo}bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo|bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo|bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo%bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo%bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo'bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo'bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo`bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo`bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo#bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo#bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo&bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo&bar/baz+xml -- responseXML: [object XMLDocument]
 
-PASS -- testing: foo*bar/baz+xml -- responseXML: [object Document]
+PASS -- testing: foo*bar/baz+xml -- responseXML: [object XMLDocument]
 
 PASS -- testing: text/html -- responseXML: null
 
@@ -46,7 +46,7 @@ PASS -- testing: image/png -- responseXML: null
 
 PASS -- testing: invalid -- responseXML: null
 
-FAIL (got document -- response type: foo bar/baz+xml) -- testing: foo bar/baz+xml -- responseXML: [object Document]
+FAIL (got document -- response type: foo bar/baz+xml) -- testing: foo bar/baz+xml -- responseXML: [object XMLDocument]
 
 PASS -- testing: foo[bar/baz+xml -- responseXML: null
 
index 69a44c5..56690cd 100644 (file)
@@ -1,6 +1,6 @@
 Test to make sure we can use XHR to create usable SVG in dashboard compatibility mode. This cannot be tested manually.
 
-Received doc of type: [object Document]
+Received doc of type: [object XMLDocument]
 PASS: Managed to insert SVG element into tree
 Imported node of type: [object SVGCircleElement]
 
index 536eedf..c90709c 100644 (file)
@@ -1,3 +1,18 @@
+2016-01-24  Chris Dumez  <cdumez@apple.com>
+
+        An XMLDocument interface should be exposed on the global Window object
+        https://bugs.webkit.org/show_bug.cgi?id=153378
+        <rdar://problem/24315465>
+
+        Reviewed by Darin Adler.
+
+        Rebaseline several W3C DOM and HTML tests now that more checks are
+        passing.
+
+        * web-platform-tests/dom/interfaces-expected.txt:
+        * web-platform-tests/dom/nodes/Document-constructor-expected.txt:
+        * web-platform-tests/html/dom/interfaces-expected.txt:
+
 2016-01-20  Ryosuke Niwa  <rniwa@webkit.org>
 
         HTMLElement::nodeName should not upper case non-ASCII characters
index 4894b72..1d66c37 100644 (file)
@@ -44,10 +44,6 @@ CONSOLE MESSAGE: line 1151: Deprecated attempt to access property 'children' on
 CONSOLE MESSAGE: line 1151: Deprecated attempt to access property 'firstElementChild' on a non-Document object.
 CONSOLE MESSAGE: line 1151: Deprecated attempt to access property 'lastElementChild' on a non-Document object.
 CONSOLE MESSAGE: line 1151: Deprecated attempt to access property 'childElementCount' on a non-Document object.
-CONSOLE MESSAGE: line 793: Deprecated attempt to access property 'nodeType' on a non-Node object.
-CONSOLE MESSAGE: line 2475: Deprecated attempt to access property 'nodeType' on a non-Node object.
-CONSOLE MESSAGE: line 793: Deprecated attempt to access property 'nodeType' on a non-Node object.
-CONSOLE MESSAGE: line 2475: Deprecated attempt to access property 'nodeType' on a non-Node object.
 CONSOLE MESSAGE: line 1151: Deprecated attempt to access property 'children' on a non-DocumentFragment object.
 CONSOLE MESSAGE: line 1151: Deprecated attempt to access property 'firstElementChild' on a non-DocumentFragment object.
 CONSOLE MESSAGE: line 1151: Deprecated attempt to access property 'lastElementChild' on a non-DocumentFragment object.
@@ -473,13 +469,13 @@ FAIL Document interface: operation query(DOMString) assert_own_property: interfa
 FAIL Document interface: operation queryAll(DOMString) assert_own_property: interface prototype object missing non-static operation expected property "queryAll" missing
 PASS Document interface: operation querySelector(DOMString) 
 PASS Document interface: operation querySelectorAll(DOMString) 
-FAIL XMLDocument interface: existence and properties of interface object assert_equals: class string of XMLDocument expected "[object Function]" but got "[object DocumentConstructor]"
+FAIL XMLDocument interface: existence and properties of interface object assert_equals: class string of XMLDocument expected "[object Function]" but got "[object XMLDocumentConstructor]"
 PASS XMLDocument interface object length 
-FAIL XMLDocument interface object name assert_equals: wrong value for XMLDocument.name expected "XMLDocument" but got "Document"
-FAIL XMLDocument interface: existence and properties of interface prototype object assert_equals: prototype of XMLDocument.prototype is not Document.prototype expected Node object of unknown type but got Node object of unknown type
+PASS XMLDocument interface object name 
+PASS XMLDocument interface: existence and properties of interface prototype object 
 FAIL XMLDocument interface: existence and properties of interface prototype object's "constructor" property assert_true: XMLDocument.prototype.constructor is not writable expected true got false
 PASS XMLDocument must be primary interface of xmlDoc 
-FAIL Stringification of xmlDoc assert_equals: class string of xmlDoc expected "[object XMLDocument]" but got "[object Document]"
+PASS Stringification of xmlDoc 
 PASS Document interface: xmlDoc must inherit property "implementation" with the proper type (0) 
 PASS Document interface: xmlDoc must inherit property "URL" with the proper type (1) 
 PASS Document interface: xmlDoc must inherit property "documentURI" with the proper type (2) 
index f9b6ef4..2eb8f81 100644 (file)
@@ -1,5 +1,5 @@
 
-FAIL new Document(): interfaces assert_false: Should not be an XMLDocument expected false got true
+PASS new Document(): interfaces 
 PASS new Document(): children 
 PASS new Document(): metadata 
 PASS new Document(): characterSet aliases 
index e307cbf..dc1b316 100644 (file)
@@ -1254,7 +1254,7 @@ PASS EventTarget interface: iframe.contentDocument must inherit property "dispat
 PASS EventTarget interface: calling dispatchEvent(Event) on iframe.contentDocument with too few arguments must throw TypeError 
 FAIL XMLDocument interface: operation load(DOMString) assert_own_property: interface prototype object missing non-static operation expected property "load" missing
 PASS XMLDocument must be primary interface of document.implementation.createDocument(null, "", null) 
-FAIL Stringification of document.implementation.createDocument(null, "", null) assert_equals: class string of document.implementation.createDocument(null, "", null) expected "[object XMLDocument]" but got "[object Document]"
+PASS Stringification of document.implementation.createDocument(null, "", null) 
 FAIL XMLDocument interface: document.implementation.createDocument(null, "", null) must inherit property "load" with the proper type (0) assert_inherits: property "load" not found in prototype chain
 FAIL XMLDocument interface: calling load(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_inherits: property "load" not found in prototype chain
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "implementation" with the proper type (0) 
index b2b0de3..b84af1d 100644 (file)
@@ -294,8 +294,8 @@ PASS win['UIEvent'] == '[object UIEventConstructor]' is true
 PASS win['UIEvent'] == '[object UIEventConstructor]' is true
 PASS win['WheelEvent'] == '[object WheelEventConstructor]' is true
 PASS win['WheelEvent'] == '[object WheelEventConstructor]' is true
-PASS win['XMLDocument'] == '[object DocumentConstructor]' is true
-PASS win['XMLDocument'] == '[object DocumentConstructor]' is true
+PASS win['XMLDocument'] == '[object XMLDocumentConstructor]' is true
+PASS win['XMLDocument'] == '[object XMLDocumentConstructor]' is true
 PASS win['XMLHttpRequest'] == '[object XMLHttpRequestConstructor]' is true
 PASS win['XMLHttpRequest'] == '[object XMLHttpRequestConstructor]' is true
 PASS win['XMLHttpRequestException'] == '[object XMLHttpRequestExceptionConstructor]' is true
index 194aedf..a135545 100644 (file)
@@ -1,6 +1,6 @@
 This test makes sure we can add manually parsed SVG to the document when in dashboard compatibility mode. It can not be tested manually.
 
-Parsing of the document isn't prevented and produces a [object Document]
+Parsing of the document isn't prevented and produces a [object XMLDocument]
 The circle element is of type [object SVGCircleElement]
 PASS: Managed to insert SVG element into tree
 
index 945fb75..0b546cf 100644 (file)
@@ -418,6 +418,7 @@ set(WebCore_NON_SVG_IDL_FILES
     dom/WebKitNamedFlow.idl
     dom/WebKitTransitionEvent.idl
     dom/WheelEvent.idl
+    dom/XMLDocument.idl
 
     fileapi/Blob.idl
     fileapi/File.idl
index 44b193d..2713046 100644 (file)
@@ -1,3 +1,66 @@
+2016-01-24  Chris Dumez  <cdumez@apple.com>
+
+        An XMLDocument interface should be exposed on the global Window object
+        https://bugs.webkit.org/show_bug.cgi?id=153378
+        <rdar://problem/24315465>
+
+        Reviewed by Darin Adler.
+
+        Expose an XMLDocument interface on the global Window object, as per:
+        - https://dom.spec.whatwg.org/#xmldocument
+
+        DOMImplementation.createDocument() now returns an XMLDocument instead
+        of a Document, as per:
+        - https://dom.spec.whatwg.org/#dom-domimplementation-createdocument
+
+        Previously, WebKit would alias XMLDocument to Document which caused
+        some W3C tests to fail.
+
+        Chrome and Firefox already match the specification here.
+
+        No new tests, already covered by existing tests.
+
+        * CMakeLists.txt:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSBindingsAllInOne.cpp:
+        * bindings/js/JSDocumentCustom.cpp:
+        (WebCore::createNewDocumentWrapper):
+        * dom/DOMImplementation.cpp:
+        (WebCore::DOMImplementation::createDocument):
+        * dom/DOMImplementation.h:
+        * dom/DOMImplementation.idl:
+        * dom/Document.cpp:
+        (WebCore::Document::cloneDocumentWithoutChildren):
+        * dom/Document.h:
+        (WebCore::Document::isXMLDocument):
+        (WebCore::Document::create): Deleted.
+        (WebCore::Document::createNonRenderedPlaceholder): Deleted.
+        * dom/XMLDocument.h: Added.
+        (WebCore::XMLDocument::create):
+        (WebCore::XMLDocument::createXHTML):
+        (WebCore::XMLDocument::XMLDocument):
+        (isType):
+        * dom/XMLDocument.idl: Added.
+        * inspector/DOMPatchSupport.cpp:
+        (WebCore::DOMPatchSupport::patchDocument):
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::setOuterHTML):
+        * page/DOMWindow.idl:
+        * page/PageSerializer.cpp:
+        (WebCore::SerializerMarkupAccumulator::SerializerMarkupAccumulator):
+        * svg/SVGDocument.cpp:
+        (WebCore::SVGDocument::SVGDocument):
+        * svg/SVGDocument.h:
+        * svg/SVGDocument.idl:
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::responseXML):
+        * xml/XSLTProcessor.cpp:
+        (WebCore::XSLTProcessor::createDocumentFromSource):
+
 2016-01-24  Brady Eidson  <beidson@apple.com>
 
         Modern IDB: Support IDBObjectStore.createIndex in the SQLite backing store.
index f47ac91..98a0b6e 100644 (file)
 #include "JSWorkerGlobalScope.cpp"
 #include "JSWorkerLocation.cpp"
 #include "JSWorkerNavigator.cpp"
+#include "JSXMLDocument.cpp"
 #include "JSXMLHttpRequest.cpp"
 #include "JSXMLHttpRequestException.cpp"
 #include "JSXMLHttpRequestProgressEvent.cpp"
index 43e5603..f07abd3 100644 (file)
@@ -325,6 +325,7 @@ NON_SVG_BINDING_IDLS = \
     $(WebCore)/dom/WebKitNamedFlow.idl \
     $(WebCore)/dom/WebKitTransitionEvent.idl \
     $(WebCore)/dom/WheelEvent.idl \
+    $(WebCore)/dom/XMLDocument.idl \
     $(WebCore)/fileapi/Blob.idl \
     $(WebCore)/fileapi/File.idl \
     $(WebCore)/fileapi/FileError.idl \
index a1d3ce7..179e66e 100644 (file)
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSXMLDocument.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSXMLHttpRequest.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSWorkerGlobalScope.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSWorkerLocation.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSWorkerNavigator.h" />
+    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSXMLDocument.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSXMLHttpRequest.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSXMLHttpRequestException.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSXMLHttpRequestProgressEvent.h" />
index 81bafd2..171c40c 100644 (file)
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\JSWorkerNavigator.cpp">
       <Filter>DerivedSources</Filter>
     </ClCompile>
+    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSXMLDocument.cpp">
+      <Filter>DerivedSources</Filter>
+    </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSXMLHttpRequest.cpp">
       <Filter>DerivedSources</Filter>
     </ClCompile>
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSWritableStream.h">
       <Filter>DerivedSources</Filter>
     </ClInclude>
+    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSXMLDocument.h">
+      <Filter>DerivedSources</Filter>
+    </ClInclude>
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSXMLHttpRequest.h">
       <Filter>DerivedSources</Filter>
     </ClInclude>
index 0a73af7..19cb04e 100644 (file)
                830519951BB0F11000F3772E /* HTMLTimeElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 830519921BB0F0E700F3772E /* HTMLTimeElement.cpp */; };
                830519961BB0F11000F3772E /* HTMLTimeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 830519931BB0F0E700F3772E /* HTMLTimeElement.h */; };
                8306EFF11B8BCEA50031D032 /* NativeNodeFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8306EFF01B8BCE7C0031D032 /* NativeNodeFilter.cpp */; };
+               830784B21C52EE2C00104D1D /* XMLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 830784B11C52EE1900104D1D /* XMLDocument.h */; settings = {ATTRIBUTES = (Private, ); }; };
                832B843419D8E55100B26055 /* SVGAnimateElementBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 832B843319D8E55100B26055 /* SVGAnimateElementBase.h */; };
                832B843619D8E57400B26055 /* SVGAnimateElementBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */; };
                8348BFAB1B85729800912F36 /* ClassCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8348BFA91B85729500912F36 /* ClassCollection.cpp */; };
                8348BFAC1B85729800912F36 /* ClassCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 8348BFAA1B85729500912F36 /* ClassCollection.h */; };
                834DD4F41BE08989002C9C3E /* PageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 834DD4F31BE08989002C9C3E /* PageMac.mm */; };
                83520C7E1A71BFCC006BD2AA /* CSSFontFamily.h in Headers */ = {isa = PBXBuildFile; fileRef = 83520C7D1A71BFCC006BD2AA /* CSSFontFamily.h */; };
+               8358CB6F1C53277200E0C2D8 /* JSXMLDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83F570AE1C53268E007FD6CB /* JSXMLDocument.cpp */; };
+               8358CB701C53277500E0C2D8 /* JSXMLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F570AD1C53268E007FD6CB /* JSXMLDocument.h */; };
                835D363719FF6193004C93AB /* StyleBuilderCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 835D363619FF6193004C93AB /* StyleBuilderCustom.h */; };
                836BAD211BD1CA670037356A /* HTMLTableHeaderCellElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 836BAD1F1BD1CA670037356A /* HTMLTableHeaderCellElement.h */; };
                836BAD221BD1CA670037356A /* HTMLTableDataCellElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 836BAD201BD1CA670037356A /* HTMLTableDataCellElement.h */; };
                830519931BB0F0E700F3772E /* HTMLTimeElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLTimeElement.h; sourceTree = "<group>"; };
                830519941BB0F0E700F3772E /* HTMLTimeElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLTimeElement.idl; sourceTree = "<group>"; };
                8306EFF01B8BCE7C0031D032 /* NativeNodeFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NativeNodeFilter.cpp; sourceTree = "<group>"; };
+               830784B01C52EE1900104D1D /* XMLDocument.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XMLDocument.idl; sourceTree = "<group>"; };
+               830784B11C52EE1900104D1D /* XMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLDocument.h; sourceTree = "<group>"; };
                832B843319D8E55100B26055 /* SVGAnimateElementBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimateElementBase.h; sourceTree = "<group>"; };
                832B843519D8E57400B26055 /* SVGAnimateElementBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimateElementBase.cpp; sourceTree = "<group>"; };
                8348BFA91B85729500912F36 /* ClassCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClassCollection.cpp; sourceTree = "<group>"; };
                83E359A11BB1031D002CEB98 /* JSHTMLTimeElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTimeElement.cpp; sourceTree = "<group>"; };
                83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeNodeFilter.h; sourceTree = "<group>"; };
                83F1206A1B8C103600D75F63 /* JSNodeFilterCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeFilterCustom.cpp; sourceTree = "<group>"; };
+               83F570AD1C53268E007FD6CB /* JSXMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLDocument.h; sourceTree = "<group>"; };
+               83F570AE1C53268E007FD6CB /* JSXMLDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLDocument.cpp; sourceTree = "<group>"; };
                83FE5F1F1BD1C55E0038BEEC /* HTMLTableHeaderCellElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLTableHeaderCellElement.idl; sourceTree = "<group>"; };
                83FE5F201BD1C55E0038BEEC /* HTMLTableDataCellElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLTableDataCellElement.idl; sourceTree = "<group>"; };
                8419D2A4120D92D000141F8F /* SVGPathByteStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathByteStream.h; sourceTree = "<group>"; };
                                65DF31F009D1CC60000BE325 /* JSText.h */,
                                D7613AC214753E5600DB8606 /* JSWebKitNamedFlow.cpp */,
                                D7613AC314753E5600DB8606 /* JSWebKitNamedFlow.h */,
+                               83F570AE1C53268E007FD6CB /* JSXMLDocument.cpp */,
+                               83F570AD1C53268E007FD6CB /* JSXMLDocument.h */,
                        );
                        name = Core;
                        sourceTree = "<group>";
                                85031B3A0A44EFC700F992E0 /* WheelEvent.cpp */,
                                85031B3B0A44EFC700F992E0 /* WheelEvent.h */,
                                93EEC1F709C2877700C515D1 /* WheelEvent.idl */,
+                               830784B11C52EE1900104D1D /* XMLDocument.h */,
+                               830784B01C52EE1900104D1D /* XMLDocument.idl */,
                        );
                        path = dom;
                        sourceTree = "<group>";
                                5C4304B1191AC908000E2BC0 /* EXTShaderTextureLOD.h in Headers */,
                                7728694F14F8882500F484DC /* EXTTextureFilterAnisotropic.h in Headers */,
                                A75E8B890E1DE2D6007F2481 /* FEBlend.h in Headers */,
+                               830784B21C52EE2C00104D1D /* XMLDocument.h in Headers */,
                                A75E8B8B0E1DE2D6007F2481 /* FEColorMatrix.h in Headers */,
                                A75E8B8D0E1DE2D6007F2481 /* FEComponentTransfer.h in Headers */,
                                A75E8B8F0E1DE2D6007F2481 /* FEComposite.h in Headers */,
                                B2FA3DC90AB75A6F000E5AC4 /* JSSVGPathSegCurvetoQuadraticRel.h in Headers */,
                                B2FA3DCB0AB75A6F000E5AC4 /* JSSVGPathSegCurvetoQuadraticSmoothAbs.h in Headers */,
                                B2FA3DCD0AB75A6F000E5AC4 /* JSSVGPathSegCurvetoQuadraticSmoothRel.h in Headers */,
+                               8358CB701C53277500E0C2D8 /* JSXMLDocument.h in Headers */,
                                B2FA3DCF0AB75A6F000E5AC4 /* JSSVGPathSegLinetoAbs.h in Headers */,
                                B2FA3DD10AB75A6F000E5AC4 /* JSSVGPathSegLinetoHorizontalAbs.h in Headers */,
                                B2FA3DD30AB75A6F000E5AC4 /* JSSVGPathSegLinetoHorizontalRel.h in Headers */,
                                D06C0D900CFD11460065F43F /* RemoveFormatCommand.cpp in Sources */,
                                93309E04099E64920056E581 /* RemoveNodeCommand.cpp in Sources */,
                                93309E06099E64920056E581 /* RemoveNodePreservingChildrenCommand.cpp in Sources */,
+                               8358CB6F1C53277200E0C2D8 /* JSXMLDocument.cpp in Sources */,
                                7CD494CC1A86EB1D000A87EC /* RenderAttachment.cpp in Sources */,
                                BCEA485F097D93020094C9E4 /* RenderBlock.cpp in Sources */,
                                BC10D76717D8EE6E005E2626 /* RenderBlockFlow.cpp in Sources */,
index fc96dd0..dd47901 100644 (file)
 #include "JSWorkerCustom.cpp"
 #include "JSWorkerGlobalScopeBase.cpp"
 #include "JSWorkerGlobalScopeCustom.cpp"
+#include "JSXMLDocument.cpp"
 #include "JSXMLHttpRequestCustom.cpp"
 #include "JSXPathResultCustom.cpp"
 #include "JSXSLTProcessorCustom.cpp"
index aba7e38..75634b2 100644 (file)
@@ -36,6 +36,7 @@
 #include "SVGDocument.h"
 #include "ScriptController.h"
 #include "TouchList.h"
+#include "XMLDocument.h"
 #include <wtf/GetPtr.h>
 
 #if ENABLE(WEBGL)
@@ -58,6 +59,8 @@ static inline JSValue createNewDocumentWrapper(ExecState& state, JSDOMGlobalObje
         wrapper = CREATE_DOM_WRAPPER(&globalObject, HTMLDocument, &document);
     else if (document.isSVGDocument())
         wrapper = CREATE_DOM_WRAPPER(&globalObject, SVGDocument, &document);
+    else if (document.isXMLDocument())
+        wrapper = CREATE_DOM_WRAPPER(&globalObject, XMLDocument, &document);
     else
         wrapper = CREATE_DOM_WRAPPER(&globalObject, Document, &document);
 
index 34c8c05..0da3619 100644 (file)
@@ -55,6 +55,7 @@
 #include "SubframeLoader.h"
 #include "Text.h"
 #include "TextDocument.h"
+#include "XMLDocument.h"
 #include "XMLNames.h"
 #include <wtf/NeverDestroyed.h>
 #include <wtf/StdLibExtras.h>
@@ -220,16 +221,16 @@ DOMImplementation* DOMImplementation::getInterface(const String& /*feature*/)
     return 0;
 }
 
-RefPtr<Document> DOMImplementation::createDocument(const String& namespaceURI,
+RefPtr<XMLDocument> DOMImplementation::createDocument(const String& namespaceURI,
     const String& qualifiedName, DocumentType* doctype, ExceptionCode& ec)
 {
-    RefPtr<Document> doc;
+    RefPtr<XMLDocument> doc;
     if (namespaceURI == SVGNames::svgNamespaceURI)
         doc = SVGDocument::create(0, URL());
     else if (namespaceURI == HTMLNames::xhtmlNamespaceURI)
-        doc = Document::createXHTML(0, URL());
+        doc = XMLDocument::createXHTML(0, URL());
     else
-        doc = Document::create(0, URL());
+        doc = XMLDocument::create(0, URL());
 
     doc->setSecurityOriginPolicy(m_document.securityOriginPolicy());
 
@@ -320,7 +321,7 @@ Ref<Document> DOMImplementation::createDocument(const String& type, Frame* frame
     if (type == "text/html")
         return HTMLDocument::create(frame, url);
     if (type == "application/xhtml+xml")
-        return Document::createXHTML(frame, url);
+        return XMLDocument::createXHTML(frame, url);
 
 #if ENABLE(FTPDIR)
     // Plugins cannot take FTP from us either
@@ -371,7 +372,7 @@ Ref<Document> DOMImplementation::createDocument(const String& type, Frame* frame
         return SVGDocument::create(frame, url);
 
     if (isXMLMIMEType(type))
-        return Document::create(frame, url);
+        return XMLDocument::create(frame, url);
 
     return HTMLDocument::create(frame, url);
 }
index d27d8e7..2e80889 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "Document.h"
 #include "MediaPlayer.h"
+#include "XMLDocument.h"
 #include <memory>
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
@@ -53,7 +54,7 @@ public:
     // DOM methods & attributes for DOMImplementation
     static bool hasFeature(const String& feature, const String& version);
     RefPtr<DocumentType> createDocumentType(const String& qualifiedName, const String& publicId, const String& systemId, ExceptionCode&);
-    RefPtr<Document> createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionCode&);
+    RefPtr<XMLDocument> createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionCode&);
 
     DOMImplementation* getInterface(const String& feature);
 
index 312de22..42c8b63 100644 (file)
     [ObjCLegacyUnnamedParameters, RaisesException, NewObject] DocumentType createDocumentType([TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString qualifiedName,
                                                    [TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString publicId,
                                                    [TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString systemId);
-    [ObjCLegacyUnnamedParameters, RaisesException, NewObject] Document createDocument([TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString namespaceURI,
-                                           [TreatNullAs=NullString, Default=Undefined] optional DOMString qualifiedName, 
-                                           [TreatNullAs=NullString, Default=Undefined] optional DocumentType doctype);
+
+#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT
+    [ObjCLegacyUnnamedParameters, RaisesException] Document createDocument(optional DOMString namespaceURI, optional DOMString qualifiedName,
+        optional DocumentType doctype);
+#else
+    [RaisesException, NewObject] XMLDocument createDocument([TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString namespaceURI,
+        [TreatNullAs=NullString, Default=Undefined] optional DOMString qualifiedName,
+        [TreatNullAs=NullString, Default=Undefined] optional DocumentType doctype);
+#endif
 
     // DOMImplementationCSS interface from DOM Level 2 CSS
 
index 3eb28c8..5d24705 100644 (file)
 #include "TreeWalker.h"
 #include "VisitedLinkState.h"
 #include "WheelEvent.h"
+#include "XMLDocument.h"
 #include "XMLDocumentParser.h"
 #include "XMLNSNames.h"
 #include "XMLNames.h"
@@ -3510,7 +3511,12 @@ Ref<Node> Document::cloneNodeInternal(Document&, CloningOperation type)
 
 Ref<Document> Document::cloneDocumentWithoutChildren() const
 {
-    return isXHTMLDocument() ? createXHTML(nullptr, url()) : create(nullptr, url());
+    if (isXMLDocument()) {
+        if (isXHTMLDocument())
+            return XMLDocument::createXHTML(nullptr, url());
+        return XMLDocument::create(nullptr, url());
+    }
+    return create(nullptr, url());
 }
 
 void Document::cloneDataFromDocument(const Document& other)
index fce4da3..4fda9a7 100644 (file)
@@ -266,7 +266,8 @@ enum DocumentClass {
     PluginDocumentClass = 1 << 3,
     MediaDocumentClass = 1 << 4,
     SVGDocumentClass = 1 << 5,
-    TextDocumentClass = 1 << 6
+    TextDocumentClass = 1 << 6,
+    XMLDocumentClass = 1 << 7,
 };
 
 typedef unsigned char DocumentClassFlags;
@@ -301,10 +302,7 @@ public:
     {
         return adoptRef(*new Document(frame, url));
     }
-    static Ref<Document> createXHTML(Frame* frame, const URL& url)
-    {
-        return adoptRef(*new Document(frame, url, XHTMLDocumentClass));
-    }
+
     static Ref<Document> createNonRenderedPlaceholder(Frame* frame, const URL& url)
     {
         return adoptRef(*new Document(frame, url, DefaultDocumentClass, NonRenderedPlaceholder));
@@ -487,6 +485,7 @@ public:
     bool isSynthesized() const { return m_isSynthesized; }
     bool isHTMLDocument() const { return m_documentClasses & HTMLDocumentClass; }
     bool isXHTMLDocument() const { return m_documentClasses & XHTMLDocumentClass; }
+    bool isXMLDocument() const { return m_documentClasses & XMLDocumentClass; }
     bool isImageDocument() const { return m_documentClasses & ImageDocumentClass; }
     bool isSVGDocument() const { return m_documentClasses & SVGDocumentClass; }
     bool isPluginDocument() const { return m_documentClasses & PluginDocumentClass; }
diff --git a/Source/WebCore/dom/XMLDocument.h b/Source/WebCore/dom/XMLDocument.h
new file mode 100644 (file)
index 0000000..7e6f1b9
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef XMLDocument_h
+#define XMLDocument_h
+
+#include "Document.h"
+
+namespace WebCore {
+
+class XMLDocument : public Document {
+public:
+    static Ref<XMLDocument> create(Frame* frame, const URL& url)
+    {
+        return adoptRef(*new XMLDocument(frame, url));
+    }
+
+    static Ref<XMLDocument> createXHTML(Frame* frame, const URL& url)
+    {
+        return adoptRef(*new XMLDocument(frame, url, XHTMLDocumentClass));
+    }
+
+protected:
+    XMLDocument(Frame* frame, const URL& url, unsigned documentClasses = DefaultDocumentClass)
+        : Document(frame, url, XMLDocumentClass | documentClasses)
+    { }
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::XMLDocument)
+    static bool isType(const WebCore::Document& document) { return document.isXMLDocument(); }
+    static bool isType(const WebCore::Node& node) { return is<WebCore::Document>(node) && isType(downcast<WebCore::Document>(node)); }
+SPECIALIZE_TYPE_TRAITS_END()
+
+#endif // XMLDocument_h
diff --git a/Source/WebCore/dom/XMLDocument.idl b/Source/WebCore/dom/XMLDocument.idl
new file mode 100644 (file)
index 0000000..d4e301a
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+interface XMLDocument : Document
+{
+};
index 249f64e..b69238c 100644 (file)
@@ -42,6 +42,7 @@
 #include "HTMLNames.h"
 #include "InspectorHistory.h"
 #include "Node.h"
+#include "XMLDocument.h"
 #include "XMLDocumentParser.h"
 
 #include <wtf/Deque.h>
@@ -88,9 +89,9 @@ void DOMPatchSupport::patchDocument(const String& markup)
     if (m_document->isHTMLDocument())
         newDocument = HTMLDocument::create(nullptr, URL());
     else if (m_document->isXHTMLDocument())
-        newDocument = HTMLDocument::createXHTML(nullptr, URL());
+        newDocument = XMLDocument::createXHTML(nullptr, URL());
     else if (m_document->isSVGDocument())
-        newDocument = Document::create(nullptr, URL());
+        newDocument = XMLDocument::create(nullptr, URL());
 
     ASSERT(newDocument);
     RefPtr<DocumentParser> parser;
index 8b33edb..4fa946e 100644 (file)
@@ -767,7 +767,7 @@ void InspectorDOMAgent::setOuterHTML(ErrorString& errorString, int nodeId, const
         return;
 
     Document& document = node->document();
-    if (!document.isHTMLDocument() && !document.isXHTMLDocument() && !document.isSVGDocument()) {
+    if (!document.isHTMLDocument() && !document.isXMLDocument()) {
         errorString = ASCIILiteral("Not an HTML/XML document");
         return;
     }
index ec5ec2d..2718580 100644 (file)
     // Additional constructors.
     [CustomGetter, CustomConstructor] attribute HTMLImageElementNamedConstructor Image; // Usable with new operator
 
-    // Mozilla has a separate XMLDocument object for XML documents.
-    // We just use Document for this.
-    attribute DocumentConstructor XMLDocument;
-
     [Conditional=IOS_TOUCH_EVENTS, CustomGetter] attribute TouchConstructor Touch; // Usable with the new operator
     [Conditional=IOS_TOUCH_EVENTS, CustomGetter] attribute TouchListConstructor TouchList; // Usable with the new operator
 
index e8141cb..9766b26 100644 (file)
@@ -116,7 +116,7 @@ SerializerMarkupAccumulator::SerializerMarkupAccumulator(PageSerializer& seriali
     , m_document(document)
 {
     // MarkupAccumulator does not serialize the <?xml ... line, so we add it explicitely to ensure the right encoding is specified.
-    if (m_document.isXHTMLDocument() || m_document.xmlStandalone() || m_document.isSVGDocument())
+    if (m_document.isXMLDocument() || m_document.xmlStandalone())
         appendString("<?xml version=\"" + m_document.xmlVersion() + "\" encoding=\"" + m_document.charset() + "\"?>");
 }
 
index cc42cac..b887872 100644 (file)
@@ -28,7 +28,7 @@
 namespace WebCore {
 
 SVGDocument::SVGDocument(Frame* frame, const URL& url)
-    : Document(frame, url, SVGDocumentClass)
+    : XMLDocument(frame, url, SVGDocumentClass)
 {
 }
 
index b4f1c15..e7e374b 100644 (file)
 #ifndef SVGDocument_h
 #define SVGDocument_h
 
-#include "Document.h"
+#include "XMLDocument.h"
 
 namespace WebCore {
 
 class SVGSVGElement;
 
-class SVGDocument final : public Document {
+class SVGDocument final : public XMLDocument {
 public:
     static Ref<SVGDocument> create(Frame*, const URL&);
 
index dced411..7f91e93 100644 (file)
@@ -19,7 +19,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
-interface SVGDocument : Document {
+// FIXME: This interface no longer exists in SVG2.
+interface SVGDocument : XMLDocument {
     readonly attribute SVGSVGElement        rootElement;
 
     // Overwrite the one in events::DocumentEvent
index 8a3ff1c..db2fb8a 100644 (file)
@@ -216,7 +216,7 @@ Document* XMLHttpRequest::responseXML(ExceptionCode& ec)
             if (isHTML)
                 m_responseDocument = HTMLDocument::create(0, m_url);
             else
-                m_responseDocument = Document::create(0, m_url);
+                m_responseDocument = XMLDocument::create(0, m_url);
             // FIXME: Set Last-Modified.
             m_responseDocument->setContent(m_responseBuilder.toStringPreserveCapacity());
             m_responseDocument->setSecurityOriginPolicy(scriptExecutionContext()->securityOriginPolicy());
index b4fbdef..907e9c7 100644 (file)
@@ -40,6 +40,7 @@
 #include "SecurityOriginPolicy.h"
 #include "Text.h"
 #include "TextResourceDecoder.h"
+#include "XMLDocument.h"
 #include "markup.h"
 
 #include <wtf/Assertions.h>
@@ -77,7 +78,7 @@ Ref<Document> XSLTProcessor::createDocumentFromSource(const String& sourceString
 
     RefPtr<Document> result;
     if (sourceMIMEType == "text/plain") {
-        result = Document::createXHTML(frame, sourceIsDocument ? ownerDocument->url() : URL());
+        result = XMLDocument::createXHTML(frame, sourceIsDocument ? ownerDocument->url() : URL());
         transformTextStringToXHTMLDocumentString(documentSource);
     } else
         result = DOMImplementation::createDocument(sourceMIMEType, frame, sourceIsDocument ? ownerDocument->url() : URL());