Changeset 207445 in webkit


Ignore:
Timestamp:
Oct 17, 2016 5:45:05 PM (8 years ago)
Author:
timothy_horton@apple.com
Message:

REGRESSION (r169805): WKWebView canGoBack returning YES when nothing is in the back-forward list after restoring session state
https://bugs.webkit.org/show_bug.cgi?id=163573
<rdar://problem/28744549>

Reviewed by Dan Bernstein.

Source/WebKit2:

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::restoreFromSessionState):
Update PageLoadState's canGoBack/canGoForward bits when restoring from
session state, because in the don't-navigate case, nothing else will make this happen,
and it will remain stale.

Tools:

  • TestWebKitAPI/Tests/WebKit2/WKBackForwardList.mm:

(TEST):
Add a test ensuring that canGoBack returns NO after restoring session state without navigating.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r207443 r207445  
     12016-10-17  Tim Horton  <timothy_horton@apple.com>
     2
     3        REGRESSION (r169805): WKWebView canGoBack returning YES when nothing is in the back-forward list after restoring session state
     4        https://bugs.webkit.org/show_bug.cgi?id=163573
     5        <rdar://problem/28744549>
     6
     7        Reviewed by Dan Bernstein.
     8
     9        * UIProcess/WebPageProxy.cpp:
     10        (WebKit::WebPageProxy::restoreFromSessionState):
     11        Update PageLoadState's canGoBack/canGoForward bits when restoring from
     12        session state, because in the don't-navigate case, nothing else will make this happen,
     13        and it will remain stale.
     14
    1152016-10-17  Andy Estes  <aestes@apple.com>
    216
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r207424 r207445  
    23982398        process().send(Messages::WebPage::RestoreSession(m_backForwardList->itemStates()), m_pageID);
    23992399
     2400        auto transaction = m_pageLoadState.transaction();
     2401        m_pageLoadState.setCanGoBack(transaction, m_backForwardList->backItem());
     2402        m_pageLoadState.setCanGoForward(transaction, m_backForwardList->forwardItem());
     2403
    24002404        // The back / forward list was restored from a sessionState so we don't want to snapshot the current
    24012405        // page when navigating away. Suppress navigation snapshotting until the next load has committed
  • trunk/Tools/ChangeLog

    r207443 r207445  
     12016-10-17  Tim Horton  <timothy_horton@apple.com>
     2
     3        REGRESSION (r169805): WKWebView canGoBack returning YES when nothing is in the back-forward list after restoring session state
     4        https://bugs.webkit.org/show_bug.cgi?id=163573
     5        <rdar://problem/28744549>
     6
     7        Reviewed by Dan Bernstein.
     8
     9        * TestWebKitAPI/Tests/WebKit2/WKBackForwardList.mm:
     10        (TEST):
     11        Add a test ensuring that canGoBack returns NO after restoring session state without navigating.
     12
    1132016-10-17  Andy Estes  <aestes@apple.com>
    214
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/WKBackForwardList.mm

    r205329 r207445  
    7373}
    7474
     75TEST(WKBackForwardList, CanNotGoBackAfterRestoringEmptySessionState)
     76{
     77    auto webView = adoptNS([[WKWebView alloc] init]);
     78
     79    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:loadableURL1]]];
     80    [webView _test_waitForDidFinishNavigation];
     81
     82    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:loadableURL2]]];
     83    [webView _test_waitForDidFinishNavigation];
     84
     85    WKBackForwardList *list = [webView backForwardList];
     86    EXPECT_EQ(YES, [webView canGoBack]);
     87    EXPECT_EQ(NO, [webView canGoForward]);
     88    EXPECT_EQ((NSUInteger)1, list.backList.count);
     89    EXPECT_EQ((NSUInteger)0, list.forwardList.count);
     90
     91    auto singlePageWebView = adoptNS([[WKWebView alloc] init]);
     92
     93    [singlePageWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:loadableURL1]]];
     94    [singlePageWebView _test_waitForDidFinishNavigation];
     95
     96    [webView _restoreSessionState:[singlePageWebView _sessionState] andNavigate:NO];
     97
     98    WKBackForwardList *newList = [webView backForwardList];
     99
     100    EXPECT_EQ(NO, [webView canGoBack]);
     101    EXPECT_EQ(NO, [webView canGoForward]);
     102    EXPECT_EQ((NSUInteger)0, newList.backList.count);
     103    EXPECT_EQ((NSUInteger)0, newList.forwardList.count);
     104}
     105
    75106#endif
Note: See TracChangeset for help on using the changeset viewer.