⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 170679 in webkit


Ignore:
Timestamp:
Jul 1, 2014, 5:08:13 PM (12 years ago)
Author:
andersca@apple.com
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.

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r170676 r170679  
     12014-07-01  Anders Carlsson  <andersca@apple.com>
     2
     3        WKPageRestoreFromSessionState should use the new session state restore code path
     4        https://bugs.webkit.org/show_bug.cgi?id=134526
     5
     6        Reviewed by Tim Horton.
     7
     8        * UIProcess/API/C/WKPage.cpp:
     9        (WKPageRestoreFromSessionState):
     10        Use the new code path.
     11
     12        * UIProcess/WebPageProxy.cpp:
     13        (WebKit::WebPageProxy::restoreFromState):
     14        Only restore the back-forward state if we have a back-forward list.
     15
     16        * UIProcess/mac/LegacySessionStateCoding.cpp:
     17        (WebKit::encodeSessionHistory):
     18        Save the original URL string as well.
     19
     20        (WebKit::decodeV1SessionHistory):
     21        If we don't have a current index, set it to Nullopt instead of 0.
     22
    1232014-07-01  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    224
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp

    r170671 r170679  
    370370void WKPageRestoreFromSessionState(WKPageRef pageRef, WKDataRef sessionStateData)
    371371{
    372     toImpl(pageRef)->restoreFromSessionStateData(toImpl(sessionStateData));
     372    SessionState sessionState;
     373    if (!decodeLegacySessionState(*toImpl(sessionStateData), sessionState))
     374        return;
     375
     376    toImpl(pageRef)->restoreFromState(std::move(sessionState));
    373377}
    374378
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r170664 r170679  
    18661866uint64_t WebPageProxy::restoreFromState(SessionState sessionState)
    18671867{
    1868     m_backForwardList->restoreFromState(std::move(sessionState.backForwardListState));
    1869 
    1870     LegacySessionState state(m_backForwardList->entries(), m_backForwardList->currentIndex());
    1871     process().send(Messages::WebPage::RestoreSession(state), m_pageID);
     1868    bool hasBackForwardList = !!sessionState.backForwardListState.currentIndex;
     1869
     1870    if (hasBackForwardList) {
     1871        m_backForwardList->restoreFromState(std::move(sessionState.backForwardListState));
     1872        for (const auto& entry : m_backForwardList->entries())
     1873            process().registerNewWebBackForwardListItem(entry.get());
     1874
     1875        LegacySessionState state(m_backForwardList->entries(), m_backForwardList->currentIndex());
     1876        process().send(Messages::WebPage::RestoreSession(state), m_pageID);
     1877    }
    18721878
    18731879    // FIXME: Navigating should be separate from state restoration.
    … …  
    18761882        return loadRequest(sessionState.provisionalURL);
    18771883
    1878     if (WebBackForwardListItem* item = m_backForwardList->currentItem())
    1879         return goToBackForwardItem(item);
     1884    if (hasBackForwardList) {
     1885        // FIXME: Do we have to null check the back forward list item here?
     1886        if (WebBackForwardListItem* item = m_backForwardList->currentItem())
     1887            return goToBackForwardItem(item);
     1888    }
    18801889
    18811890    return 0;
  • trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp

    r170671 r170679  
    438438        auto data = encodeSessionHistoryEntryData(item.pageState.mainFrameState);
    439439
    440         auto entryDictionary = createDictionary({ { sessionHistoryEntryURLKey, url.get() }, { sessionHistoryEntryTitleKey, title.get() }, { sessionHistoryEntryDataKey, data.get() }, { sessionHistoryEntrySnapshotUUIDKey, item.snapshotUUID.createCFString().get() }});
     440        auto entryDictionary = createDictionary({ { sessionHistoryEntryURLKey, url.get() }, { sessionHistoryEntryTitleKey, title.get() }, { sessionHistoryEntryOriginalURLKey, originalURL.get() }, { sessionHistoryEntryDataKey, data.get() }, { sessionHistoryEntrySnapshotUUIDKey, item.snapshotUUID.createCFString().get() }});
    441441
    442442        CFArrayAppendValue(entries.get(), entryDictionary.get());
    … …  
    10231023    if (!currentIndexNumber) {
    10241024        // No current index means the dictionary represents an empty session.
    1025         backForwardListState.currentIndex = 0;
     1025        backForwardListState.currentIndex = Nullopt;
    10261026        backForwardListState.items = { };
    10271027        return true;
Note: See TracChangeset for help on using the changeset viewer.