Title: [186122] trunk/Source/WebKit2
- Revision
- 186122
- Author
- [email protected]
- Date
- 2015-06-30 11:08:19 -0700 (Tue, 30 Jun 2015)
Log Message
[WK2] Avoid taking a useless / blank navigation snapshot when navigating after restoring sessionState
https://bugs.webkit.org/show_bug.cgi?id=146446
<rdar://problem/21584231>
Reviewed by Darin Adler.
We currently take a useless / blank navigation snapshot when navigating
after restoring the back / forward list from a sessionState object.
This is because we get a current HistoryItem from the sessionState
which we have never really navigated to. We then take a navigation
snapshot for the current HistoryItem when navigating away as we usually
do. However, in this case, the HistoryItem was imported and there is
nothing to snapshot.
Taking this snapshot is not only wasteful, it can also potentially
overwrite the snapshot that was set by the client using
WKWebView._saveBackForwardSnapshotForItem() SPI.
To address the problem, this patch suppresses navigation snapshotting
after restoring the back / forward list from a session state and until
the next load is committed.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::recordNavigationSnapshot):
(WebKit::WebPageProxy::restoreFromSessionState):
(WebKit::WebPageProxy::didCommitLoadForFrame):
* UIProcess/WebPageProxy.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (186121 => 186122)
--- trunk/Source/WebKit2/ChangeLog 2015-06-30 17:32:28 UTC (rev 186121)
+++ trunk/Source/WebKit2/ChangeLog 2015-06-30 18:08:19 UTC (rev 186122)
@@ -1,3 +1,33 @@
+2015-06-30 Chris Dumez <[email protected]>
+
+ [WK2] Avoid taking a useless / blank navigation snapshot when navigating after restoring sessionState
+ https://bugs.webkit.org/show_bug.cgi?id=146446
+ <rdar://problem/21584231>
+
+ Reviewed by Darin Adler.
+
+ We currently take a useless / blank navigation snapshot when navigating
+ after restoring the back / forward list from a sessionState object.
+ This is because we get a current HistoryItem from the sessionState
+ which we have never really navigated to. We then take a navigation
+ snapshot for the current HistoryItem when navigating away as we usually
+ do. However, in this case, the HistoryItem was imported and there is
+ nothing to snapshot.
+
+ Taking this snapshot is not only wasteful, it can also potentially
+ overwrite the snapshot that was set by the client using
+ WKWebView._saveBackForwardSnapshotForItem() SPI.
+
+ To address the problem, this patch suppresses navigation snapshotting
+ after restoring the back / forward list from a session state and until
+ the next load is committed.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::recordNavigationSnapshot):
+ (WebKit::WebPageProxy::restoreFromSessionState):
+ (WebKit::WebPageProxy::didCommitLoadForFrame):
+ * UIProcess/WebPageProxy.h:
+
2015-06-29 Anders Carlsson <[email protected]>
Get rid of unused WKSI functions
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (186121 => 186122)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-06-30 17:32:28 UTC (rev 186121)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-06-30 18:08:19 UTC (rev 186122)
@@ -1049,7 +1049,7 @@
void WebPageProxy::recordNavigationSnapshot(WebBackForwardListItem& item)
{
- if (!m_shouldRecordNavigationSnapshots)
+ if (!m_shouldRecordNavigationSnapshots || m_suppressNavigationSnapshotting)
return;
#if PLATFORM(COCOA)
@@ -2143,6 +2143,10 @@
process().registerNewWebBackForwardListItem(entry.get());
process().send(Messages::WebPage::RestoreSession(m_backForwardList->itemStates()), m_pageID);
+
+ // 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_suppressNavigationSnapshotting = true;
}
// FIXME: Navigating should be separate from state restoration.
@@ -2936,9 +2940,10 @@
auto transaction = m_pageLoadState.transaction();
bool markPageInsecure = m_treatsSHA1CertificatesAsInsecure && certificateInfo.containsNonRootSHA1SignedCertificate();
Ref<WebCertificateInfo> webCertificateInfo = WebCertificateInfo::create(certificateInfo);
- if (frame->isMainFrame())
+ if (frame->isMainFrame()) {
m_pageLoadState.didCommitLoad(transaction, webCertificateInfo, markPageInsecure);
- else if (markPageInsecure)
+ m_suppressNavigationSnapshotting = false;
+ } else if (markPageInsecure)
m_pageLoadState.didDisplayOrRunInsecureContent(transaction);
#if USE(APPKIT)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (186121 => 186122)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-06-30 17:32:28 UTC (rev 186121)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-06-30 18:08:19 UTC (rev 186122)
@@ -1733,6 +1733,7 @@
bool m_waitingForDidUpdateViewState;
bool m_shouldScaleViewToFitDocument { false };
+ bool m_suppressNavigationSnapshotting { false };
#if PLATFORM(COCOA)
HashMap<String, String> m_temporaryPDFFiles;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes