Title: [247880] trunk
Revision
247880
Author
beid...@apple.com
Date
2019-07-26 15:53:47 -0700 (Fri, 26 Jul 2019)

Log Message

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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (247879 => 247880)


--- trunk/LayoutTests/ChangeLog	2019-07-26 21:27:38 UTC (rev 247879)
+++ trunk/LayoutTests/ChangeLog	2019-07-26 22:53:47 UTC (rev 247880)
@@ -1,3 +1,13 @@
+2019-07-26  Brady Eidson  <beid...@apple.com>
+
+        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-26  Chris Dumez  <cdu...@apple.com>
 
         [iOS] WebPage::TouchEventSync() & WebPage::GetPositionInformation() sync IPC causes UIProcess hangs

Added: trunk/LayoutTests/http/tests/dom/ready-state-on-_javascript_-replace-expected.txt (0 => 247880)


--- trunk/LayoutTests/http/tests/dom/ready-state-on-_javascript_-replace-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/dom/ready-state-on-_javascript_-replace-expected.txt	2019-07-26 22:53:47 UTC (rev 247880)
@@ -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: trunk/LayoutTests/http/tests/dom/ready-state-on-_javascript_-replace.html (0 => 247880)


--- trunk/LayoutTests/http/tests/dom/ready-state-on-_javascript_-replace.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/dom/ready-state-on-_javascript_-replace.html	2019-07-26 22:53:47 UTC (rev 247880)
@@ -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: trunk/Source/WebCore/ChangeLog (247879 => 247880)


--- trunk/Source/WebCore/ChangeLog	2019-07-26 21:27:38 UTC (rev 247879)
+++ trunk/Source/WebCore/ChangeLog	2019-07-26 22:53:47 UTC (rev 247880)
@@ -1,3 +1,20 @@
+2019-07-26  Brady Eidson  <beid...@apple.com>
+
+        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  Zalan Bujtas  <za...@apple.com>
 
         [iPadOS] wix.com cannot select a template to edit or view

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (247879 => 247880)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2019-07-26 21:27:38 UTC (rev 247879)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2019-07-26 22:53:47 UTC (rev 247880)
@@ -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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to