Diff
Modified: trunk/LayoutTests/ChangeLog (216045 => 216046)
--- trunk/LayoutTests/ChangeLog 2017-05-02 00:01:15 UTC (rev 216045)
+++ trunk/LayoutTests/ChangeLog 2017-05-02 00:02:16 UTC (rev 216046)
@@ -1,3 +1,15 @@
+2017-05-01 Chris Dumez <[email protected]>
+
+ Documents created using DOMParser.parseFromString should inherit their context document's origin / URL
+ https://bugs.webkit.org/show_bug.cgi?id=171499
+
+ Reviewed by Sam Weinig.
+
+ Add layout test coverage. I have verified that this test passes in both Firefox and Chrome.
+
+ * fast/dom/domparser-parsefromstring-origin-expected.txt: Added.
+ * fast/dom/domparser-parsefromstring-origin.html: Added.
+
2017-05-01 Ryan Haddad <[email protected]>
Mark inspector/debugger/tail-recursion.html as flaky.
Added: trunk/LayoutTests/fast/dom/domparser-parsefromstring-origin-expected.txt (0 => 216046)
--- trunk/LayoutTests/fast/dom/domparser-parsefromstring-origin-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/domparser-parsefromstring-origin-expected.txt 2017-05-02 00:02:16 UTC (rev 216046)
@@ -0,0 +1,12 @@
+Tests that documents created via DOMParser.parseFromString() inherit their context document's origin / URL
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS newDocument.origin is document.origin
+PASS newDocument.URL is document.URL
+PASS newDocument.location is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/domparser-parsefromstring-origin.html (0 => 216046)
--- trunk/LayoutTests/fast/dom/domparser-parsefromstring-origin.html (rev 0)
+++ trunk/LayoutTests/fast/dom/domparser-parsefromstring-origin.html 2017-05-02 00:02:16 UTC (rev 216046)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests that documents created via DOMParser.parseFromString() inherit their context document's origin / URL");
+
+const newDocument = (new DOMParser).parseFromString('', 'text/html');
+shouldBe("newDocument.origin", "document.origin");
+shouldBe("newDocument.URL", "document.URL");
+shouldBeNull("newDocument.location");
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (216045 => 216046)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-05-02 00:01:15 UTC (rev 216045)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-05-02 00:02:16 UTC (rev 216046)
@@ -1,3 +1,15 @@
+2017-05-01 Chris Dumez <[email protected]>
+
+ Documents created using DOMParser.parseFromString should inherit their context document's origin / URL
+ https://bugs.webkit.org/show_bug.cgi?id=171499
+
+ Reviewed by Sam Weinig.
+
+ Rebaseline web-platform-tests now that more checks are passing.
+
+ * web-platform-tests/domparsing/DOMParser-parseFromString-html-expected.txt:
+ * web-platform-tests/domparsing/DOMParser-parseFromString-xml-expected.txt:
+
2017-05-01 Joseph Pecoraro <[email protected]>
RejectedPromiseTracker should produce better callstacks and avoid capturing callstacks unless there is a debugger/inspector
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-html-expected.txt (216045 => 216046)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-html-expected.txt 2017-05-02 00:01:15 UTC (rev 216045)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-html-expected.txt 2017-05-02 00:02:16 UTC (rev 216046)
@@ -4,8 +4,8 @@
PASS characterSet
PASS inputEncoding
PASS charset
-FAIL URL value assert_equals: The document must have a URL value equal to the URL of the active document. expected "http://localhost:8800/domparsing/DOMParser-parseFromString-html.html" but got "about:blank"
-FAIL baseURI value assert_equals: expected "http://localhost:8800/domparsing/DOMParser-parseFromString-html.html" but got "about:blank"
+PASS URL value
+PASS baseURI value
PASS Location value
PASS DOMParser parses HTML tag soup with no problems
PASS DOMParser throws on an invalid enum value
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-expected.txt (216045 => 216046)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-expected.txt 2017-05-02 00:01:15 UTC (rev 216045)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-expected.txt 2017-05-02 00:02:16 UTC (rev 216046)
@@ -1,18 +1,18 @@
-FAIL Should parse correctly in type text/xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+FAIL Should parse correctly in type text/xml assert_equals: contentType expected "text/xml" but got "application/xml"
FAIL XMLDocument interface for correctly parsed document with type text/xml assert_false: Should not be XMLDocument expected false got true
-FAIL Should return an error document for XML wellformedness errors in type text/xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+FAIL Should return an error document for XML wellformedness errors in type text/xml assert_equals: contentType expected "text/xml" but got "application/xml"
FAIL XMLDocument interface for incorrectly parsed document with type text/xml assert_false: Should not be XMLDocument expected false got true
-FAIL Should parse correctly in type application/xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+PASS Should parse correctly in type application/xml
FAIL XMLDocument interface for correctly parsed document with type application/xml assert_false: Should not be XMLDocument expected false got true
-FAIL Should return an error document for XML wellformedness errors in type application/xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+FAIL Should return an error document for XML wellformedness errors in type application/xml assert_equals: expected (string) "http://www.mozilla.org/newlayout/xml/parsererror.xml" but got (object) null
FAIL XMLDocument interface for incorrectly parsed document with type application/xml assert_false: Should not be XMLDocument expected false got true
-FAIL Should parse correctly in type application/xhtml+xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+PASS Should parse correctly in type application/xhtml+xml
FAIL XMLDocument interface for correctly parsed document with type application/xhtml+xml assert_false: Should not be XMLDocument expected false got true
-FAIL Should return an error document for XML wellformedness errors in type application/xhtml+xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+FAIL Should return an error document for XML wellformedness errors in type application/xhtml+xml assert_equals: expected (string) "http://www.mozilla.org/newlayout/xml/parsererror.xml" but got (object) null
FAIL XMLDocument interface for incorrectly parsed document with type application/xhtml+xml assert_false: Should not be XMLDocument expected false got true
-FAIL Should parse correctly in type image/svg+xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+PASS Should parse correctly in type image/svg+xml
FAIL XMLDocument interface for correctly parsed document with type image/svg+xml assert_false: Should not be XMLDocument expected false got true
-FAIL Should return an error document for XML wellformedness errors in type image/svg+xml assert_equals: URL expected "http://localhost:8800/domparsing/DOMParser-parseFromString-xml.html" but got "about:blank"
+FAIL Should return an error document for XML wellformedness errors in type image/svg+xml assert_equals: expected (string) "http://www.mozilla.org/newlayout/xml/parsererror.xml" but got (object) null
FAIL XMLDocument interface for incorrectly parsed document with type image/svg+xml assert_false: Should not be XMLDocument expected false got true
Modified: trunk/Source/WebCore/ChangeLog (216045 => 216046)
--- trunk/Source/WebCore/ChangeLog 2017-05-02 00:01:15 UTC (rev 216045)
+++ trunk/Source/WebCore/ChangeLog 2017-05-02 00:02:16 UTC (rev 216046)
@@ -1,3 +1,19 @@
+2017-05-01 Chris Dumez <[email protected]>
+
+ Documents created using DOMParser.parseFromString should inherit their context document's origin / URL
+ https://bugs.webkit.org/show_bug.cgi?id=171499
+
+ Reviewed by Sam Weinig.
+
+ Documents created using DOMParser.parseFromString should inherit their context document's
+ origin / URL:
+ - https://w3c.github.io/DOM-Parsing/#dom-domparser-parsefromstring
+
+ Test: fast/dom/domparser-parsefromstring-origin.html
+
+ * xml/DOMParser.cpp:
+ (WebCore::DOMParser::parseFromString):
+
2017-05-01 Ross Kirsling <[email protected]>
Web Inspector: ASSERT(!m_startedComposite) fails when recording on non-Cocoa Timeline
Modified: trunk/Source/WebCore/xml/DOMParser.cpp (216045 => 216046)
--- trunk/Source/WebCore/xml/DOMParser.cpp 2017-05-02 00:01:15 UTC (rev 216045)
+++ trunk/Source/WebCore/xml/DOMParser.cpp 2017-05-02 00:02:16 UTC (rev 216046)
@@ -21,6 +21,7 @@
#include "DOMImplementation.h"
#include "ExceptionCode.h"
+#include "SecurityOriginPolicy.h"
namespace WebCore {
@@ -42,6 +43,10 @@
if (m_contextDocument)
document->setContextDocument(*m_contextDocument.get());
document->setContent(string);
+ if (m_contextDocument) {
+ document->setURL(m_contextDocument->url());
+ document->setSecurityOriginPolicy(m_contextDocument->securityOriginPolicy());
+ }
return WTFMove(document);
}