Changeset 240485 in webkit


Ignore:
Timestamp:
Jan 25, 2019 10:54:54 AM (5 years ago)
Author:
Chris Dumez
Message:

Regression(PSON) cross-site provisional page is not canceled if a new same-site one is started
https://bugs.webkit.org/show_bug.cgi?id=193788
<rdar://problem/47531231>

Reviewed by Alex Christensen.

Source/WebKit:

When the page starts a new provisional load, make sure we cancel any pending one in the provisional
process, as it would have happened in the first provisional load happened in the same process.
Without this, we could have 2 parallel loads happening, one in the committed process and another
in the provisional one, leading to assertion failures in debug.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):

Tools:

Add API test coverage.

  • TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

(-[PSONNavigationDelegate webView:didStartProvisionalNavigation:]):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r240484 r240485  
     12019-01-25  Chris Dumez  <cdumez@apple.com>
     2
     3        Regression(PSON) cross-site provisional page is not canceled if a new same-site one is started
     4        https://bugs.webkit.org/show_bug.cgi?id=193788
     5        <rdar://problem/47531231>
     6
     7        Reviewed by Alex Christensen.
     8
     9        When the page starts a new provisional load, make sure we cancel any pending one in the provisional
     10        process, as it would have happened in the first provisional load happened in the same process.
     11        Without this, we could have 2 parallel loads happening, one in the committed process and another
     12        in the provisional one, leading to assertion failures in debug.
     13
     14        * UIProcess/WebPageProxy.cpp:
     15        (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
     16
    1172019-01-25  Chris Dumez  <cdumez@apple.com>
    218
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r240484 r240485  
    37763776    MESSAGE_CHECK_URL(process, url);
    37773777
     3778    // If the page starts a new main frame provisional load, then cancel any pending one in a provisional process.
     3779    if (frame->isMainFrame() && m_provisionalPage && m_provisionalPage->mainFrame() != frame) {
     3780        m_provisionalPage->cancel();
     3781        m_provisionalPage = nullptr;
     3782    }
     3783
    37783784    // FIXME: We should message check that navigationID is not zero here, but it's currently zero for some navigations through the page cache.
    37793785    RefPtr<API::Navigation> navigation;
  • trunk/Tools/ChangeLog

    r240483 r240485  
     12019-01-25  Chris Dumez  <cdumez@apple.com>
     2
     3        Regression(PSON) cross-site provisional page is not canceled if a new same-site one is started
     4        https://bugs.webkit.org/show_bug.cgi?id=193788
     5        <rdar://problem/47531231>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Add API test coverage.
     10
     11        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
     12        (-[PSONNavigationDelegate webView:didStartProvisionalNavigation:]):
     13
    1142019-01-25  Jonathan Bedard  <jbedard@apple.com>
    215
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm

    r240477 r240485  
    6262
    6363static bool done;
     64static bool didStartProvisionalLoad;
    6465static bool failed;
    6566static bool didCreateWebView;
     
    120121}
    121122
     123- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(null_unspecified WKNavigation *)navigation
     124{
     125    didStartProvisionalLoad = true;
     126}
     127
    122128- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
    123129{
     
    22572263
    22582264    EXPECT_EQ(1u, seenPIDs.size());
     2265}
     2266
     2267TEST(ProcessSwap, DoSameSiteNavigationAfterCrossSiteProvisionalLoadStarted)
     2268{
     2269    auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
     2270    [processPoolConfiguration setProcessSwapsOnNavigation:YES];
     2271    auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
     2272
     2273    auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
     2274    [webViewConfiguration setProcessPool:processPool.get()];
     2275    auto handler = adoptNS([[PSONScheme alloc] init]);
     2276    [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];
     2277
     2278    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
     2279    auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     2280    [webView setNavigationDelegate:delegate.get()];
     2281
     2282    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main1.html"]];
     2283    [webView loadRequest:request];
     2284
     2285    TestWebKitAPI::Util::run(&done);
     2286    done = false;
     2287
     2288    auto webkitPID = [webView _webProcessIdentifier];
     2289
     2290    didStartProvisionalLoad = false;
     2291    request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/main.html"]];
     2292    [webView loadRequest:request];
     2293
     2294    TestWebKitAPI::Util::run(&didStartProvisionalLoad);
     2295    didStartProvisionalLoad = false;
     2296
     2297    request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main2.html"]];
     2298    [webView loadRequest:request];
     2299
     2300    TestWebKitAPI::Util::run(&done);
     2301    done = false;
     2302
     2303    EXPECT_WK_STREQ(@"pson://www.webkit.org/main2.html", [[webView URL] absoluteString]);
     2304    EXPECT_EQ(webkitPID, [webView _webProcessIdentifier]);
    22592305}
    22602306
Note: See TracChangeset for help on using the changeset viewer.