Title: [235898] trunk/Source/WebKit
Revision
235898
Author
[email protected]
Date
2018-09-11 10:42:28 -0700 (Tue, 11 Sep 2018)

Log Message

Regression(PSON): "Swipe back" snapshot is missing when navigating back cross-process
https://bugs.webkit.org/show_bug.cgi?id=189482
<rdar://problem/44317222>

Reviewed by Geoffrey Garen.

The issue was that when we swap process on navigation, we:
1. Call processDidTerminate() which calls resetState() and clears the displayed content
2. Reattach the WebPageProxy to a new WebProcess
3. Trigger the navigation
4. Take the navigation snapshot

When the navigation snapshot occurs at step 4, the view is already blank in the case of
process swap. To avoid the issue, we take the navigation snapshot earlier, before calling
processDidTerminate() and we suppress the next navigation snapshot as it would be blank.

At some point, we will likely want to display the previous' WebProcess content longer,
until the new WebProcess has something interesting to display. Once this is implemented,
we'll likely be able to drop the early snapshotting logic.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::recordAutomaticNavigationSnapshot):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
(WebKit::WebPageProxy::restoreFromSessionState):
(WebKit::WebPageProxy::didCommitLoadForFrame):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::suppressNextAutomaticNavigationSnapshot):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (235897 => 235898)


--- trunk/Source/WebKit/ChangeLog	2018-09-11 17:14:07 UTC (rev 235897)
+++ trunk/Source/WebKit/ChangeLog	2018-09-11 17:42:28 UTC (rev 235898)
@@ -1,3 +1,33 @@
+2018-09-11  Chris Dumez  <[email protected]>
+
+        Regression(PSON): "Swipe back" snapshot is missing when navigating back cross-process
+        https://bugs.webkit.org/show_bug.cgi?id=189482
+        <rdar://problem/44317222>
+
+        Reviewed by Geoffrey Garen.
+
+        The issue was that when we swap process on navigation, we:
+        1. Call processDidTerminate() which calls resetState() and clears the displayed content
+        2. Reattach the WebPageProxy to a new WebProcess
+        3. Trigger the navigation
+        4. Take the navigation snapshot
+
+        When the navigation snapshot occurs at step 4, the view is already blank in the case of
+        process swap. To avoid the issue, we take the navigation snapshot earlier, before calling
+        processDidTerminate() and we suppress the next navigation snapshot as it would be blank.
+
+        At some point, we will likely want to display the previous' WebProcess content longer,
+        until the new WebProcess has something interesting to display. Once this is implemented,
+        we'll likely be able to drop the early snapshotting logic.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::recordAutomaticNavigationSnapshot):
+        (WebKit::WebPageProxy::continueNavigationInNewProcess):
+        (WebKit::WebPageProxy::restoreFromSessionState):
+        (WebKit::WebPageProxy::didCommitLoadForFrame):
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::suppressNextAutomaticNavigationSnapshot):
+
 2018-09-11  Woodrow Wang  <[email protected]>
 
         Add Web API Statistics Collection

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (235897 => 235898)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-09-11 17:14:07 UTC (rev 235897)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-09-11 17:42:28 UTC (rev 235898)
@@ -1196,7 +1196,7 @@
 
 void WebPageProxy::recordAutomaticNavigationSnapshot()
 {
-    if (m_suppressAutomaticNavigationSnapshotting)
+    if (m_shouldSuppressNextAutomaticNavigationSnapshot)
         return;
 
     if (WebBackForwardListItem* item = m_backForwardList->currentItem())
@@ -2455,6 +2455,12 @@
 {
     LOG(Loading, "Continuing navigation %" PRIu64 " '%s' in a new web process", navigation.navigationID(), navigation.loggingString());
 
+    // Because we're about to tear down the drawing area and swap to a new process, this is our last opportunity to snapshot what's currently displayed before
+    // we navigate. Do the navigation snapshot now and suppress the next one since the view will be blank then.
+    // FIXME: We should be able to drop this logic if we kept displaying the previous content a while longer when we swap process on navigation.
+    recordAutomaticNavigationSnapshot();
+    suppressNextAutomaticNavigationSnapshot();
+
     Ref<WebProcessProxy> previousProcess = m_process.copyRef();
     std::optional<uint64_t> navigatedFrameIdentifierInPreviousProcess;
     if (m_mainFrame)
@@ -2629,7 +2635,7 @@
 
         // The back / forward list was restored from a sessionState so we don't want to snapshot the current
         // page when navigating away. Suppress navigation snapshotting until the next load has committed
-        m_suppressAutomaticNavigationSnapshotting = true;
+        suppressNextAutomaticNavigationSnapshot();
     }
 
     // FIXME: Navigating should be separate from state restoration.
@@ -3625,7 +3631,7 @@
 
     if (frame->isMainFrame()) {
         m_pageLoadState.didCommitLoad(transaction, webCertificateInfo, markPageInsecure);
-        m_suppressAutomaticNavigationSnapshotting = false;
+        m_shouldSuppressNextAutomaticNavigationSnapshot = false;
     } else if (markPageInsecure)
         m_pageLoadState.didDisplayOrRunInsecureContent(transaction);
 

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (235897 => 235898)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2018-09-11 17:14:07 UTC (rev 235897)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2018-09-11 17:42:28 UTC (rev 235898)
@@ -1145,6 +1145,7 @@
     bool shouldRecordNavigationSnapshots() const { return m_shouldRecordNavigationSnapshots; }
     void setShouldRecordNavigationSnapshots(bool shouldRecordSnapshots) { m_shouldRecordNavigationSnapshots = shouldRecordSnapshots; }
     void recordAutomaticNavigationSnapshot();
+    void suppressNextAutomaticNavigationSnapshot() { m_shouldSuppressNextAutomaticNavigationSnapshot = true; }
     void recordNavigationSnapshot(WebBackForwardListItem&);
     void requestAssistedNodeInformation(Function<void(const AssistedNodeInformation&, CallbackBase::Error)>&&);
 
@@ -2158,7 +2159,7 @@
     bool m_waitingForDidUpdateActivityState { false };
 
     bool m_shouldScaleViewToFitDocument { false };
-    bool m_suppressAutomaticNavigationSnapshotting { false };
+    bool m_shouldSuppressNextAutomaticNavigationSnapshot { false };
 
 #if PLATFORM(COCOA)
     HashMap<String, String> m_temporaryPDFFiles;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to