Title: [240568] branches/safari-607-branch
Revision
240568
Author
[email protected]
Date
2019-01-28 01:41:00 -0800 (Mon, 28 Jan 2019)

Log Message

Cherry-pick r240485. rdar://problem/47586895

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

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

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebKit/ChangeLog (240567 => 240568)


--- branches/safari-607-branch/Source/WebKit/ChangeLog	2019-01-28 09:40:57 UTC (rev 240567)
+++ branches/safari-607-branch/Source/WebKit/ChangeLog	2019-01-28 09:41:00 UTC (rev 240568)
@@ -1,5 +1,51 @@
 2019-01-28  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r240485. rdar://problem/47586895
+
+    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:]):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-25  Chris Dumez  <[email protected]>
+
+            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.
+
+            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):
+
+2019-01-28  Babak Shafiei  <[email protected]>
+
         Cherry-pick r240477. rdar://problem/47586845
 
     Regression(PSON?) Crash under NavigationState::NavigationClient::decidePolicyForNavigationAction()

Modified: branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (240567 => 240568)


--- branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-01-28 09:40:57 UTC (rev 240567)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-01-28 09:41:00 UTC (rev 240568)
@@ -3773,6 +3773,12 @@
     MESSAGE_CHECK(process, frame);
     MESSAGE_CHECK_URL(process, url);
 
+    // If the page starts a new main frame provisional load, then cancel any pending one in a provisional process.
+    if (frame->isMainFrame() && m_provisionalPage && m_provisionalPage->mainFrame() != frame) {
+        m_provisionalPage->cancel();
+        m_provisionalPage = nullptr;
+    }
+
     // FIXME: We should message check that navigationID is not zero here, but it's currently zero for some navigations through the page cache.
     RefPtr<API::Navigation> navigation;
     if (frame->isMainFrame() && navigationID)

Modified: branches/safari-607-branch/Tools/ChangeLog (240567 => 240568)


--- branches/safari-607-branch/Tools/ChangeLog	2019-01-28 09:40:57 UTC (rev 240567)
+++ branches/safari-607-branch/Tools/ChangeLog	2019-01-28 09:41:00 UTC (rev 240568)
@@ -1,5 +1,48 @@
 2019-01-28  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r240485. rdar://problem/47586895
+
+    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:]):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-25  Chris Dumez  <[email protected]>
+
+            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.
+
+            Add API test coverage.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+            (-[PSONNavigationDelegate webView:didStartProvisionalNavigation:]):
+
+2019-01-28  Babak Shafiei  <[email protected]>
+
         Cherry-pick r240477. rdar://problem/47586845
 
     Regression(PSON?) Crash under NavigationState::NavigationClient::decidePolicyForNavigationAction()

Modified: branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (240567 => 240568)


--- branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-01-28 09:40:57 UTC (rev 240567)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-01-28 09:41:00 UTC (rev 240568)
@@ -61,6 +61,7 @@
 @end
 
 static bool done;
+static bool didStartProvisionalLoad;
 static bool failed;
 static bool didCreateWebView;
 static int numberOfDecidePolicyCalls;
@@ -119,6 +120,11 @@
     done = true;
 }
 
+- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(null_unspecified WKNavigation *)navigation
+{
+    didStartProvisionalLoad = true;
+}
+
 - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
 {
     ++numberOfDecidePolicyCalls;
@@ -2258,6 +2264,46 @@
     EXPECT_EQ(1u, seenPIDs.size());
 }
 
+TEST(ProcessSwap, DoSameSiteNavigationAfterCrossSiteProvisionalLoadStarted)
+{
+    auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
+    [processPoolConfiguration setProcessSwapsOnNavigation:YES];
+    auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
+
+    auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    [webViewConfiguration setProcessPool:processPool.get()];
+    auto handler = adoptNS([[PSONScheme alloc] init]);
+    [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];
+
+    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
+    auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
+    [webView setNavigationDelegate:delegate.get()];
+
+    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main1.html"]];
+    [webView loadRequest:request];
+
+    TestWebKitAPI::Util::run(&done);
+    done = false;
+
+    auto webkitPID = [webView _webProcessIdentifier];
+
+    didStartProvisionalLoad = false;
+    request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/main.html"]];
+    [webView loadRequest:request];
+
+    TestWebKitAPI::Util::run(&didStartProvisionalLoad);
+    didStartProvisionalLoad = false;
+
+    request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main2.html"]];
+    [webView loadRequest:request];
+
+    TestWebKitAPI::Util::run(&done);
+    done = false;
+
+    EXPECT_WK_STREQ(@"pson://www.webkit.org/main2.html", [[webView URL] absoluteString]);
+    EXPECT_EQ(webkitPID, [webView _webProcessIdentifier]);
+}
+
 TEST(ProcessSwap, SuspendedPageLimit)
 {
     auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to