Title: [239730] branches/safari-607-branch
Revision
239730
Author
[email protected]
Date
2019-01-08 10:20:06 -0800 (Tue, 08 Jan 2019)

Log Message

Cherry-pick r239726. rdar://problem/47097726

    Regression(PSON-r239182): Blank view when navigating back and forth between google.com and stack overflow
    https://bugs.webkit.org/show_bug.cgi?id=193224
    <rdar://problem/47097726>

    Reviewed by Alex Christensen.

    Source/WebCore:

    Since r239182, pages get suspended in-place when we suspend the old process after a process-swap on navigation.
    When we return to a suspended page, we load the current history item again and it normally properly restores
    the page from PageCache, even though we load the same history item and the current one and even though the
    page is suspended in-place (i.e. we did not navigate away, which is the usual case for page cache).

    The issue is that if the page URL contains a fragment, FrameLoader::shouldPerformFragmentNavigation() would
    return true because both the source and destination URLs (which are the same) contains a fragment. To address
    the issue, update FrameLoader::shouldPerformFragmentNavigation() to return false if the current page is
    suspended.

    * loader/FrameLoader.cpp:
    (WebCore::FrameLoader::shouldPerformFragmentNavigation):

    Tools:

    Add API test coverage.

    * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (239729 => 239730)


--- branches/safari-607-branch/Source/WebCore/ChangeLog	2019-01-08 18:14:16 UTC (rev 239729)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog	2019-01-08 18:20:06 UTC (rev 239730)
@@ -1,3 +1,57 @@
+2019-01-08  Alan Coon  <[email protected]>
+
+        Cherry-pick r239726. rdar://problem/47097726
+
+    Regression(PSON-r239182): Blank view when navigating back and forth between google.com and stack overflow
+    https://bugs.webkit.org/show_bug.cgi?id=193224
+    <rdar://problem/47097726>
+    
+    Reviewed by Alex Christensen.
+    
+    Source/WebCore:
+    
+    Since r239182, pages get suspended in-place when we suspend the old process after a process-swap on navigation.
+    When we return to a suspended page, we load the current history item again and it normally properly restores
+    the page from PageCache, even though we load the same history item and the current one and even though the
+    page is suspended in-place (i.e. we did not navigate away, which is the usual case for page cache).
+    
+    The issue is that if the page URL contains a fragment, FrameLoader::shouldPerformFragmentNavigation() would
+    return true because both the source and destination URLs (which are the same) contains a fragment. To address
+    the issue, update FrameLoader::shouldPerformFragmentNavigation() to return false if the current page is
+    suspended.
+    
+    * loader/FrameLoader.cpp:
+    (WebCore::FrameLoader::shouldPerformFragmentNavigation):
+    
+    Tools:
+    
+    Add API test coverage.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239726 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-08  Chris Dumez  <[email protected]>
+
+            Regression(PSON-r239182): Blank view when navigating back and forth between google.com and stack overflow
+            https://bugs.webkit.org/show_bug.cgi?id=193224
+            <rdar://problem/47097726>
+
+            Reviewed by Alex Christensen.
+
+            Since r239182, pages get suspended in-place when we suspend the old process after a process-swap on navigation.
+            When we return to a suspended page, we load the current history item again and it normally properly restores
+            the page from PageCache, even though we load the same history item and the current one and even though the
+            page is suspended in-place (i.e. we did not navigate away, which is the usual case for page cache).
+
+            The issue is that if the page URL contains a fragment, FrameLoader::shouldPerformFragmentNavigation() would
+            return true because both the source and destination URLs (which are the same) contains a fragment. To address
+            the issue, update FrameLoader::shouldPerformFragmentNavigation() to return false if the current page is
+            suspended.
+
+            * loader/FrameLoader.cpp:
+            (WebCore::FrameLoader::shouldPerformFragmentNavigation):
+
 2019-01-07  Zalan Bujtas  <[email protected]>
 
         [LFC][BFC] Margin collapsing should not be limited to in-flow non-replaced boxes.

Modified: branches/safari-607-branch/Source/WebCore/loader/FrameLoader.cpp (239729 => 239730)


--- branches/safari-607-branch/Source/WebCore/loader/FrameLoader.cpp	2019-01-08 18:14:16 UTC (rev 239729)
+++ branches/safari-607-branch/Source/WebCore/loader/FrameLoader.cpp	2019-01-08 18:20:06 UTC (rev 239730)
@@ -3134,6 +3134,7 @@
     return (!isFormSubmission || equalLettersIgnoringASCIICase(httpMethod, "get"))
         && !isReload(loadType)
         && loadType != FrameLoadType::Same
+        && m_frame.document()->pageCacheState() != Document::InPageCache
         && !shouldReload(m_frame.document()->url(), url)
         // We don't want to just scroll if a link from within a
         // frameset is trying to reload the frameset into _top.

Modified: branches/safari-607-branch/Tools/ChangeLog (239729 => 239730)


--- branches/safari-607-branch/Tools/ChangeLog	2019-01-08 18:14:16 UTC (rev 239729)
+++ branches/safari-607-branch/Tools/ChangeLog	2019-01-08 18:20:06 UTC (rev 239730)
@@ -1,3 +1,48 @@
+2019-01-08  Alan Coon  <[email protected]>
+
+        Cherry-pick r239726. rdar://problem/47097726
+
+    Regression(PSON-r239182): Blank view when navigating back and forth between google.com and stack overflow
+    https://bugs.webkit.org/show_bug.cgi?id=193224
+    <rdar://problem/47097726>
+    
+    Reviewed by Alex Christensen.
+    
+    Source/WebCore:
+    
+    Since r239182, pages get suspended in-place when we suspend the old process after a process-swap on navigation.
+    When we return to a suspended page, we load the current history item again and it normally properly restores
+    the page from PageCache, even though we load the same history item and the current one and even though the
+    page is suspended in-place (i.e. we did not navigate away, which is the usual case for page cache).
+    
+    The issue is that if the page URL contains a fragment, FrameLoader::shouldPerformFragmentNavigation() would
+    return true because both the source and destination URLs (which are the same) contains a fragment. To address
+    the issue, update FrameLoader::shouldPerformFragmentNavigation() to return false if the current page is
+    suspended.
+    
+    * loader/FrameLoader.cpp:
+    (WebCore::FrameLoader::shouldPerformFragmentNavigation):
+    
+    Tools:
+    
+    Add API test coverage.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239726 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-08  Chris Dumez  <[email protected]>
+
+            Regression(PSON-r239182): Blank view when navigating back and forth between google.com and stack overflow
+            https://bugs.webkit.org/show_bug.cgi?id=193224
+            <rdar://problem/47097726>
+
+            Reviewed by Alex Christensen.
+
+            Add API test coverage.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+
 2019-01-06  Fujii Hironori  <[email protected]>
 
         [Win][Clang] Fix compilation warnings of MiniBrowser

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


--- branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-01-08 18:14:16 UTC (rev 239729)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-01-08 18:20:06 UTC (rev 239730)
@@ -685,6 +685,63 @@
         EXPECT_EQ(5u, seenPIDs.size());
 }
 
+static const char* pageWithFragmentTestBytes = R"PSONRESOURCE(
+<div id="foo">TEST</div>
+)PSONRESOURCE";
+
+TEST(ProcessSwap, HistoryNavigationToFragmentURL)
+{
+    auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
+    processPoolConfiguration.get().processSwapsOnNavigation = 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]);
+    [handler addMappingFromURLString:@"pson://www.apple.com/main.html#foo" toData:pageWithFragmentTestBytes];
+    [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/main.html"]];
+    [webView loadRequest:request];
+
+    TestWebKitAPI::Util::run(&done);
+    done = false;
+
+    auto webkitPID = [webView _webProcessIdentifier];
+
+    request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/main.html#foo"]];
+    [webView loadRequest:request];
+
+    TestWebKitAPI::Util::run(&done);
+    done = false;
+
+    auto applePID = [webView _webProcessIdentifier];
+
+    [webView goBack];
+    TestWebKitAPI::Util::run(&done);
+    done = false;
+
+    EXPECT_EQ(webkitPID, [webView _webProcessIdentifier]);
+
+    [webView goForward];
+    TestWebKitAPI::Util::run(&done);
+    done = false;
+
+    EXPECT_EQ(applePID, [webView _webProcessIdentifier]);
+
+    bool finishedRunningScript = false;
+    [webView evaluateJavaScript:@"document.getElementById('foo').innerText" completionHandler: [&] (id result, NSError *error) {
+        NSString *innerText = (NSString *)result;
+        EXPECT_WK_STREQ(@"TEST", innerText);
+        finishedRunningScript = true;
+    }];
+    TestWebKitAPI::Util::run(&finishedRunningScript);
+}
+
 TEST(ProcessSwap, SuspendedPageDiesAfterBackForwardListItemIsGone)
 {
     auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to