Changeset 292129 in webkit


Ignore:
Timestamp:
Mar 30, 2022, 4:44:00 PM (3 years ago)
Author:
Alan Coon
Message:

Cherry-pick r290371. rdar://problem/88652375

Call WKNavigationDelegate.didFailProvisionalNavigation even after a cross-origin navigation with COOP
https://bugs.webkit.org/show_bug.cgi?id=237071
<rdar://88652375>

Patch by Alex Christensen <achristensen@webkit.org> on 2022-02-23
Reviewed by Chris Dumez.

Source/WebKit:

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):

Tools:

  • TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm: (TEST):

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

Location:
branches/safari-613-branch
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-613-branch/Source/WebKit/ChangeLog

    r292093 r292129  
     12022-03-29  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r290371. rdar://problem/88652375
     4
     5    Call WKNavigationDelegate.didFailProvisionalNavigation even after a cross-origin navigation with COOP
     6    https://bugs.webkit.org/show_bug.cgi?id=237071
     7    <rdar://88652375>
     8   
     9    Patch by Alex Christensen <achristensen@webkit.org> on 2022-02-23
     10    Reviewed by Chris Dumez.
     11   
     12    Source/WebKit:
     13   
     14    There was an assumption that this callback wasn't needed in this case, but it is.
     15    Covered by an API test that verifies the callback is received.
     16   
     17    * UIProcess/ProvisionalPageProxy.cpp:
     18    (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
     19   
     20    Tools:
     21   
     22    * TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm:
     23    (TEST):
     24   
     25    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290371 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     26
     27    2022-02-23  Alex Christensen  <achristensen@webkit.org>
     28
     29            Call WKNavigationDelegate.didFailProvisionalNavigation even after a cross-origin navigation with COOP
     30            https://bugs.webkit.org/show_bug.cgi?id=237071
     31            <rdar://88652375>
     32
     33            Reviewed by Chris Dumez.
     34
     35            There was an assumption that this callback wasn't needed in this case, but it is.
     36            Covered by an API test that verifies the callback is received.
     37
     38            * UIProcess/ProvisionalPageProxy.cpp:
     39            (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
     40
    1412022-03-29  Alan Coon  <alancoon@apple.com>
    242
  • branches/safari-613-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp

    r289309 r292129  
    298298    m_provisionalLoadURL = { };
    299299
    300     if (m_isProcessSwappingOnNavigationResponse) {
    301         // If the provisional load fails and we were process-swapping on navigation response, then we simply destroy ourselves.
    302         // In this case, the provisional load is still ongoing in the committed process and the ProvisionalPageProxy destructor
    303         // will stop it and cause the committed process to send its own DidFailProvisionalLoadForFrame IPC.
    304         ASSERT(m_page.provisionalPageProxy() == this);
    305         m_page.destroyProvisionalPage();
    306         return;
    307     }
    308 
    309300    // Make sure the Page's main frame's expectedURL gets cleared since we updated it in didStartProvisionalLoad.
    310301    if (auto* pageMainFrame = m_page.mainFrame())
  • branches/safari-613-branch/Tools/ChangeLog

    r292093 r292129  
     12022-03-29  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r290371. rdar://problem/88652375
     4
     5    Call WKNavigationDelegate.didFailProvisionalNavigation even after a cross-origin navigation with COOP
     6    https://bugs.webkit.org/show_bug.cgi?id=237071
     7    <rdar://88652375>
     8   
     9    Patch by Alex Christensen <achristensen@webkit.org> on 2022-02-23
     10    Reviewed by Chris Dumez.
     11   
     12    Source/WebKit:
     13   
     14    There was an assumption that this callback wasn't needed in this case, but it is.
     15    Covered by an API test that verifies the callback is received.
     16   
     17    * UIProcess/ProvisionalPageProxy.cpp:
     18    (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
     19   
     20    Tools:
     21   
     22    * TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm:
     23    (TEST):
     24   
     25    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290371 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     26
     27    2022-02-23  Alex Christensen  <achristensen@webkit.org>
     28
     29            Call WKNavigationDelegate.didFailProvisionalNavigation even after a cross-origin navigation with COOP
     30            https://bugs.webkit.org/show_bug.cgi?id=237071
     31            <rdar://88652375>
     32
     33            Reviewed by Chris Dumez.
     34
     35            * TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm:
     36            (TEST):
     37
    1382022-03-29  Alan Coon  <alancoon@apple.com>
    239
  • branches/safari-613-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm

    r285547 r292129  
    3939#import <WebKit/WKWebView.h>
    4040#import <WebKit/WKWebViewConfigurationPrivate.h>
     41#import <WebKit/WKWebsiteDataStorePrivate.h>
     42#import <WebKit/_WKWebsiteDataStoreConfiguration.h>
    4143#import <wtf/RetainPtr.h>
    4244#import <wtf/Vector.h>
     
    10111013    EXPECT_FALSE(didTryToLoadRadarURL);
    10121014}
     1015
     1016TEST(WKNavigation, CrossOriginCOOPCancelResponseFailProvisionalNavigationCallback)
     1017{
     1018    using namespace TestWebKitAPI;
     1019    HTTPServer server({
     1020        { "/path1", { "hi" } },
     1021        { "/path2", { "hi" } },
     1022        { "/path3", { { { "Cross-Origin-Opener-Policy", "same-origin" } }, "hi" } }
     1023    }, HTTPServer::Protocol::HttpsProxy);
     1024
     1025    auto storeConfiguration = adoptNS([[_WKWebsiteDataStoreConfiguration alloc] initNonPersistentConfiguration]);
     1026    [storeConfiguration setProxyConfiguration:@{
     1027        (NSString *)kCFStreamPropertyHTTPSProxyHost: @"127.0.0.1",
     1028        (NSString *)kCFStreamPropertyHTTPSProxyPort: @(server.port())
     1029    }];
     1030    auto dataStore = adoptNS([[WKWebsiteDataStore alloc] _initWithConfiguration:storeConfiguration.get()]);
     1031    auto configuration = adoptNS([WKWebViewConfiguration new]);
     1032    [configuration setWebsiteDataStore:dataStore.get()];
     1033    auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]);
     1034
     1035    __block Vector<bool> finishedSuccessfullyCallbacks;
     1036    auto loadWithResponsePolicy = ^(WKWebView *webView, NSString *url, WKNavigationResponsePolicy responsePolicy) {
     1037        auto callbacksSizeBefore = finishedSuccessfullyCallbacks.size();
     1038
     1039        auto delegate = adoptNS([TestNavigationDelegate new]);
     1040        delegate.get().decidePolicyForNavigationResponse = ^(WKNavigationResponse *response, void (^decisionHandler)(WKNavigationResponsePolicy)) {
     1041            decisionHandler(responsePolicy);
     1042        };
     1043
     1044        delegate.get().didReceiveAuthenticationChallenge = ^(WKWebView *, NSURLAuthenticationChallenge *challenge, void (^completionHandler)(NSURLSessionAuthChallengeDisposition, NSURLCredential *)) {
     1045            completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
     1046        };
     1047        delegate.get().didFailProvisionalNavigation = ^(WKWebView *, WKNavigation *, NSError *) {
     1048            finishedSuccessfullyCallbacks.append(false);
     1049        };
     1050        delegate.get().didFinishNavigation = ^(WKWebView *, WKNavigation *) {
     1051            finishedSuccessfullyCallbacks.append(true);
     1052        };
     1053        [webView setNavigationDelegate:delegate.get()];
     1054        [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
     1055        while (finishedSuccessfullyCallbacks.size() == callbacksSizeBefore)
     1056            TestWebKitAPI::Util::spinRunLoop(10);
     1057    };
     1058
     1059    loadWithResponsePolicy(webView.get(), @"https://webkit.org/path1", WKNavigationResponsePolicyAllow);
     1060    loadWithResponsePolicy(webView.get(), @"https://webkit.org/path2", WKNavigationResponsePolicyCancel);
     1061    loadWithResponsePolicy(webView.get(), @"https://example.com/path3", WKNavigationResponsePolicyCancel);
     1062
     1063    Vector<bool> expectedCallbacks { true, false, false };
     1064    EXPECT_EQ(finishedSuccessfullyCallbacks, expectedCallbacks);
     1065}
Note: See TracChangeset for help on using the changeset viewer.