Title: [170679] trunk/Source/WebKit2
- Revision
- 170679
- Author
- ander...@apple.com
- Date
- 2014-07-01 17:08:13 -0700 (Tue, 01 Jul 2014)
Log Message
WKPageRestoreFromSessionState should use the new session state restore code path
https://bugs.webkit.org/show_bug.cgi?id=134526
Reviewed by Tim Horton.
* UIProcess/API/C/WKPage.cpp:
(WKPageRestoreFromSessionState):
Use the new code path.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::restoreFromState):
Only restore the back-forward state if we have a back-forward list.
* UIProcess/mac/LegacySessionStateCoding.cpp:
(WebKit::encodeSessionHistory):
Save the original URL string as well.
(WebKit::decodeV1SessionHistory):
If we don't have a current index, set it to Nullopt instead of 0.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (170678 => 170679)
--- trunk/Source/WebKit2/ChangeLog 2014-07-01 23:57:07 UTC (rev 170678)
+++ trunk/Source/WebKit2/ChangeLog 2014-07-02 00:08:13 UTC (rev 170679)
@@ -1,3 +1,25 @@
+2014-07-01 Anders Carlsson <ander...@apple.com>
+
+ WKPageRestoreFromSessionState should use the new session state restore code path
+ https://bugs.webkit.org/show_bug.cgi?id=134526
+
+ Reviewed by Tim Horton.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageRestoreFromSessionState):
+ Use the new code path.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::restoreFromState):
+ Only restore the back-forward state if we have a back-forward list.
+
+ * UIProcess/mac/LegacySessionStateCoding.cpp:
+ (WebKit::encodeSessionHistory):
+ Save the original URL string as well.
+
+ (WebKit::decodeV1SessionHistory):
+ If we don't have a current index, set it to Nullopt instead of 0.
+
2014-07-01 Gyuyoung Kim <gyuyoung....@samsung.com>
Unreviewed. EFL and GTK build fix since r170654.
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (170678 => 170679)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2014-07-01 23:57:07 UTC (rev 170678)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2014-07-02 00:08:13 UTC (rev 170679)
@@ -369,7 +369,11 @@
void WKPageRestoreFromSessionState(WKPageRef pageRef, WKDataRef sessionStateData)
{
- toImpl(pageRef)->restoreFromSessionStateData(toImpl(sessionStateData));
+ SessionState sessionState;
+ if (!decodeLegacySessionState(*toImpl(sessionStateData), sessionState))
+ return;
+
+ toImpl(pageRef)->restoreFromState(std::move(sessionState));
}
double WKPageGetTextZoomFactor(WKPageRef pageRef)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (170678 => 170679)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-07-01 23:57:07 UTC (rev 170678)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-07-02 00:08:13 UTC (rev 170679)
@@ -1865,18 +1865,27 @@
uint64_t WebPageProxy::restoreFromState(SessionState sessionState)
{
- m_backForwardList->restoreFromState(std::move(sessionState.backForwardListState));
+ bool hasBackForwardList = !!sessionState.backForwardListState.currentIndex;
- LegacySessionState state(m_backForwardList->entries(), m_backForwardList->currentIndex());
- process().send(Messages::WebPage::RestoreSession(state), m_pageID);
+ if (hasBackForwardList) {
+ m_backForwardList->restoreFromState(std::move(sessionState.backForwardListState));
+ for (const auto& entry : m_backForwardList->entries())
+ process().registerNewWebBackForwardListItem(entry.get());
+ LegacySessionState state(m_backForwardList->entries(), m_backForwardList->currentIndex());
+ process().send(Messages::WebPage::RestoreSession(state), m_pageID);
+ }
+
// FIXME: Navigating should be separate from state restoration.
if (!sessionState.provisionalURL.isNull())
return loadRequest(sessionState.provisionalURL);
- if (WebBackForwardListItem* item = m_backForwardList->currentItem())
- return goToBackForwardItem(item);
+ if (hasBackForwardList) {
+ // FIXME: Do we have to null check the back forward list item here?
+ if (WebBackForwardListItem* item = m_backForwardList->currentItem())
+ return goToBackForwardItem(item);
+ }
return 0;
}
Modified: trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp (170678 => 170679)
--- trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp 2014-07-01 23:57:07 UTC (rev 170678)
+++ trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp 2014-07-02 00:08:13 UTC (rev 170679)
@@ -437,7 +437,7 @@
auto originalURL = item.pageState.mainFrameState.originalURLString.createCFString();
auto data = ""
- auto entryDictionary = createDictionary({ { sessionHistoryEntryURLKey, url.get() }, { sessionHistoryEntryTitleKey, title.get() }, { sessionHistoryEntryDataKey, data.get() }, { sessionHistoryEntrySnapshotUUIDKey, item.snapshotUUID.createCFString().get() }});
+ auto entryDictionary = createDictionary({ { sessionHistoryEntryURLKey, url.get() }, { sessionHistoryEntryTitleKey, title.get() }, { sessionHistoryEntryOriginalURLKey, originalURL.get() }, { sessionHistoryEntryDataKey, data.get() }, { sessionHistoryEntrySnapshotUUIDKey, item.snapshotUUID.createCFString().get() }});
CFArrayAppendValue(entries.get(), entryDictionary.get());
}
@@ -1022,7 +1022,7 @@
auto currentIndexNumber = dynamic_cf_cast<CFNumberRef>(CFDictionaryGetValue(sessionHistoryDictionary, sessionHistoryCurrentIndexKey));
if (!currentIndexNumber) {
// No current index means the dictionary represents an empty session.
- backForwardListState.currentIndex = 0;
+ backForwardListState.currentIndex = Nullopt;
backForwardListState.items = { };
return true;
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes