Changeset 169059 in webkit
- Timestamp:
- May 19, 2014, 1:09:32 PM (12 years ago)
- Location:
- branches/safari-538.34.5-branch
- Files:
-
- 13 edited
-
Source/WebKit2/ChangeLog (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (modified) (3 diffs)
-
Source/WebKit2/UIProcess/Cocoa/NavigationState.h (modified) (1 diff)
-
Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (modified) (1 diff)
-
Source/WebKit2/UIProcess/WebPageProxy.cpp (modified) (8 diffs)
-
Source/WebKit2/UIProcess/WebPageProxy.h (modified) (2 diffs)
-
Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp (modified) (1 diff)
-
Source/WebKit2/WebProcess/WebPage/WebPage.cpp (modified) (5 diffs)
-
Source/WebKit2/WebProcess/WebPage/WebPage.h (modified) (2 diffs)
-
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/MiniBrowser/mac/MiniBrowser_Prefix.pch (modified) (1 diff)
-
Tools/MiniBrowser/mac/WK2BrowserWindowController.m (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-538.34.5-branch/Source/WebKit2/ChangeLog
r169057 r169059 1 2014-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 1 70 2014-05-19 Lucas Forschler <lforschler@apple.com> 2 71 -
branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r169056 r169059 285 285 - (WKNavigation *)goToBackForwardListItem:(WKBackForwardListItem *)item 286 286 { 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]; 291 292 } 292 293 … … 330 331 - (WKNavigation *)goBack 331 332 { 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]; 336 341 } 337 342 338 343 - (WKNavigation *)goForward 339 344 { 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]; 344 353 } 345 354 346 355 - (WKNavigation *)reload 347 356 { 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]; 352 362 } 353 363 354 364 - (WKNavigation *)reloadFromOrigin 355 365 { 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]; 360 371 } 361 372 … … 1073 1084 - (WKNavigation *)_reload 1074 1085 { 1075 _page->reload(false); 1076 1077 // FIXME: return a WKNavigation object. 1078 return nil; 1086 return [self reload]; 1079 1087 } 1080 1088 -
branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/Cocoa/NavigationState.h
r168751 r169059 64 64 void setHistoryDelegate(id <WKHistoryDelegatePrivate>); 65 65 66 RetainPtr<WKNavigation> createBackForwardNavigation(uint64_t navigationID, const WebBackForwardListItem&); 66 67 RetainPtr<WKNavigation> createLoadRequestNavigation(uint64_t navigationID, NSURLRequest *); 68 RetainPtr<WKNavigation> createReloadNavigation(uint64_t navigationID); 67 69 68 70 // Called by the history client. -
branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm
r168956 r169059 164 164 } 165 165 166 RetainPtr<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 178 RetainPtr<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 166 190 void NavigationState::didNavigateWithNavigationData(const WebKit::WebNavigationDataStore& navigationDataStore) 167 191 { -
branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp
r169056 r169059 554 554 } 555 555 556 voidWebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item)556 uint64_t WebPageProxy::reattachToWebProcessWithItem(WebBackForwardListItem* item) 557 557 { 558 558 if (item && item != m_backForwardList->currentItem()) … … 562 562 563 563 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); 567 569 m_process->responsivenessTimer()->start(); 570 571 return navigationID; 568 572 } 569 573 … … 796 800 } 797 801 798 voidWebPageProxy::reload(bool reloadFromOrigin)802 uint64_t WebPageProxy::reload(bool reloadFromOrigin) 799 803 { 800 804 SandboxExtension::Handle sandboxExtensionHandle; … … 811 815 } 812 816 813 if (!isValid()) {814 re attachToWebProcessWithItem(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); 819 823 m_process->responsivenessTimer()->start(); 824 825 return navigationID; 820 826 } 821 827 … … 830 836 } 831 837 832 voidWebPageProxy::goForward()838 uint64_t WebPageProxy::goForward() 833 839 { 834 840 WebBackForwardListItem* forwardItem = m_backForwardList->forwardItem(); 835 841 if (!forwardItem) 836 return ;842 return 0; 837 843 838 844 recordNavigationSnapshot(); … … 842 848 m_pageLoadState.setPendingAPIRequestURL(transaction, forwardItem->url()); 843 849 844 if (!isValid()) {845 re attachToWebProcessWithItem(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); 850 856 m_process->responsivenessTimer()->start(); 851 } 852 853 void WebPageProxy::goBack() 857 858 return navigationID; 859 } 860 861 uint64_t WebPageProxy::goBack() 854 862 { 855 863 WebBackForwardListItem* backItem = m_backForwardList->backItem(); 856 864 if (!backItem) 857 return ;865 return 0; 858 866 859 867 recordNavigationSnapshot(); … … 863 871 m_pageLoadState.setPendingAPIRequestURL(transaction, backItem->url()); 864 872 865 if (!isValid()) {866 re attachToWebProcessWithItem(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); 871 879 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 884 uint64_t WebPageProxy::goToBackForwardItem(WebBackForwardListItem* item) 885 { 886 if (!isValid()) 887 return reattachToWebProcessWithItem(item); 880 888 881 889 recordNavigationSnapshot(); … … 885 893 m_pageLoadState.setPendingAPIRequestURL(transaction, item->url()); 886 894 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); 888 898 m_process->responsivenessTimer()->start(); 899 900 return navigationID; 889 901 } 890 902 -
branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/WebPageProxy.h
r169056 r169059 518 518 519 519 void stopLoading(); 520 voidreload(bool reloadFromOrigin);521 522 voidgoForward();523 voidgoBack();524 525 voidgoToBackForwardItem(WebBackForwardListItem*);520 uint64_t reload(bool reloadFromOrigin); 521 522 uint64_t goForward(); 523 uint64_t goBack(); 524 525 uint64_t goToBackForwardItem(WebBackForwardListItem*); 526 526 void tryRestoreScrollPosition(); 527 527 void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<WebBackForwardListItem>> removed); … … 1203 1203 1204 1204 void reattachToWebProcess(); 1205 voidreattachToWebProcessWithItem(WebBackForwardListItem*);1205 uint64_t reattachToWebProcessWithItem(WebBackForwardListItem*); 1206 1206 1207 1207 void requestNotificationPermission(uint64_t notificationID, const String& originString); -
branches/safari-538.34.5-branch/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
r164381 r169059 170 170 m_pageLoadState.setPendingAPIRequestURL(transaction, item->url()); 171 171 172 process().send(Messages::WebPage::RestoreSessionAndNavigateToCurrentItem( state), m_pageID);172 process().send(Messages::WebPage::RestoreSessionAndNavigateToCurrentItem(generateNavigationID(), state), m_pageID); 173 173 } 174 174 } -
branches/safari-538.34.5-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r169056 r169059 1079 1079 } 1080 1080 1081 void WebPage::goForward(uint64_t backForwardItemID)1081 void WebPage::goForward(uint64_t navigationID, uint64_t backForwardItemID) 1082 1082 { 1083 1083 SendStopResponsivenessTimer stopper(this); … … 1088 1088 return; 1089 1089 1090 ASSERT(!m_pendingNavigationID); 1091 if (!item->isInPageCache()) 1092 m_pendingNavigationID = navigationID; 1093 1090 1094 m_page->goToItem(item, FrameLoadTypeForward); 1091 1095 } 1092 1096 1093 void WebPage::goBack(uint64_t backForwardItemID)1097 void WebPage::goBack(uint64_t navigationID, uint64_t backForwardItemID) 1094 1098 { 1095 1099 SendStopResponsivenessTimer stopper(this); … … 1100 1104 return; 1101 1105 1106 ASSERT(!m_pendingNavigationID); 1107 if (!item->isInPageCache()) 1108 m_pendingNavigationID = navigationID; 1109 1102 1110 m_page->goToItem(item, FrameLoadTypeBack); 1103 1111 } 1104 1112 1105 void WebPage::goToBackForwardItem(uint64_t backForwardItemID)1113 void WebPage::goToBackForwardItem(uint64_t navigationID, uint64_t backForwardItemID) 1106 1114 { 1107 1115 SendStopResponsivenessTimer stopper(this); … … 1111 1119 if (!item) 1112 1120 return; 1121 1122 ASSERT(!m_pendingNavigationID); 1123 if (!item->isInPageCache()) 1124 m_pendingNavigationID = navigationID; 1113 1125 1114 1126 m_page->goToItem(item, FrameLoadTypeIndexedBackForward); … … 1955 1967 } 1956 1968 1957 void WebPage::restoreSessionAndNavigateToCurrentItem( const SessionState& sessionState)1969 void WebPage::restoreSessionAndNavigateToCurrentItem(uint64_t navigationID, const SessionState& sessionState) 1958 1970 { 1959 1971 if (uint64_t currentItemID = restoreSession(sessionState)) 1960 goToBackForwardItem( currentItemID);1972 goToBackForwardItem(navigationID, currentItemID); 1961 1973 } 1962 1974 -
branches/safari-538.34.5-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h
r169056 r169059 856 856 void loadWebArchiveData(const IPC::DataReference&, IPC::MessageDecoder&); 857 857 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); 861 861 void tryRestoreScrollPosition(); 862 862 void setActive(bool); … … 891 891 892 892 uint64_t restoreSession(const SessionState&); 893 void restoreSessionAndNavigateToCurrentItem( const SessionState&);893 void restoreSessionAndNavigateToCurrentItem(uint64_t navigationID, const SessionState&); 894 894 895 895 void didRemoveBackForwardItem(uint64_t); -
branches/safari-538.34.5-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r168934 r169059 105 105 CenterSelectionInVisibleArea() 106 106 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) 110 110 TryRestoreScrollPosition() 111 111 … … 124 124 125 125 RestoreSession(WebKit::SessionState state) 126 RestoreSessionAndNavigateToCurrentItem( WebKit::SessionState state)126 RestoreSessionAndNavigateToCurrentItem(uint64_t navigationID, WebKit::SessionState state) 127 127 128 128 DidRemoveBackForwardItem(uint64_t backForwardItemID) -
branches/safari-538.34.5-branch/Tools/ChangeLog
r168939 r169059 1 2014-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 1 25 2014-05-16 Lucas Forschler <lforschler@apple.com> 2 26 -
branches/safari-538.34.5-branch/Tools/MiniBrowser/mac/MiniBrowser_Prefix.pch
r124163 r169059 26 26 #ifdef __OBJC__ 27 27 #import <Cocoa/Cocoa.h> 28 #import <WebKit/WebKit.h> 28 29 #endif 29 30 #import <WebKit2/WebKit2_C.h>31 30 32 31 #define ENABLE_LOGGING 0 -
branches/safari-538.34.5-branch/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
r167476 r169059 412 412 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation 413 413 { 414 LOG(@"didStartProvisionalNavigation ");414 LOG(@"didStartProvisionalNavigation: %@", navigation); 415 415 } 416 416 417 417 - (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation 418 418 { 419 LOG(@"didReceiveServerRedirectForProvisionalNavigation ");419 LOG(@"didReceiveServerRedirectForProvisionalNavigation: %@", navigation); 420 420 } 421 421 422 422 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error 423 423 { 424 LOG(@"didFailProvisionalNavigation: %@ ", error);424 LOG(@"didFailProvisionalNavigation: %@navigation, error: %@", navigation, error); 425 425 } 426 426 427 427 - (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation 428 428 { 429 LOG(@"didCommitNavigation: %@", error);429 LOG(@"didCommitNavigation: %@", navigation); 430 430 } 431 431 432 432 - (void)webView:(WKWebView *)webView didFinishLoadingNavigation:(WKNavigation *)navigation 433 433 { 434 LOG(@"didFinishLoadingNavigation ");434 LOG(@"didFinishLoadingNavigation: %@", navigation); 435 435 } 436 436 437 437 - (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error 438 438 { 439 LOG(@"didFailNavigation: %@ ", error);439 LOG(@"didFailNavigation: %@, error %@", navigation, error); 440 440 } 441 441
Note:
See TracChangeset
for help on using the changeset viewer.