Title: [241808] releases/WebKitGTK/webkit-2.24
Revision
241808
Author
[email protected]
Date
2019-02-20 04:45:08 -0800 (Wed, 20 Feb 2019)

Log Message

Merge r241780 - REGRESSION(r240909): Release assertion in FrameLoader::loadPostRequest when opening new window
https://bugs.webkit.org/show_bug.cgi?id=194820

Reviewed by Geoffrey Garen.

Source/WebCore:

This release assertion was wrong. The invocation of PolicyChecker::checkNewWindowPolicy in FrameLoader
doesn’t require PolicyChecker's load type to be set in PolicyChecker because FrameLoader's
continueLoadAfterNewWindowPolicy invokes loadWithNavigationAction which sets the load type later,
and we don't rely on PolicyChecker's load type until then.

Fixed the crash by removing relese asserts before invoking checkNewWindowPolicy accordingly.

This patch reverts r241015 since it too was asserting that PolicyChecker's load type is set before
invoking checkNewWindowPolicy which is not the right assumption.

Test: fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadURL):
(WebCore::FrameLoader::load):
(WebCore::FrameLoader::loadPostRequest):

LayoutTests:

Added a regression test.

* fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation-expected.txt: Added.
* fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.24/LayoutTests/ChangeLog (241807 => 241808)


--- releases/WebKitGTK/webkit-2.24/LayoutTests/ChangeLog	2019-02-20 12:45:02 UTC (rev 241807)
+++ releases/WebKitGTK/webkit-2.24/LayoutTests/ChangeLog	2019-02-20 12:45:08 UTC (rev 241808)
@@ -1,3 +1,15 @@
+2019-02-19  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r240909): Release assertion in FrameLoader::loadPostRequest when opening new window
+        https://bugs.webkit.org/show_bug.cgi?id=194820
+
+        Reviewed by Geoffrey Garen.
+
+        Added a regression test.
+
+        * fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation-expected.txt: Added.
+        * fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html: Added.
+
 2019-02-18  John Wilander  <[email protected]>
 
         Check the existence of the frame in Document::hasFrameSpecificStorageAccess() and Document::setHasFrameSpecificStorageAccess()

Added: releases/WebKitGTK/webkit-2.24/LayoutTests/fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation-expected.txt (0 => 241808)


--- releases/WebKitGTK/webkit-2.24/LayoutTests/fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.24/LayoutTests/fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation-expected.txt	2019-02-20 12:45:08 UTC (rev 241808)
@@ -0,0 +1,5 @@
+ALERT: PASS
+This tests navigating via an anchor element with a non-existent target name, which should create a new window.
+WebKit should not hit any assertions and alert "PASS".
+
+

Added: releases/WebKitGTK/webkit-2.24/LayoutTests/fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html (0 => 241808)


--- releases/WebKitGTK/webkit-2.24/LayoutTests/fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.24/LayoutTests/fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html	2019-02-20 12:45:08 UTC (rev 241808)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script>
+
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+    testRunner.setCanOpenWindows();
+    testRunner.setCloseRemainingWindowsWhenComplete();
+    testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
+}
+
+if (location.search == '?third') {
+    alert('PASS');
+    if (window.testRunner)
+        testRunner.notifyDone();
+} else if (self == top) {
+    document.write(`<p>This tests navigating via an anchor element with a non-existent target name, which should create a new window.<br>
+WebKit should not hit any assertions and alert "PASS".</p>`);
+    const frame = document.createElement('iframe');
+    frame.src = '';
+    let step = 0;
+    frame._onload_ = () => {
+        switch (step++) {
+        case 0:
+            setTimeout(() => frame.src = '', 0);
+            break;
+        case 1:
+            setTimeout(() => history.back(), 0);
+            break;
+        }
+    }
+    document.body.appendChild(frame);
+} else {
+    if (location.search == '?first') {
+        if (localStorage.getItem('loaded')) {
+            localStorage.removeItem('loaded');
+            window._onload_ = () => {
+                setTimeout(() => document.querySelector('form').submit(), 0);
+            }
+        } else
+            localStorage.setItem('loaded', 'true');
+    }
+    document.write(location.search);
+    document.write(` <form action="" method="post" target="unknownTarget"><input type="text" name="query"><input type="submit"></a>`);
+}
+
+</script>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog (241807 => 241808)


--- releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog	2019-02-20 12:45:02 UTC (rev 241807)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog	2019-02-20 12:45:08 UTC (rev 241808)
@@ -1,3 +1,27 @@
+2019-02-19  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r240909): Release assertion in FrameLoader::loadPostRequest when opening new window
+        https://bugs.webkit.org/show_bug.cgi?id=194820
+
+        Reviewed by Geoffrey Garen.
+
+        This release assertion was wrong. The invocation of PolicyChecker::checkNewWindowPolicy in FrameLoader
+        doesn’t require PolicyChecker's load type to be set in PolicyChecker because FrameLoader's
+        continueLoadAfterNewWindowPolicy invokes loadWithNavigationAction which sets the load type later,
+        and we don't rely on PolicyChecker's load type until then.
+
+        Fixed the crash by removing relese asserts before invoking checkNewWindowPolicy accordingly.
+
+        This patch reverts r241015 since it too was asserting that PolicyChecker's load type is set before
+        invoking checkNewWindowPolicy which is not the right assumption.
+
+        Test: fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadURL):
+        (WebCore::FrameLoader::load):
+        (WebCore::FrameLoader::loadPostRequest):
+
 2019-02-16  Darin Adler  <[email protected]>
 
         Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc.

Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/loader/FrameLoader.cpp (241807 => 241808)


--- releases/WebKitGTK/webkit-2.24/Source/WebCore/loader/FrameLoader.cpp	2019-02-20 12:45:02 UTC (rev 241807)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/loader/FrameLoader.cpp	2019-02-20 12:45:08 UTC (rev 241808)
@@ -1381,8 +1381,6 @@
 
     if (!targetFrame && !effectiveFrameName.isEmpty()) {
         action = "" frameLoadRequest));
-        policyChecker().setLoadType(newLoadType);
-        RELEASE_ASSERT(!isBackForwardLoadType(policyChecker().loadType()));
         policyChecker().checkNewWindowPolicy(WTFMove(action), WTFMove(request), WTFMove(formState), effectiveFrameName, [this, allowNavigationToInvalidURL, openerPolicy, completionHandler = completionHandlerCaller.release()] (const ResourceRequest& request, WeakPtr<FormState>&& formState, const String& frameName, const NavigationAction& action, ShouldContinue shouldContinue) mutable {
             continueLoadAfterNewWindowPolicy(request, formState.get(), frameName, action, shouldContinue, allowNavigationToInvalidURL, openerPolicy);
             completionHandler();
@@ -1467,7 +1465,6 @@
 
     if (request.shouldCheckNewWindowPolicy()) {
         NavigationAction action { request.requester(), request.resourceRequest(), InitiatedByMainFrame::Unknown, NavigationType::Other, request.shouldOpenExternalURLsPolicy() };
-        RELEASE_ASSERT(!isBackForwardLoadType(policyChecker().loadType()));
         policyChecker().checkNewWindowPolicy(WTFMove(action), WTFMove(request.resourceRequest()), { }, request.frameName(), [this] (const ResourceRequest& request, WeakPtr<FormState>&& formState, const String& frameName, const NavigationAction& action, ShouldContinue shouldContinue) {
             continueLoadAfterNewWindowPolicy(request, formState.get(), frameName, action, shouldContinue, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress);
         });
@@ -3022,7 +3019,6 @@
             return;
         }
 
-        RELEASE_ASSERT(!isBackForwardLoadType(policyChecker().loadType()));
         policyChecker().checkNewWindowPolicy(WTFMove(action), WTFMove(workingResourceRequest), WTFMove(formState), frameName, [this, allowNavigationToInvalidURL, openerPolicy, completionHandler = WTFMove(completionHandler)] (const ResourceRequest& request, WeakPtr<FormState>&& formState, const String& frameName, const NavigationAction& action, ShouldContinue shouldContinue) mutable {
             continueLoadAfterNewWindowPolicy(request, formState.get(), frameName, action, shouldContinue, allowNavigationToInvalidURL, openerPolicy);
             completionHandler();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to