Changeset 181815 in webkit


Ignore:
Timestamp:
Mar 20, 2015 3:45:14 PM (9 years ago)
Author:
Chris Dumez
Message:

[WK2] Allow stale content when restoring the browser's session state
https://bugs.webkit.org/show_bug.cgi?id=142916
<rdar://problem/20243493>

Reviewed by Darin Adler.

Allow stale content when restoring the browser's session state
(restoring all tabs from previous session), e.g.

  • Via History > Reopen All windows from previous session on Safari
  • Happens on startup for MobileSafari

I have verified that using "Open in tabs" on a bookmarks folder
still does fresh loads (rdar://problem/8131355) as it is not using
the restoreFromSessionState() code path.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::reattachToWebProcessForReload):
(WebKit::WebPageProxy::reattachToWebProcessWithItem):
(WebKit::WebPageProxy::goForward):
(WebKit::WebPageProxy::goBack):
(WebKit::WebPageProxy::goToBackForwardItem):
(WebKit::WebPageProxy::restoreFromSessionState):

  • UIProcess/WebPageProxy.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::goToBackForwardItem):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r181812 r181815  
     12015-03-20  Chris Dumez  <cdumez@apple.com>
     2
     3        [WK2] Allow stale content when restoring the browser's session state
     4        https://bugs.webkit.org/show_bug.cgi?id=142916
     5        <rdar://problem/20243493>
     6
     7        Reviewed by Darin Adler.
     8
     9        Allow stale content when restoring the browser's session state
     10        (restoring all tabs from previous session), e.g.
     11        - Via History > Reopen All windows from previous session on Safari
     12        - Happens on startup for MobileSafari
     13
     14        I have verified that using "Open in tabs" on a bookmarks folder
     15        still does fresh loads (rdar://problem/8131355) as it is not using
     16        the restoreFromSessionState() code path.
     17
     18        * UIProcess/WebPageProxy.cpp:
     19        (WebKit::WebPageProxy::reattachToWebProcessForReload):
     20        (WebKit::WebPageProxy::reattachToWebProcessWithItem):
     21        (WebKit::WebPageProxy::goForward):
     22        (WebKit::WebPageProxy::goBack):
     23        (WebKit::WebPageProxy::goToBackForwardItem):
     24        (WebKit::WebPageProxy::restoreFromSessionState):
     25        * UIProcess/WebPageProxy.h:
     26        * WebProcess/WebPage/WebPage.cpp:
     27        (WebKit::WebPage::goToBackForwardItem):
     28        * WebProcess/WebPage/WebPage.h:
     29        * WebProcess/WebPage/WebPage.messages.in:
     30
    1312015-03-20  Beth Dakin  <bdakin@apple.com>
    232
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r181791 r181815  
    657657
    658658    // We allow stale content when reloading a WebProcess that's been killed or crashed.
    659     m_process->send(Messages::WebPage::GoToBackForwardItem(navigation->navigationID(), m_backForwardList->currentItem()->itemID(), true /* allowStale */), m_pageID);
     659    m_process->send(Messages::WebPage::GoToBackForwardItem(navigation->navigationID(), m_backForwardList->currentItem()->itemID()), m_pageID);
    660660    m_process->responsivenessTimer()->start();
    661661
     
    663663}
    664664
    665 RefPtr<API::Navigation> WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item, AllowStaleContent allowStaleContent)
     665RefPtr<API::Navigation> WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item)
    666666{
    667667    if (m_isClosed)
     
    679679    auto navigation = m_navigationState->createBackForwardNavigation();
    680680
    681     m_process->send(Messages::WebPage::GoToBackForwardItem(navigation->navigationID(), item->itemID(), allowStaleContent == AllowStaleContent::Yes), m_pageID);
     681    m_process->send(Messages::WebPage::GoToBackForwardItem(navigation->navigationID(), item->itemID()), m_pageID);
    682682    m_process->responsivenessTimer()->start();
    683683
     
    10271027
    10281028    if (!isValid())
    1029         return reattachToWebProcessWithItem(forwardItem, AllowStaleContent::Yes);
     1029        return reattachToWebProcessWithItem(forwardItem);
    10301030
    10311031    RefPtr<API::Navigation> navigation;
     
    10501050
    10511051    if (!isValid())
    1052         return reattachToWebProcessWithItem(backItem, AllowStaleContent::Yes);
     1052        return reattachToWebProcessWithItem(backItem);
    10531053
    10541054    RefPtr<API::Navigation> navigation;
     
    10621062}
    10631063
    1064 RefPtr<API::Navigation> WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item, AllowStaleContent allowStaleContent)
    1065 {
    1066     if (!isValid())
    1067         return reattachToWebProcessWithItem(item, allowStaleContent);
     1064RefPtr<API::Navigation> WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
     1065{
     1066    if (!isValid())
     1067        return reattachToWebProcessWithItem(item);
    10681068
    10691069    auto transaction = m_pageLoadState.transaction();
     
    10751075        navigation = m_navigationState->createBackForwardNavigation();
    10761076
    1077     m_process->send(Messages::WebPage::GoToBackForwardItem(navigation ? navigation->navigationID() : 0, item->itemID(), allowStaleContent == AllowStaleContent::Yes), m_pageID);
     1077    m_process->send(Messages::WebPage::GoToBackForwardItem(navigation ? navigation->navigationID() : 0, item->itemID()), m_pageID);
    10781078    m_process->responsivenessTimer()->start();
    10791079
     
    20962096        if (hasBackForwardList) {
    20972097            // FIXME: Do we have to null check the back forward list item here?
    2098             if (WebBackForwardListItem* item = m_backForwardList->currentItem()) {
    2099                 // We forbid stale content when restoring the session state and do a fresh load (rdar://problem/8131355).
    2100                 return goToBackForwardItem(item, AllowStaleContent::No);
    2101             }
     2098            if (WebBackForwardListItem* item = m_backForwardList->currentItem())
     2099                return goToBackForwardItem(item);
    21022100        }
    21032101    }
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r181782 r181815  
    359359    RefPtr<API::Navigation> goBack();
    360360
    361     enum class AllowStaleContent { No, Yes };
    362     RefPtr<API::Navigation> goToBackForwardItem(WebBackForwardListItem*, AllowStaleContent = AllowStaleContent::Yes);
     361    RefPtr<API::Navigation> goToBackForwardItem(WebBackForwardListItem*);
    363362    void tryRestoreScrollPosition();
    364363    void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<WebBackForwardListItem>> removed);
     
    11641163    void reattachToWebProcess();
    11651164    RefPtr<API::Navigation> reattachToWebProcessForReload();
    1166     RefPtr<API::Navigation> reattachToWebProcessWithItem(WebBackForwardListItem*, AllowStaleContent);
     1165    RefPtr<API::Navigation> reattachToWebProcessWithItem(WebBackForwardListItem*);
    11671166
    11681167    void requestNotificationPermission(uint64_t notificationID, const String& originString);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r181782 r181815  
    11621162}
    11631163
    1164 void WebPage::goToBackForwardItem(uint64_t navigationID, uint64_t backForwardItemID, bool allowStaleContent)
     1164void WebPage::goToBackForwardItem(uint64_t navigationID, uint64_t backForwardItemID)
    11651165{
    11661166    SendStopResponsivenessTimer stopper(this);
     
    11751175        m_pendingNavigationID = navigationID;
    11761176
    1177     m_page->goToItem(*item, allowStaleContent ? FrameLoadType::IndexedBackForward : FrameLoadType::Standard);
     1177    m_page->goToItem(*item, FrameLoadType::IndexedBackForward);
    11781178}
    11791179
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r181782 r181815  
    927927    void goForward(uint64_t navigationID, uint64_t);
    928928    void goBack(uint64_t navigationID, uint64_t);
    929     void goToBackForwardItem(uint64_t navigationID, uint64_t, bool allowStaleContent);
     929    void goToBackForwardItem(uint64_t navigationID, uint64_t);
    930930    void tryRestoreScrollPosition();
    931931    void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r181782 r181815  
    120120    GoBack(uint64_t navigationID, uint64_t backForwardItemID)
    121121    GoForward(uint64_t navigationID, uint64_t backForwardItemID)
    122     GoToBackForwardItem(uint64_t navigationID, uint64_t backForwardItemID, bool allowStaleContent)
     122    GoToBackForwardItem(uint64_t navigationID, uint64_t backForwardItemID)
    123123    TryRestoreScrollPosition()
    124124
Note: See TracChangeset for help on using the changeset viewer.