Title: [247910] branches/safari-608.1-branch
Revision
247910
Author
[email protected]
Date
2019-07-29 11:35:28 -0700 (Mon, 29 Jul 2019)

Log Message

Cherry-pick r247880. rdar://problem/53647904

    Do not fire readystatechange events at documents about to get replaced by _javascript_ URLs.
    <rdar://problem/51665406> and https://bugs.webkit.org/show_bug.cgi?id=198786

    Reviewed by Ryosuke Niwa.

    Source/WebCore:

    Test: http/tests/dom/ready-state-on-_javascript_-replace.html

    We were firing too many readystatechange events, more than other browsers.
    Our behavior on this test with this patch now matches Chrome.

    (There was even an ancient FIXME alluding to this referencing a spec issue, and that issues has long been resolvedv)

    * loader/FrameLoader.cpp:
    (WebCore::FrameLoader::stopLoading):

    LayoutTests:

    * http/tests/dom/ready-state-on-_javascript_-replace-expected.txt: Added.
    * http/tests/dom/ready-state-on-_javascript_-replace.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-608.1-branch/LayoutTests/ChangeLog (247909 => 247910)


--- branches/safari-608.1-branch/LayoutTests/ChangeLog	2019-07-29 18:31:04 UTC (rev 247909)
+++ branches/safari-608.1-branch/LayoutTests/ChangeLog	2019-07-29 18:35:28 UTC (rev 247910)
@@ -1,3 +1,41 @@
+2019-07-29  Alan Coon  <[email protected]>
+
+        Cherry-pick r247880. rdar://problem/53647904
+
+    Do not fire readystatechange events at documents about to get replaced by _javascript_ URLs.
+    <rdar://problem/51665406> and https://bugs.webkit.org/show_bug.cgi?id=198786
+    
+    Reviewed by Ryosuke Niwa.
+    
+    Source/WebCore:
+    
+    Test: http/tests/dom/ready-state-on-_javascript_-replace.html
+    
+    We were firing too many readystatechange events, more than other browsers.
+    Our behavior on this test with this patch now matches Chrome.
+    
+    (There was even an ancient FIXME alluding to this referencing a spec issue, and that issues has long been resolvedv)
+    
+    * loader/FrameLoader.cpp:
+    (WebCore::FrameLoader::stopLoading):
+    
+    LayoutTests:
+    
+    * http/tests/dom/ready-state-on-_javascript_-replace-expected.txt: Added.
+    * http/tests/dom/ready-state-on-_javascript_-replace.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-07-26  Brady Eidson  <[email protected]>
+
+            Do not fire readystatechange events at documents about to get replaced by _javascript_ URLs.
+            <rdar://problem/51665406> and https://bugs.webkit.org/show_bug.cgi?id=198786
+
+            Reviewed by Ryosuke Niwa.
+
+            * http/tests/dom/ready-state-on-_javascript_-replace-expected.txt: Added.
+            * http/tests/dom/ready-state-on-_javascript_-replace.html: Added.
+
 2019-07-24  Alan Coon  <[email protected]>
 
         Cherry-pick r247674. rdar://problem/53483295

Added: branches/safari-608.1-branch/LayoutTests/http/tests/dom/ready-state-on-_javascript_-replace-expected.txt (0 => 247910)


--- branches/safari-608.1-branch/LayoutTests/http/tests/dom/ready-state-on-_javascript_-replace-expected.txt	                        (rev 0)
+++ branches/safari-608.1-branch/LayoutTests/http/tests/dom/ready-state-on-_javascript_-replace-expected.txt	2019-07-29 18:35:28 UTC (rev 247910)
@@ -0,0 +1,3 @@
+This test makes sure an iframe whose document is being closed to be replaced by a _javascript_: url doesn't fire a readystatechange event.
+You should see no alerts.
+

Added: branches/safari-608.1-branch/LayoutTests/http/tests/dom/ready-state-on-_javascript_-replace.html (0 => 247910)


--- branches/safari-608.1-branch/LayoutTests/http/tests/dom/ready-state-on-_javascript_-replace.html	                        (rev 0)
+++ branches/safari-608.1-branch/LayoutTests/http/tests/dom/ready-state-on-_javascript_-replace.html	2019-07-29 18:35:28 UTC (rev 247910)
@@ -0,0 +1,26 @@
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+window._onload_ = () => {
+    frame = document.createElement('iframe');
+    frame.src = ""
+    document.body.appendChild(frame);
+
+    frame.contentDocument.open();
+    frame.contentDocument._onreadystatechange_ = () => {
+        alert("Outer handler: " + frame.contentDocument.readyState);
+        frame.contentWindow.addEventListener('readystatechange', () => {
+            alert("Inner handler: " + frame.contentDocument.readyState);
+        }, {capture: true, once: true});
+    }
+    frame.src = '' + 'ipt>"';
+}
+
+</script>
+<body>
+This test makes sure an iframe whose document is being closed to be replaced by a _javascript_: url doesn't fire a readystatechange event.<br>
+You should see no alerts.<br>
+</body>
\ No newline at end of file

Modified: branches/safari-608.1-branch/Source/WebCore/ChangeLog (247909 => 247910)


--- branches/safari-608.1-branch/Source/WebCore/ChangeLog	2019-07-29 18:31:04 UTC (rev 247909)
+++ branches/safari-608.1-branch/Source/WebCore/ChangeLog	2019-07-29 18:35:28 UTC (rev 247910)
@@ -1,3 +1,48 @@
+2019-07-29  Alan Coon  <[email protected]>
+
+        Cherry-pick r247880. rdar://problem/53647904
+
+    Do not fire readystatechange events at documents about to get replaced by _javascript_ URLs.
+    <rdar://problem/51665406> and https://bugs.webkit.org/show_bug.cgi?id=198786
+    
+    Reviewed by Ryosuke Niwa.
+    
+    Source/WebCore:
+    
+    Test: http/tests/dom/ready-state-on-_javascript_-replace.html
+    
+    We were firing too many readystatechange events, more than other browsers.
+    Our behavior on this test with this patch now matches Chrome.
+    
+    (There was even an ancient FIXME alluding to this referencing a spec issue, and that issues has long been resolvedv)
+    
+    * loader/FrameLoader.cpp:
+    (WebCore::FrameLoader::stopLoading):
+    
+    LayoutTests:
+    
+    * http/tests/dom/ready-state-on-_javascript_-replace-expected.txt: Added.
+    * http/tests/dom/ready-state-on-_javascript_-replace.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-07-26  Brady Eidson  <[email protected]>
+
+            Do not fire readystatechange events at documents about to get replaced by _javascript_ URLs.
+            <rdar://problem/51665406> and https://bugs.webkit.org/show_bug.cgi?id=198786
+
+            Reviewed by Ryosuke Niwa.
+
+            Test: http/tests/dom/ready-state-on-_javascript_-replace.html
+
+            We were firing too many readystatechange events, more than other browsers.
+            Our behavior on this test with this patch now matches Chrome.
+
+            (There was even an ancient FIXME alluding to this referencing a spec issue, and that issues has long been resolvedv)
+
+            * loader/FrameLoader.cpp:
+            (WebCore::FrameLoader::stopLoading):
+
 2019-07-26  Babak Shafiei  <[email protected]>
 
         Cherry-pick r247755. rdar://problem/53575424

Modified: branches/safari-608.1-branch/Source/WebCore/loader/FrameLoader.cpp (247909 => 247910)


--- branches/safari-608.1-branch/Source/WebCore/loader/FrameLoader.cpp	2019-07-29 18:31:04 UTC (rev 247909)
+++ branches/safari-608.1-branch/Source/WebCore/loader/FrameLoader.cpp	2019-07-29 18:35:28 UTC (rev 247910)
@@ -497,10 +497,6 @@
     }
 
     if (auto* document = m_frame.document()) {
-        // FIXME: HTML5 doesn't tell us to set the state to complete when aborting, but we do anyway to match legacy behavior.
-        // http://www.w3.org/Bugs/Public/show_bug.cgi?id=10537
-        document->setReadyState(Document::Complete);
-
         // FIXME: Should the DatabaseManager watch for something like ActiveDOMObject::stop() rather than being special-cased here?
         DatabaseManager::singleton().stopDatabases(*document, nullptr);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to