Changeset 169016 in webkit
- Timestamp:
- May 18, 2014, 12:33:58 PM (12 years ago)
- Location:
- trunk
- 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
-
trunk/Source/WebKit2/ChangeLog
r169012 r169016 1 2014-05-18 Anders Carlsson <andersca@apple.com> 2 3 Implement Navigations for all methods declared returning one 4 https://bugs.webkit.org/show_bug.cgi?id=133048 5 <rdar://problem/16830064> 6 7 Reviewed by Sam Weinig. 8 9 * UIProcess/API/Cocoa/WKWebView.mm: 10 (-[WKWebView goToBackForwardListItem:]): 11 (-[WKWebView goBack]): 12 (-[WKWebView goForward]): 13 (-[WKWebView reload]): 14 (-[WKWebView reloadFromOrigin]): 15 Create and return navigations. 16 17 (-[WKWebView _reload]): 18 Call -[WKWebView reload]. 19 20 * UIProcess/Cocoa/NavigationState.h: 21 * UIProcess/Cocoa/NavigationState.mm: 22 (WebKit::NavigationState::createBackForwardNavigation): 23 Create a back/forward navigation. 24 25 (WebKit::NavigationState::createReloadNavigation): 26 Create a reload navigation. 27 28 * UIProcess/WebPageProxy.cpp: 29 (WebKit::WebPageProxy::reattachToWebProcessWithItem): 30 Generate a navigation ID and send it with the GoToBackForwardItem message. 31 32 (WebKit::WebPageProxy::reload): 33 Return a navigation ID. 34 35 (WebKit::WebPageProxy::goForward): 36 Generate a navigation ID and send it with the GoForward message. 37 38 (WebKit::WebPageProxy::goBack): 39 Generate a navigation ID and send it with the GoBack message. 40 41 (WebKit::WebPageProxy::goToBackForwardItem): 42 Generate a navigation ID and send it with the GoToBackForwardItem message. 43 44 * UIProcess/WebPageProxy.h: 45 Return navigation IDs where appropriate. 46 47 * UIProcess/cf/WebPageProxyCF.cpp: 48 (WebKit::WebPageProxy::restoreFromSessionStateData): 49 Generate a navigation ID and send it with the RestoreSessionAndNavigateToCurrentItem message. 50 51 * WebProcess/WebPage/WebPage.cpp: 52 (WebKit::WebPage::goForward): 53 (WebKit::WebPage::goBack): 54 (WebKit::WebPage::goToBackForwardItem): 55 Set up the pending navigation ID. 56 57 (WebKit::WebPage::restoreSessionAndNavigateToCurrentItem): 58 Call goToBackForwardItem with a navigation ID. 59 60 * WebProcess/WebPage/WebPage.h: 61 Add navigation IDs. 62 63 * WebProcess/WebPage/WebPage.messages.in: 64 Add navigation IDs. 65 1 66 2014-05-18 Commit Queue <commit-queue@webkit.org> 2 67 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r169012 r169016 289 289 - (WKNavigation *)goToBackForwardListItem:(WKBackForwardListItem *)item 290 290 { 291 _page->goToBackForwardItem(&item._item); 292 293 // FIXME: return a WKNavigation object. 294 return nil; 291 uint64_t navigationID = _page->goToBackForwardItem(&item._item); 292 293 auto navigation = _navigationState->createBackForwardNavigation(navigationID, item._item); 294 295 return [navigation.leakRef() autorelease]; 295 296 } 296 297 … … 334 335 - (WKNavigation *)goBack 335 336 { 336 _page->goBack(); 337 338 // FIXME: Return a navigation object. 339 return nil; 337 uint64_t navigationID = _page->goBack(); 338 if (!navigationID) 339 return nil; 340 341 ASSERT(_page->backForwardList().currentItem()); 342 auto navigation = _navigationState->createBackForwardNavigation(navigationID, *_page->backForwardList().currentItem()); 343 344 return [navigation.leakRef() autorelease]; 340 345 } 341 346 342 347 - (WKNavigation *)goForward 343 348 { 344 _page->goForward(); 345 346 // FIXME: Return a navigation object. 347 return nil; 349 uint64_t navigationID = _page->goForward(); 350 if (!navigationID) 351 return nil; 352 353 ASSERT(_page->backForwardList().currentItem()); 354 auto navigation = _navigationState->createBackForwardNavigation(navigationID, *_page->backForwardList().currentItem()); 355 356 return [navigation.leakRef() autorelease]; 348 357 } 349 358 350 359 - (WKNavigation *)reload 351 360 { 352 _page->reload(false); 353 354 // FIXME: Return a navigation object. 355 return nil; 361 uint64_t navigationID = _page->reload(false); 362 ASSERT(navigationID); 363 364 auto navigation = _navigationState->createReloadNavigation(navigationID); 365 return [navigation.leakRef() autorelease]; 356 366 } 357 367 358 368 - (WKNavigation *)reloadFromOrigin 359 369 { 360 _page->reload(true); 361 362 // FIXME: Return a navigation object. 363 return nil; 370 uint64_t navigationID = _page->reload(true); 371 ASSERT(navigationID); 372 373 auto navigation = _navigationState->createReloadNavigation(navigationID); 374 return [navigation.leakRef() autorelease]; 364 375 } 365 376 … … 1101 1112 - (WKNavigation *)_reload 1102 1113 { 1103 _page->reload(false); 1104 1105 // FIXME: return a WKNavigation object. 1106 return nil; 1114 return [self reload]; 1107 1115 } 1108 1116 -
trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h
r168441 r169016 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. -
trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm
r168690 r169016 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 { -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r168994 r169016 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 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r168994 r169016 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); … … 1207 1207 1208 1208 void reattachToWebProcess(); 1209 voidreattachToWebProcessWithItem(WebBackForwardListItem*);1209 uint64_t reattachToWebProcessWithItem(WebBackForwardListItem*); 1210 1210 1211 1211 void requestNotificationPermission(uint64_t notificationID, const String& originString); -
trunk/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
r164381 r169016 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 } -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r168994 r169016 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 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r168994 r169016 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); -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r168984 r169016 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) -
trunk/Tools/ChangeLog
r169002 r169016 1 2014-05-18 Anders Carlsson <andersca@apple.com> 2 3 Implement Navigations for all methods declared returning one 4 https://bugs.webkit.org/show_bug.cgi?id=133048 5 <rdar://problem/16830064> 6 7 Reviewed by Sam Weinig. 8 9 * MiniBrowser/mac/MiniBrowser_Prefix.pch: 10 Import WebKit.h. 11 12 * MiniBrowser/mac/WK2BrowserWindowController.m: 13 (-[WK2BrowserWindowController webView:didStartProvisionalNavigation:]): 14 (-[WK2BrowserWindowController webView:didReceiveServerRedirectForProvisionalNavigation:]): 15 (-[WK2BrowserWindowController webView:didFailProvisionalNavigation:withError:]): 16 (-[WK2BrowserWindowController webView:didCommitNavigation:]): 17 (-[WK2BrowserWindowController webView:didFinishLoadingNavigation:]): 18 (-[WK2BrowserWindowController webView:didFailNavigation:withError:]): 19 Print out the navigations. 20 1 21 2014-05-17 Zalan Bujtas <zalan@apple.com> 2 22 -
trunk/Tools/MiniBrowser/mac/MiniBrowser_Prefix.pch
r124163 r169016 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 -
trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
r169002 r169016 425 425 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation 426 426 { 427 LOG(@"didStartProvisionalNavigation ");427 LOG(@"didStartProvisionalNavigation: %@", navigation); 428 428 } 429 429 430 430 - (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation 431 431 { 432 LOG(@"didReceiveServerRedirectForProvisionalNavigation ");432 LOG(@"didReceiveServerRedirectForProvisionalNavigation: %@", navigation); 433 433 } 434 434 435 435 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error 436 436 { 437 LOG(@"didFailProvisionalNavigation: %@ ", error);437 LOG(@"didFailProvisionalNavigation: %@navigation, error: %@", navigation, error); 438 438 } 439 439 440 440 - (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation 441 441 { 442 LOG(@"didCommitNavigation: %@", error);442 LOG(@"didCommitNavigation: %@", navigation); 443 443 } 444 444 445 445 - (void)webView:(WKWebView *)webView didFinishLoadingNavigation:(WKNavigation *)navigation 446 446 { 447 LOG(@"didFinishLoadingNavigation ");447 LOG(@"didFinishLoadingNavigation: %@", navigation); 448 448 } 449 449 450 450 - (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error 451 451 { 452 LOG(@"didFailNavigation: %@ ", error);452 LOG(@"didFailNavigation: %@, error %@", navigation, error); 453 453 } 454 454
Note:
See TracChangeset
for help on using the changeset viewer.