Title: [236433] trunk
Revision
236433
Author
[email protected]
Date
2018-09-24 15:55:56 -0700 (Mon, 24 Sep 2018)

Log Message

No-op document.open() calls should not have any side effects
https://bugs.webkit.org/show_bug.cgi?id=189373
<rdar://problem/44282702>

Reviewed by Geoffrey Garen.

LayoutTests/imported/w3c:

Rebaseline WPT test now that it is passing.

* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-side-effects-synchronous-script.window-expected.txt:

Source/WebCore:

Update document.open() implementation to match the specification [1] more closely.
In particular, URLs updates should happen much later, at step 11. They were happening
too early and would cause side effects when returning early.

[1] https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#document-open-steps

No new tests, rebaselined existing test.

* dom/Document.cpp:
(WebCore::Document::open):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (236432 => 236433)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-09-24 22:47:35 UTC (rev 236432)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-09-24 22:55:56 UTC (rev 236433)
@@ -1,5 +1,17 @@
 2018-09-24  Chris Dumez  <[email protected]>
 
+        No-op document.open() calls should not have any side effects
+        https://bugs.webkit.org/show_bug.cgi?id=189373
+        <rdar://problem/44282702>
+
+        Reviewed by Geoffrey Garen.
+
+        Rebaseline WPT test now that it is passing.
+
+        * web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-side-effects-synchronous-script.window-expected.txt:
+
+2018-09-24  Chris Dumez  <[email protected]>
+
         Import html/webappapis/dynamic-markup-insertion WPT tests
         https://bugs.webkit.org/show_bug.cgi?id=189863
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-side-effects-synchronous-script.window-expected.txt (236432 => 236433)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-side-effects-synchronous-script.window-expected.txt	2018-09-24 22:47:35 UTC (rev 236432)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-side-effects-synchronous-script.window-expected.txt	2018-09-24 22:55:56 UTC (rev 236433)
@@ -1,3 +1,3 @@
 
-FAIL document.open bailout should not have any side effects (active parser whose script nesting level is greater than 0) assert_equals: The original URL should be kept (active parser whose script nesting level is greater than 0) expected "http://localhost:8800/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/bailout-order-synchronous-script-frame.html" but got "http://localhost:8800/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-side-effects-synchronous-script.window.html"
+PASS document.open bailout should not have any side effects (active parser whose script nesting level is greater than 0) 
 

Modified: trunk/Source/WebCore/ChangeLog (236432 => 236433)


--- trunk/Source/WebCore/ChangeLog	2018-09-24 22:47:35 UTC (rev 236432)
+++ trunk/Source/WebCore/ChangeLog	2018-09-24 22:55:56 UTC (rev 236433)
@@ -1,3 +1,22 @@
+2018-09-24  Chris Dumez  <[email protected]>
+
+        No-op document.open() calls should not have any side effects
+        https://bugs.webkit.org/show_bug.cgi?id=189373
+        <rdar://problem/44282702>
+
+        Reviewed by Geoffrey Garen.
+
+        Update document.open() implementation to match the specification [1] more closely.
+        In particular, URLs updates should happen much later, at step 11. They were happening
+        too early and would cause side effects when returning early.
+
+        [1] https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#document-open-steps
+
+        No new tests, rebaselined existing test.
+
+        * dom/Document.cpp:
+        (WebCore::Document::open):
+
 2018-09-24  Daniel Bates  <[email protected]>
 
         Include more headers in IOSurface.mm, PixelBufferResizer.{h, mm}

Modified: trunk/Source/WebCore/dom/Document.cpp (236432 => 236433)


--- trunk/Source/WebCore/dom/Document.cpp	2018-09-24 22:47:35 UTC (rev 236432)
+++ trunk/Source/WebCore/dom/Document.cpp	2018-09-24 22:55:56 UTC (rev 236433)
@@ -2676,12 +2676,6 @@
     if (m_ignoreOpensDuringUnloadCount)
         return;
 
-    if (responsibleDocument) {
-        setURL(responsibleDocument->url());
-        setCookieURL(responsibleDocument->cookieURL());
-        setSecurityOriginPolicy(responsibleDocument->securityOriginPolicy());
-    }
-
     if (m_frame) {
         if (ScriptableDocumentParser* parser = scriptableDocumentParser()) {
             if (parser->isParsing()) {
@@ -2701,6 +2695,13 @@
     }
 
     removeAllEventListeners();
+
+    if (responsibleDocument) {
+        setURL(responsibleDocument->url());
+        setCookieURL(responsibleDocument->cookieURL());
+        setSecurityOriginPolicy(responsibleDocument->securityOriginPolicy());
+    }
+
     implicitOpen();
     if (ScriptableDocumentParser* parser = scriptableDocumentParser())
         parser->setWasCreatedByScript(true);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to