Modified: trunk/Source/WebKit/ChangeLog (290370 => 290371)
--- trunk/Source/WebKit/ChangeLog 2022-02-23 14:59:57 UTC (rev 290370)
+++ trunk/Source/WebKit/ChangeLog 2022-02-23 15:20:31 UTC (rev 290371)
@@ -1,3 +1,17 @@
+2022-02-23 Alex Christensen <achristen...@webkit.org>
+
+ Call WKNavigationDelegate.didFailProvisionalNavigation even after a cross-origin navigation with COOP
+ https://bugs.webkit.org/show_bug.cgi?id=237071
+ <rdar://88652375>
+
+ Reviewed by Chris Dumez.
+
+ There was an assumption that this callback wasn't needed in this case, but it is.
+ Covered by an API test that verifies the callback is received.
+
+ * UIProcess/ProvisionalPageProxy.cpp:
+ (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
+
2022-02-23 Zan Dobersek <zdober...@igalia.com>
[GLib] Add missing WebPage.h inclusion in WebProcessGLib.cpp
Modified: trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp (290370 => 290371)
--- trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2022-02-23 14:59:57 UTC (rev 290370)
+++ trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2022-02-23 15:20:31 UTC (rev 290371)
@@ -297,15 +297,6 @@
ASSERT(!m_provisionalLoadURL.isNull());
m_provisionalLoadURL = { };
- if (m_isProcessSwappingOnNavigationResponse) {
- // If the provisional load fails and we were process-swapping on navigation response, then we simply destroy ourselves.
- // In this case, the provisional load is still ongoing in the committed process and the ProvisionalPageProxy destructor
- // will stop it and cause the committed process to send its own DidFailProvisionalLoadForFrame IPC.
- ASSERT(m_page.provisionalPageProxy() == this);
- m_page.destroyProvisionalPage();
- return;
- }
-
// Make sure the Page's main frame's expectedURL gets cleared since we updated it in didStartProvisionalLoad.
if (auto* pageMainFrame = m_page.mainFrame())
pageMainFrame->didFailProvisionalLoad();
Modified: trunk/Tools/ChangeLog (290370 => 290371)
--- trunk/Tools/ChangeLog 2022-02-23 14:59:57 UTC (rev 290370)
+++ trunk/Tools/ChangeLog 2022-02-23 15:20:31 UTC (rev 290371)
@@ -1,3 +1,14 @@
+2022-02-23 Alex Christensen <achristen...@webkit.org>
+
+ Call WKNavigationDelegate.didFailProvisionalNavigation even after a cross-origin navigation with COOP
+ https://bugs.webkit.org/show_bug.cgi?id=237071
+ <rdar://88652375>
+
+ Reviewed by Chris Dumez.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm:
+ (TEST):
+
2022-02-23 Angelos Oikonomopoulos <ange...@igalia.com>
[JSC] Set ssh keepalive in run-jsc-stress-tests
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm (290370 => 290371)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm 2022-02-23 14:59:57 UTC (rev 290370)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm 2022-02-23 15:20:31 UTC (rev 290371)
@@ -38,6 +38,8 @@
#import <WebKit/WKNavigationPrivate.h>
#import <WebKit/WKWebView.h>
#import <WebKit/WKWebViewConfigurationPrivate.h>
+#import <WebKit/WKWebsiteDataStorePrivate.h>
+#import <WebKit/_WKWebsiteDataStoreConfiguration.h>
#import <wtf/RetainPtr.h>
#import <wtf/Vector.h>
@@ -1010,3 +1012,54 @@
EXPECT_FALSE(didTryToLoadRadarURL);
}
+
+TEST(WKNavigation, CrossOriginCOOPCancelResponseFailProvisionalNavigationCallback)
+{
+ using namespace TestWebKitAPI;
+ HTTPServer server({
+ { "/path1", { "hi" } },
+ { "/path2", { "hi" } },
+ { "/path3", { { { "Cross-Origin-Opener-Policy", "same-origin" } }, "hi" } }
+ }, HTTPServer::Protocol::HttpsProxy);
+
+ auto storeConfiguration = adoptNS([[_WKWebsiteDataStoreConfiguration alloc] initNonPersistentConfiguration]);
+ [storeConfiguration setProxyConfiguration:@{
+ (NSString *)kCFStreamPropertyHTTPSProxyHost: @"127.0.0.1",
+ (NSString *)kCFStreamPropertyHTTPSProxyPort: @(server.port())
+ }];
+ auto dataStore = adoptNS([[WKWebsiteDataStore alloc] _initWithConfiguration:storeConfiguration.get()]);
+ auto configuration = adoptNS([WKWebViewConfiguration new]);
+ [configuration setWebsiteDataStore:dataStore.get()];
+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]);
+
+ __block Vector<bool> finishedSuccessfullyCallbacks;
+ auto loadWithResponsePolicy = ^(WKWebView *webView, NSString *url, WKNavigationResponsePolicy responsePolicy) {
+ auto callbacksSizeBefore = finishedSuccessfullyCallbacks.size();
+
+ auto delegate = adoptNS([TestNavigationDelegate new]);
+ delegate.get().decidePolicyForNavigationResponse = ^(WKNavigationResponse *response, void (^decisionHandler)(WKNavigationResponsePolicy)) {
+ decisionHandler(responsePolicy);
+ };
+
+ delegate.get().didReceiveAuthenticationChallenge = ^(WKWebView *, NSURLAuthenticationChallenge *challenge, void (^completionHandler)(NSURLSessionAuthChallengeDisposition, NSURLCredential *)) {
+ completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
+ };
+ delegate.get().didFailProvisionalNavigation = ^(WKWebView *, WKNavigation *, NSError *) {
+ finishedSuccessfullyCallbacks.append(false);
+ };
+ delegate.get().didFinishNavigation = ^(WKWebView *, WKNavigation *) {
+ finishedSuccessfullyCallbacks.append(true);
+ };
+ [webView setNavigationDelegate:delegate.get()];
+ [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+ while (finishedSuccessfullyCallbacks.size() == callbacksSizeBefore)
+ TestWebKitAPI::Util::spinRunLoop(10);
+ };
+
+ loadWithResponsePolicy(webView.get(), @"https://webkit.org/path1", WKNavigationResponsePolicyAllow);
+ loadWithResponsePolicy(webView.get(), @"https://webkit.org/path2", WKNavigationResponsePolicyCancel);
+ loadWithResponsePolicy(webView.get(), @"https://example.com/path3", WKNavigationResponsePolicyCancel);
+
+ Vector<bool> expectedCallbacks { true, false, false };
+ EXPECT_EQ(finishedSuccessfullyCallbacks, expectedCallbacks);
+}