Title: [270977] branches/safari-611.1.9-branch
Revision
270977
Author
[email protected]
Date
2020-12-18 11:02:29 -0800 (Fri, 18 Dec 2020)

Log Message

Cherry-pick r270962. rdar://problem/72472070

    REGRESSION(r270638) decidePolicyForNewWindowAction should have non-null request
    https://bugs.webkit.org/show_bug.cgi?id=220001
    Source/WebKit:

    <rdar://72436824>

    Reviewed by Tim Horton.

    A ResourceRequest was used after being moved in the super old C SPI that we need to remove,
    but to keep our client functioning correctly until they do we copy the ResourceRequest instead of moving it.
    Covered by an API test.

    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::decidePolicyForNewWindowAction):

    Tools:

    Reviewed by Tim Horton.

    * TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm:
    (TEST):

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

Modified Paths

Diff

Modified: branches/safari-611.1.9-branch/Source/WebKit/ChangeLog (270976 => 270977)


--- branches/safari-611.1.9-branch/Source/WebKit/ChangeLog	2020-12-18 18:30:56 UTC (rev 270976)
+++ branches/safari-611.1.9-branch/Source/WebKit/ChangeLog	2020-12-18 19:02:29 UTC (rev 270977)
@@ -1,3 +1,49 @@
+2020-12-18  Alan Coon  <[email protected]>
+
+        Cherry-pick r270962. rdar://problem/72472070
+
+    REGRESSION(r270638) decidePolicyForNewWindowAction should have non-null request
+    https://bugs.webkit.org/show_bug.cgi?id=220001
+    Source/WebKit:
+    
+    <rdar://72436824>
+    
+    Reviewed by Tim Horton.
+    
+    A ResourceRequest was used after being moved in the super old C SPI that we need to remove,
+    but to keep our client functioning correctly until they do we copy the ResourceRequest instead of moving it.
+    Covered by an API test.
+    
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
+    
+    Tools:
+    
+    
+    Reviewed by Tim Horton.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm:
+    (TEST):
+    
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270962 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-12-17  Alex Christensen  <[email protected]>
+
+            REGRESSION(r270638) decidePolicyForNewWindowAction should have non-null request
+            https://bugs.webkit.org/show_bug.cgi?id=220001
+            <rdar://72436824>
+
+            Reviewed by Tim Horton.
+
+            A ResourceRequest was used after being moved in the super old C SPI that we need to remove,
+            but to keep our client functioning correctly until they do we copy the ResourceRequest instead of moving it.
+            Covered by an API test.
+
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
+
 2020-12-16  Alan Coon  <[email protected]>
 
         Cherry-pick r270900. rdar://problem/72396877

Modified: branches/safari-611.1.9-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (270976 => 270977)


--- branches/safari-611.1.9-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-12-18 18:30:56 UTC (rev 270976)
+++ branches/safari-611.1.9-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-12-18 19:02:29 UTC (rev 270977)
@@ -5355,7 +5355,7 @@
 
     auto userInitiatedActivity = m_process->userInitiatedActivity(navigationActionData.userGestureTokenIdentifier);
     bool shouldOpenAppLinks = m_mainFrame && m_mainFrame->url().host() != request.url().host();
-    auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.get(), nullptr, frameName, WTFMove(request), URL { }, shouldOpenAppLinks, WTFMove(userInitiatedActivity));
+    auto navigationAction = API::NavigationAction::create(WTFMove(navigationActionData), sourceFrameInfo.get(), nullptr, frameName, ResourceRequest(request), URL { }, shouldOpenAppLinks, WTFMove(userInitiatedActivity));
     
     auto listener = makeRef(frame->setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), identifier, listenerID, frameID, navigationAction] (PolicyAction policyAction, API::WebsitePolicies*, ProcessSwapRequestedByClient processSwapRequestedByClient, RefPtr<SafeBrowsingWarning>&& safeBrowsingWarning, Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain) mutable {
         // FIXME: Assert the API::WebsitePolicies* is nullptr here once clients of WKFramePolicyListenerUseWithPolicies go away.

Modified: branches/safari-611.1.9-branch/Tools/ChangeLog (270976 => 270977)


--- branches/safari-611.1.9-branch/Tools/ChangeLog	2020-12-18 18:30:56 UTC (rev 270976)
+++ branches/safari-611.1.9-branch/Tools/ChangeLog	2020-12-18 19:02:29 UTC (rev 270977)
@@ -1,3 +1,44 @@
+2020-12-18  Alan Coon  <[email protected]>
+
+        Cherry-pick r270962. rdar://problem/72472070
+
+    REGRESSION(r270638) decidePolicyForNewWindowAction should have non-null request
+    https://bugs.webkit.org/show_bug.cgi?id=220001
+    Source/WebKit:
+    
+    <rdar://72436824>
+    
+    Reviewed by Tim Horton.
+    
+    A ResourceRequest was used after being moved in the super old C SPI that we need to remove,
+    but to keep our client functioning correctly until they do we copy the ResourceRequest instead of moving it.
+    Covered by an API test.
+    
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
+    
+    Tools:
+    
+    
+    Reviewed by Tim Horton.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm:
+    (TEST):
+    
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270962 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-12-17  Alex Christensen  <[email protected]>
+
+            REGRESSION(r270638) decidePolicyForNewWindowAction should have non-null request
+            https://bugs.webkit.org/show_bug.cgi?id=220001
+
+            Reviewed by Tim Horton.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm:
+            (TEST):
+
 2020-12-14  Russell Epstein  <[email protected]>
 
         Cherry-pick r270758. rdar://problem/72303521

Modified: branches/safari-611.1.9-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm (270976 => 270977)


--- branches/safari-611.1.9-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm	2020-12-18 18:30:56 UTC (rev 270976)
+++ branches/safari-611.1.9-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm	2020-12-18 19:02:29 UTC (rev 270977)
@@ -28,6 +28,7 @@
 #if PLATFORM(MAC)
 
 #import "PlatformUtilities.h"
+#import "PlatformWebView.h"
 #import "TestProtocol.h"
 #import <WebKit/WKNavigationActionPrivate.h>
 #import <WebKit/WKProcessPoolPrivate.h>
@@ -257,6 +258,29 @@
     action = ""
 }
 
+#if WK_HAVE_C_SPI
+TEST(WebKit, DecidePolicyForNewWindowAction)
+{
+    auto context = adoptWK(WKContextCreateWithConfiguration(nullptr));
+
+    TestWebKitAPI::PlatformWebView webView(context.get());
+
+    WKPagePolicyClientV1 policyClient;
+    memset(&policyClient, 0, sizeof(policyClient));
+    policyClient.base.version = 1;
+    policyClient.decidePolicyForNewWindowAction = [] (WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKStringRef frameName, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo) {
+        EXPECT_TRUE(WKStringIsEqualToUTF8CString(adoptWK(WKURLCopyString(adoptWK(WKURLRequestCopyURL(request)).get())).get(), "https://webkit.org/"));
+        WKFramePolicyListenerIgnore(listener);
+        decidedPolicy = true;
+    };
+    WKPageSetPagePolicyClient(webView.page(), &policyClient.base);
+
+    WKPageLoadHTMLString(webView.page(), adoptWK(WKStringCreateWithUTF8CString("<body _onload_='anchorTag.click()'><a href='' id='anchorTag' target=_blank>link</a></body>")).get(), nullptr);
+
+    TestWebKitAPI::Util::run(&decidedPolicy);
+}
+#endif // WK_HAVE_C_SPI
+
 TEST(WebKit, DecidePolicyForNavigationActionForTargetedHyperlink)
 {
     auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to