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

Changeset 169059 in webkit


Ignore:
Timestamp:
May 19, 2014, 1:09:32 PM (12 years ago)
Author:
Lucas Forschler
Message:

Merged r169016.

Location:
branches/safari-538.34.5-branch
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-538.34.5-branch/Source/WebKit2/ChangeLog

    r169057 r169059  
     12014-05-19  Lucas Forschler  <lforschler@apple.com>
     2
     3        Merge r169016
     4
     5    2014-05-18  Anders Carlsson  <andersca@apple.com>
     6
     7            Implement Navigations for all methods declared returning one
     8            https://bugs.webkit.org/show_bug.cgi?id=133048
     9            <rdar://problem/16830064>
     10
     11            Reviewed by Sam Weinig.
     12
     13            * UIProcess/API/Cocoa/WKWebView.mm:
     14            (-[WKWebView goToBackForwardListItem:]):
     15            (-[WKWebView goBack]):
     16            (-[WKWebView goForward]):
     17            (-[WKWebView reload]):
     18            (-[WKWebView reloadFromOrigin]):
     19            Create and return navigations.
     20
     21            (-[WKWebView _reload]):
     22            Call -[WKWebView reload].
     23
     24            * UIProcess/Cocoa/NavigationState.h:
     25            * UIProcess/Cocoa/NavigationState.mm:
     26            (WebKit::NavigationState::createBackForwardNavigation):
     27            Create a back/forward navigation.
     28
     29            (WebKit::NavigationState::createReloadNavigation):
     30            Create a reload navigation.
     31
     32            * UIProcess/WebPageProxy.cpp:
     33            (WebKit::WebPageProxy::reattachToWebProcessWithItem):
     34            Generate a navigation ID and send it with the GoToBackForwardItem message.
     35
     36            (WebKit::WebPageProxy::reload):
     37            Return a navigation ID.
     38
     39            (WebKit::WebPageProxy::goForward):
     40            Generate a navigation ID and send it with the GoForward message.
     41
     42            (WebKit::WebPageProxy::goBack):
     43            Generate a navigation ID and send it with the GoBack message.
     44
     45            (WebKit::WebPageProxy::goToBackForwardItem):
     46            Generate a navigation ID and send it with the GoToBackForwardItem message.
     47
     48            * UIProcess/WebPageProxy.h:
     49            Return navigation IDs where appropriate.
     50
     51            * UIProcess/cf/WebPageProxyCF.cpp:
     52            (WebKit::WebPageProxy::restoreFromSessionStateData):
     53            Generate a navigation ID and send it with the RestoreSessionAndNavigateToCurrentItem message.
     54
     55            * WebProcess/WebPage/WebPage.cpp:
     56            (WebKit::WebPage::goForward):
     57            (WebKit::WebPage::goBack):
     58            (WebKit::WebPage::goToBackForwardItem):
     59            Set up the pending navigation ID.
     60
     61            (WebKit::WebPage::restoreSessionAndNavigateToCurrentItem):
     62            Call goToBackForwardItem with a navigation ID.
     63
     64            * WebProcess/WebPage/WebPage.h:
     65            Add navigation IDs.
     66
     67            * WebProcess/WebPage/WebPage.messages.in:
     68            Add navigation IDs.
     69
    1702014-05-19  Lucas Forschler  <lforschler@apple.com>
    271
  • branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r169056 r169059  
    285285- (WKNavigation *)goToBackForwardListItem:(WKBackForwardListItem *)item
    286286{
    287     _page->goToBackForwardItem(&item._item);
    288 
    289     // FIXME: return a WKNavigation object.
    290     return nil;
     287    uint64_t navigationID = _page->goToBackForwardItem(&item._item);
     288
     289    auto navigation = _navigationState->createBackForwardNavigation(navigationID, item._item);
     290
     291    return [navigation.leakRef() autorelease];
    291292}
    292293
    … …  
    330331- (WKNavigation *)goBack
    331332{
    332     _page->goBack();
    333 
    334     // FIXME: Return a navigation object.
    335     return nil;
     333    uint64_t navigationID = _page->goBack();
     334    if (!navigationID)
     335        return nil;
     336
     337    ASSERT(_page->backForwardList().currentItem());
     338    auto navigation = _navigationState->createBackForwardNavigation(navigationID, *_page->backForwardList().currentItem());
     339
     340    return [navigation.leakRef() autorelease];
    336341}
    337342
    338343- (WKNavigation *)goForward
    339344{
    340     _page->goForward();
    341 
    342     // FIXME: Return a navigation object.
    343     return nil;
     345    uint64_t navigationID = _page->goForward();
     346    if (!navigationID)
     347        return nil;
     348
     349    ASSERT(_page->backForwardList().currentItem());
     350    auto navigation = _navigationState->createBackForwardNavigation(navigationID, *_page->backForwardList().currentItem());
     351
     352    return [navigation.leakRef() autorelease];
    344353}
    345354
    346355- (WKNavigation *)reload
    347356{
    348     _page->reload(false);
    349 
    350     // FIXME: Return a navigation object.
    351     return nil;
     357    uint64_t navigationID = _page->reload(false);
     358    ASSERT(navigationID);
     359
     360    auto navigation = _navigationState->createReloadNavigation(navigationID);
     361    return [navigation.leakRef() autorelease];
    352362}
    353363
    354364- (WKNavigation *)reloadFromOrigin
    355365{
    356     _page->reload(true);
    357 
    358     // FIXME: Return a navigation object.
    359     return nil;
     366    uint64_t navigationID = _page->reload(true);
     367    ASSERT(navigationID);
     368
     369    auto navigation = _navigationState->createReloadNavigation(navigationID);
     370    return [navigation.leakRef() autorelease];
    360371}
    361372
    … …  
    10731084- (WKNavigation *)_reload
    10741085{
    1075     _page->reload(false);
    1076 
    1077     // FIXME: return a WKNavigation object.
    1078     return nil;
     1086    return [self reload];
    10791087}
    10801088
  • branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/Cocoa/NavigationState.h

    r168751 r169059  
    6464    void setHistoryDelegate(id <WKHistoryDelegatePrivate>);
    6565
     66    RetainPtr<WKNavigation> createBackForwardNavigation(uint64_t navigationID, const WebBackForwardListItem&);
    6667    RetainPtr<WKNavigation> createLoadRequestNavigation(uint64_t navigationID, NSURLRequest *);
     68    RetainPtr<WKNavigation> createReloadNavigation(uint64_t navigationID);
    6769
    6870    // Called by the history client.
  • branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm

    r168956 r169059  
    164164}
    165165
     166RetainPtr<WKNavigation> NavigationState::createBackForwardNavigation(uint64_t navigationID, const WebBackForwardListItem& item)
     167{
     168    ASSERT(!m_navigations.contains(navigationID));
     169
     170    auto navigation = adoptNS([[WKNavigation alloc] init]);
     171
     172    // FIXME: We need to remove the navigation when we're done with it!
     173    m_navigations.set(navigationID, navigation);
     174
     175    return navigation;
     176}
     177
     178RetainPtr<WKNavigation> NavigationState::createReloadNavigation(uint64_t navigationID)
     179{
     180    ASSERT(!m_navigations.contains(navigationID));
     181
     182    auto navigation = adoptNS([[WKNavigation alloc] init]);
     183
     184    // FIXME: We need to remove the navigation when we're done with it!
     185    m_navigations.set(navigationID, navigation);
     186
     187    return navigation;
     188}
     189
    166190void NavigationState::didNavigateWithNavigationData(const WebKit::WebNavigationDataStore& navigationDataStore)
    167191{
  • branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r169056 r169059  
    554554}
    555555
    556 void WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item)
     556uint64_t WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item)
    557557{
    558558    if (item && item != m_backForwardList->currentItem())
    … …  
    562562
    563563    if (!item)
    564         return;
    565 
    566     m_process->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
     564        return 0;
     565
     566    uint64_t navigationID = generateNavigationID();
     567
     568    m_process->send(Messages::WebPage::GoToBackForwardItem(navigationID, item->itemID()), m_pageID);
    567569    m_process->responsivenessTimer()->start();
     570
     571    return navigationID;
    568572}
    569573
    … …  
    796800}
    797801
    798 void WebPageProxy::reload(bool reloadFromOrigin)
     802uint64_t WebPageProxy::reload(bool reloadFromOrigin)
    799803{
    800804    SandboxExtension::Handle sandboxExtensionHandle;
    … …  
    811815    }
    812816
    813     if (!isValid()) {
    814         reattachToWebProcessWithItem(m_backForwardList->currentItem());
    815         return;
    816     }
    817 
    818     m_process->send(Messages::WebPage::Reload(generateNavigationID(), reloadFromOrigin, sandboxExtensionHandle), m_pageID);
     817    if (!isValid())
     818        return reattachToWebProcessWithItem(m_backForwardList->currentItem());
     819
     820    uint64_t navigationID = generateNavigationID();
     821
     822    m_process->send(Messages::WebPage::Reload(navigationID, reloadFromOrigin, sandboxExtensionHandle), m_pageID);
    819823    m_process->responsivenessTimer()->start();
     824
     825    return navigationID;
    820826}
    821827
    … …  
    830836}
    831837
    832 void WebPageProxy::goForward()
     838uint64_t WebPageProxy::goForward()
    833839{
    834840    WebBackForwardListItem* forwardItem = m_backForwardList->forwardItem();
    835841    if (!forwardItem)
    836         return;
     842        return 0;
    837843
    838844    recordNavigationSnapshot();
    … …  
    842848    m_pageLoadState.setPendingAPIRequestURL(transaction, forwardItem->url());
    843849
    844     if (!isValid()) {
    845         reattachToWebProcessWithItem(forwardItem);
    846         return;
    847     }
    848 
    849     m_process->send(Messages::WebPage::GoForward(forwardItem->itemID()), m_pageID);
     850    if (!isValid())
     851        return reattachToWebProcessWithItem(forwardItem);
     852
     853    uint64_t navigationID = generateNavigationID();
     854
     855    m_process->send(Messages::WebPage::GoForward(navigationID, forwardItem->itemID()), m_pageID);
    850856    m_process->responsivenessTimer()->start();
    851 }
    852 
    853 void WebPageProxy::goBack()
     857
     858    return navigationID;
     859}
     860
     861uint64_t WebPageProxy::goBack()
    854862{
    855863    WebBackForwardListItem* backItem = m_backForwardList->backItem();
    856864    if (!backItem)
    857         return;
     865        return 0;
    858866
    859867    recordNavigationSnapshot();
    … …  
    863871    m_pageLoadState.setPendingAPIRequestURL(transaction, backItem->url());
    864872
    865     if (!isValid()) {
    866         reattachToWebProcessWithItem(backItem);
    867         return;
    868     }
    869 
    870     m_process->send(Messages::WebPage::GoBack(backItem->itemID()), m_pageID);
     873    if (!isValid())
     874        return reattachToWebProcessWithItem(backItem);
     875
     876    uint64_t navigationID = generateNavigationID();
     877
     878    m_process->send(Messages::WebPage::GoBack(navigationID, backItem->itemID()), m_pageID);
    871879    m_process->responsivenessTimer()->start();
    872 }
    873 
    874 void WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
    875 {
    876     if (!isValid()) {
    877         reattachToWebProcessWithItem(item);
    878         return;
    879     }
     880
     881    return navigationID;
     882}
     883
     884uint64_t WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item)
     885{
     886    if (!isValid())
     887        return reattachToWebProcessWithItem(item);
    880888
    881889    recordNavigationSnapshot();
    … …  
    885893    m_pageLoadState.setPendingAPIRequestURL(transaction, item->url());
    886894
    887     m_process->send(Messages::WebPage::GoToBackForwardItem(item->itemID()), m_pageID);
     895    uint64_t navigationID = generateNavigationID();
     896
     897    m_process->send(Messages::WebPage::GoToBackForwardItem(navigationID, item->itemID()), m_pageID);
    888898    m_process->responsivenessTimer()->start();
     899
     900    return navigationID;
    889901}
    890902
  • branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/WebPageProxy.h

    r169056 r169059  
    518518
    519519    void stopLoading();
    520     void reload(bool reloadFromOrigin);
    521 
    522     void goForward();
    523     void goBack();
    524 
    525     void goToBackForwardItem(WebBackForwardListItem*);
     520    uint64_t reload(bool reloadFromOrigin);
     521
     522    uint64_t goForward();
     523    uint64_t goBack();
     524
     525    uint64_t goToBackForwardItem(WebBackForwardListItem*);
    526526    void tryRestoreScrollPosition();
    527527    void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<WebBackForwardListItem>> removed);
    … …  
    12031203
    12041204    void reattachToWebProcess();
    1205     void reattachToWebProcessWithItem(WebBackForwardListItem*);
     1205    uint64_t reattachToWebProcessWithItem(WebBackForwardListItem*);
    12061206
    12071207    void requestNotificationPermission(uint64_t notificationID, const String& originString);
  • branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp

    r164381 r169059  
    170170                        m_pageLoadState.setPendingAPIRequestURL(transaction, item->url());
    171171
    172                     process().send(Messages::WebPage::RestoreSessionAndNavigateToCurrentItem(state), m_pageID);
     172                    process().send(Messages::WebPage::RestoreSessionAndNavigateToCurrentItem(generateNavigationID(), state), m_pageID);
    173173                }
    174174            }
  • branches/safari-538.34.5-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r169056 r169059  
    10791079}
    10801080
    1081 void WebPage::goForward(uint64_t backForwardItemID)
     1081void WebPage::goForward(uint64_t navigationID, uint64_t backForwardItemID)
    10821082{
    10831083    SendStopResponsivenessTimer stopper(this);
    … …  
    10881088        return;
    10891089
     1090    ASSERT(!m_pendingNavigationID);
     1091    if (!item->isInPageCache())
     1092        m_pendingNavigationID = navigationID;
     1093
    10901094    m_page->goToItem(item, FrameLoadTypeForward);
    10911095}
    10921096
    1093 void WebPage::goBack(uint64_t backForwardItemID)
     1097void WebPage::goBack(uint64_t navigationID, uint64_t backForwardItemID)
    10941098{
    10951099    SendStopResponsivenessTimer stopper(this);
    … …  
    11001104        return;
    11011105
     1106    ASSERT(!m_pendingNavigationID);
     1107    if (!item->isInPageCache())
     1108        m_pendingNavigationID = navigationID;
     1109
    11021110    m_page->goToItem(item, FrameLoadTypeBack);
    11031111}
    11041112
    1105 void WebPage::goToBackForwardItem(uint64_t backForwardItemID)
     1113void WebPage::goToBackForwardItem(uint64_t navigationID, uint64_t backForwardItemID)
    11061114{
    11071115    SendStopResponsivenessTimer stopper(this);
    … …  
    11111119    if (!item)
    11121120        return;
     1121
     1122    ASSERT(!m_pendingNavigationID);
     1123    if (!item->isInPageCache())
     1124        m_pendingNavigationID = navigationID;
    11131125
    11141126    m_page->goToItem(item, FrameLoadTypeIndexedBackForward);
    … …  
    19551967}
    19561968
    1957 void WebPage::restoreSessionAndNavigateToCurrentItem(const SessionState& sessionState)
     1969void WebPage::restoreSessionAndNavigateToCurrentItem(uint64_t navigationID, const SessionState& sessionState)
    19581970{
    19591971    if (uint64_t currentItemID = restoreSession(sessionState))
    1960         goToBackForwardItem(currentItemID);
     1972        goToBackForwardItem(navigationID, currentItemID);
    19611973}
    19621974
  • branches/safari-538.34.5-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r169056 r169059  
    856856    void loadWebArchiveData(const IPC::DataReference&, IPC::MessageDecoder&);
    857857    void reload(uint64_t navigationID, bool reloadFromOrigin, const SandboxExtension::Handle&);
    858     void goForward(uint64_t);
    859     void goBack(uint64_t);
    860     void goToBackForwardItem(uint64_t);
     858    void goForward(uint64_t navigationID, uint64_t);
     859    void goBack(uint64_t navigationID, uint64_t);
     860    void goToBackForwardItem(uint64_t navigationID, uint64_t);
    861861    void tryRestoreScrollPosition();
    862862    void setActive(bool);
    … …  
    891891
    892892    uint64_t restoreSession(const SessionState&);
    893     void restoreSessionAndNavigateToCurrentItem(const SessionState&);
     893    void restoreSessionAndNavigateToCurrentItem(uint64_t navigationID, const SessionState&);
    894894
    895895    void didRemoveBackForwardItem(uint64_t);
  • branches/safari-538.34.5-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r168934 r169059  
    105105    CenterSelectionInVisibleArea()
    106106
    107     GoBack(uint64_t backForwardItemID)
    108     GoForward(uint64_t backForwardItemID)
    109     GoToBackForwardItem(uint64_t backForwardItemID)
     107    GoBack(uint64_t navigationID, uint64_t backForwardItemID)
     108    GoForward(uint64_t navigationID, uint64_t backForwardItemID)
     109    GoToBackForwardItem(uint64_t navigationID, uint64_t backForwardItemID)
    110110    TryRestoreScrollPosition()
    111111
    … …  
    124124   
    125125    RestoreSession(WebKit::SessionState state)
    126     RestoreSessionAndNavigateToCurrentItem(WebKit::SessionState state)
     126    RestoreSessionAndNavigateToCurrentItem(uint64_t navigationID, WebKit::SessionState state)
    127127
    128128    DidRemoveBackForwardItem(uint64_t backForwardItemID)
  • branches/safari-538.34.5-branch/Tools/ChangeLog

    r168939 r169059  
     12014-05-19  Lucas Forschler  <lforschler@apple.com>
     2
     3        Merge r169016
     4
     5    2014-05-18  Anders Carlsson  <andersca@apple.com>
     6
     7            Implement Navigations for all methods declared returning one
     8            https://bugs.webkit.org/show_bug.cgi?id=133048
     9            <rdar://problem/16830064>
     10
     11            Reviewed by Sam Weinig.
     12
     13            * MiniBrowser/mac/MiniBrowser_Prefix.pch:
     14            Import WebKit.h.
     15
     16            * MiniBrowser/mac/WK2BrowserWindowController.m:
     17            (-[WK2BrowserWindowController webView:didStartProvisionalNavigation:]):
     18            (-[WK2BrowserWindowController webView:didReceiveServerRedirectForProvisionalNavigation:]):
     19            (-[WK2BrowserWindowController webView:didFailProvisionalNavigation:withError:]):
     20            (-[WK2BrowserWindowController webView:didCommitNavigation:]):
     21            (-[WK2BrowserWindowController webView:didFinishLoadingNavigation:]):
     22            (-[WK2BrowserWindowController webView:didFailNavigation:withError:]):
     23            Print out the navigations.
     24
    1252014-05-16  Lucas Forschler  <lforschler@apple.com>
    226
  • branches/safari-538.34.5-branch/Tools/MiniBrowser/mac/MiniBrowser_Prefix.pch

    r124163 r169059  
    2626#ifdef __OBJC__
    2727    #import <Cocoa/Cocoa.h>
     28    #import <WebKit/WebKit.h>
    2829#endif
    29 
    30 #import <WebKit2/WebKit2_C.h>
    3130
    3231#define ENABLE_LOGGING 0
  • branches/safari-538.34.5-branch/Tools/MiniBrowser/mac/WK2BrowserWindowController.m

    r167476 r169059  
    412412- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation
    413413{
    414     LOG(@"didStartProvisionalNavigation");
     414    LOG(@"didStartProvisionalNavigation: %@", navigation);
    415415}
    416416
    417417- (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation
    418418{
    419     LOG(@"didReceiveServerRedirectForProvisionalNavigation");
     419    LOG(@"didReceiveServerRedirectForProvisionalNavigation: %@", navigation);
    420420}
    421421
    422422- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error
    423423{
    424     LOG(@"didFailProvisionalNavigation: %@", error);
     424    LOG(@"didFailProvisionalNavigation: %@navigation, error: %@", navigation, error);
    425425}
    426426
    427427- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation
    428428{
    429     LOG(@"didCommitNavigation: %@", error);
     429    LOG(@"didCommitNavigation: %@", navigation);
    430430}
    431431
    432432- (void)webView:(WKWebView *)webView didFinishLoadingNavigation:(WKNavigation *)navigation
    433433{
    434     LOG(@"didFinishLoadingNavigation");
     434    LOG(@"didFinishLoadingNavigation: %@", navigation);
    435435}
    436436
    437437- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error
    438438{
    439     LOG(@"didFailNavigation: %@", error);
     439    LOG(@"didFailNavigation: %@, error %@", navigation, error);
    440440}
    441441
Note: See TracChangeset for help on using the changeset viewer.