- Revision
- 270962
- Author
- [email protected]
- Date
- 2020-12-17 19:24:38 -0800 (Thu, 17 Dec 2020)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (270961 => 270962)
--- trunk/Source/WebKit/ChangeLog 2020-12-18 01:21:42 UTC (rev 270961)
+++ trunk/Source/WebKit/ChangeLog 2020-12-18 03:24:38 UTC (rev 270962)
@@ -1,3 +1,18 @@
+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-17 Chris Dumez <[email protected]>
[GPUProcess] https://www.waveplayer.info/createmediaelementsource-test/ demo is flaky
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (270961 => 270962)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-12-18 01:21:42 UTC (rev 270961)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-12-18 03:24:38 UTC (rev 270962)
@@ -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: trunk/Tools/ChangeLog (270961 => 270962)
--- trunk/Tools/ChangeLog 2020-12-18 01:21:42 UTC (rev 270961)
+++ trunk/Tools/ChangeLog 2020-12-18 03:24:38 UTC (rev 270962)
@@ -1,3 +1,13 @@
+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-17 Jonathan Bedard <[email protected]>
[webkitscmpy] Correct mock `git log` call in standard git repositories
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm (270961 => 270962)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm 2020-12-18 01:21:42 UTC (rev 270961)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DecidePolicyForNavigationAction.mm 2020-12-18 03:24:38 UTC (rev 270962)
@@ -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)]);