Changeset 184151 in webkit
- Timestamp:
- May 11, 2015, 10:38:11 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r184150 r184151 1 2015-05-11 Dan Bernstein <mitz@apple.com> 2 3 WebCore part of <rdar://problem/20878075> Trying to navigate to an invalid URL loads about:blank, but -[WKWebView URL] returns the invalid URL 4 5 Reviewed by Alexey Proskuryakov. 6 7 Test: TestWebKitAPI/Tests/WebKit2Cocoa/ProvisionalURLChange.mm 8 9 In some cases, trying to navigate to an invalid URL results in navigation to about:blank. 10 When the about:blank load is committed, the UI process still thinks that the provisional 11 URL is the original, invalid URL, and updates its state to reflect that that’s the URL that 12 has been committed. 13 14 The provisional URL changes (1) when a provisional load begins, (2) when a server redirect 15 happens, (3) when the client changes the request in willSendRequest, and (4) in this 16 about:blank case. For (1) and (2), there are frame loader client callbacks. (3) is client- 17 initiated. So this patch addresses (4). 18 19 * loader/DocumentLoader.cpp: 20 (WebCore::DocumentLoader::maybeLoadEmpty): If our request URL is changing to about:blank and 21 while loading the main resource, call FrameLoaderClient::dispatchDidChangeProvisionalURL. 22 * loader/FrameLoaderClient.h: Added dispatchDidChangeProvisionalURL with an empty 23 implementation. 24 1 25 2015-05-11 Zalan Bujtas <zalan@apple.com> 2 26 -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r183555 r184151 1355 1355 return false; 1356 1356 1357 if (m_request.url().isEmpty() && !frameLoader()->stateMachine().creatingInitialEmptyDocument()) 1357 if (m_request.url().isEmpty() && !frameLoader()->stateMachine().creatingInitialEmptyDocument()) { 1358 1358 m_request.setURL(blankURL()); 1359 if (isLoadingMainResource()) 1360 frameLoader()->client().dispatchDidChangeProvisionalURL(); 1361 } 1362 1359 1363 String mimeType = shouldLoadEmpty ? "text/html" : frameLoader()->client().generatedMIMETypeForURLScheme(m_request.url().protocol()); 1360 1364 m_response = ResourceResponse(m_request.url(), mimeType, 0, String()); -
trunk/Source/WebCore/loader/FrameLoaderClient.h
r182351 r184151 155 155 virtual void dispatchDidHandleOnloadEvents() = 0; 156 156 virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() = 0; 157 virtual void dispatchDidChangeProvisionalURL() { } 157 158 virtual void dispatchDidCancelClientRedirect() = 0; 158 159 virtual void dispatchWillPerformClientRedirect(const URL&, double interval, double fireDate) = 0; -
trunk/Source/WebKit2/ChangeLog
r184149 r184151 1 2015-05-11 Dan Bernstein <mitz@apple.com> 2 3 WebKit2 part of <rdar://problem/20878075> Trying to navigate to an invalid URL loads about:blank, but -[WKWebView URL] returns the invalid URL 4 5 Reviewed by Alexey Proskuryakov. 6 7 * UIProcess/WebPageProxy.cpp: 8 (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): Added. Update internal state the 9 same way we update it for server redirects, but don’t make client callbacks. Clients 10 observing the URL property will see it change. 11 * UIProcess/WebPageProxy.h: 12 13 * UIProcess/WebPageProxy.messages.in: Added DidChangeProvisionalURLForFrame. 14 15 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 16 (WebKit::WebFrameLoaderClient::dispatchDidChangeProvisionalURL): Override this new 17 FrameLoaderClient function to send a DidChangeProvisionalURLForFrame message to the UI 18 process. 19 * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 20 1 21 2015-05-11 Dan Bernstein <mitz@apple.com> 2 22 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r184066 r184151 2839 2839 } 2840 2840 2841 void WebPageProxy::didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t, const String& url) 2842 { 2843 WebFrameProxy* frame = m_process->webFrame(frameID); 2844 MESSAGE_CHECK(frame); 2845 MESSAGE_CHECK(frame->frameLoadState().state() == FrameLoadState::State::Provisional); 2846 MESSAGE_CHECK_URL(url); 2847 2848 auto transaction = m_pageLoadState.transaction(); 2849 2850 // Internally, we handle this the same way we handle a server redirect. There are no client callbacks 2851 // for this, but if this is the main frame, clients may observe a change to the page's URL. 2852 if (frame->isMainFrame()) 2853 m_pageLoadState.didReceiveServerRedirectForProvisionalLoad(transaction, url); 2854 2855 frame->didReceiveServerRedirectForProvisionalLoad(url); 2856 } 2857 2841 2858 void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& provisionalURL, const ResourceError& error, const UserData& userData) 2842 2859 { -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r184011 r184151 1089 1089 void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& url, const String& unreachableURL, const UserData&); 1090 1090 void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String&, const UserData&); 1091 void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, const String& url); 1091 1092 void didFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&); 1092 1093 void didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, const UserData&); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r184011 r184151 130 130 DidStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String url, String unreachableURL, WebKit::UserData userData) 131 131 DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String url, WebKit::UserData userData) 132 DidChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, String url) 132 133 DidFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String provisionalURL, WebCore::ResourceError error, WebKit::UserData userData) 133 134 DidCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, String mimeType, bool hasCustomContentProvider, uint32_t loadType, WebCore::CertificateInfo certificateInfo, WebKit::UserData userData) -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r183698 r184151 295 295 } 296 296 297 void WebFrameLoaderClient::dispatchDidChangeProvisionalURL() 298 { 299 WebPage* webPage = m_frame->page(); 300 if (!webPage) 301 return; 302 303 WebDocumentLoader& documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().provisionalDocumentLoader()); 304 webPage->send(Messages::WebPageProxy::DidChangeProvisionalURLForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.url().string())); 305 } 306 297 307 void WebFrameLoaderClient::dispatchDidCancelClientRedirect() 298 308 { -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
r180985 r184151 81 81 virtual void dispatchDidHandleOnloadEvents() override; 82 82 virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() override; 83 virtual void dispatchDidChangeProvisionalURL() override; 83 84 virtual void dispatchDidCancelClientRedirect() override; 84 85 virtual void dispatchWillPerformClientRedirect(const WebCore::URL&, double interval, double fireDate) override; -
trunk/Tools/ChangeLog
r184146 r184151 1 2015-05-11 Dan Bernstein <mitz@apple.com> 2 3 Test for <rdar://problem/20878075> Trying to navigate to an invalid URL loads about:blank, but -[WKWebView URL] returns the invalid URL 4 5 Reviewed by Alexey Proskuryakov. 6 7 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 8 * TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm: Fixed copyright header. 9 * TestWebKitAPI/Tests/WebKit2Cocoa/ProvisionalURLChange.mm: Added. 10 (-[ProvisionalURLChangeController webView:didFinishNavigation:]): 11 1 12 2015-05-11 Jake Nielsen <jacob_nielsen@apple.com> 2 13 … … 812 823 813 824 * gtk/install-dependencies: 825 826 2015-05-01 Dan Bernstein <mitz@apple.com> 827 828 Test for <rdar://problem/8636045> Back/forward navigation to an error page in Safari breaks the back-forward list 829 https://bugs.webkit.org/show_bug.cgi?id=144501 830 831 Reviewed by Darin Adler. 832 833 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 834 * TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm: Added. 835 (-[LoadAlternateHTMLStringFromProvisionalLoadErrorController webView:didFailProvisionalNavigation:withError:]): 836 (-[LoadAlternateHTMLStringFromProvisionalLoadErrorController webView:didFinishNavigation:]): 814 837 815 838 2015-05-01 Mario Sanchez Prada <mario@endlessm.com> -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r183933 r184151 43 43 379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */; }; 44 44 37D36ED71AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */; }; 45 37D36F321B004DD400BAF5D9 /* ProvisionalURLChange.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37D36F311B004DD400BAF5D9 /* ProvisionalURLChange.mm */; }; 45 46 37DC6791140D7D7600ABCCDB /* DOMRangeOfString.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */; }; 46 47 37E1064C1697681800B78BD0 /* DOMHTMLTableCellElementCellAbove.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 37E1064B169767F700B78BD0 /* DOMHTMLTableCellElementCellAbove.html */; }; … … 491 492 37C784DE197C8F2E0010A496 /* RenderedImageFromDOMNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMNode.mm; sourceTree = "<group>"; }; 492 493 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LoadAlternateHTMLString.mm; sourceTree = "<group>"; }; 494 37D36F311B004DD400BAF5D9 /* ProvisionalURLChange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProvisionalURLChange.mm; sourceTree = "<group>"; }; 493 495 37DC678B140D7C5000ABCCDB /* DOMRangeOfString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMRangeOfString.mm; sourceTree = "<group>"; }; 494 496 37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DOMRangeOfString.html; sourceTree = "<group>"; }; … … 830 832 A1A4FE5D18DD3DB700B5EA8A /* Download.mm */, 831 833 2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */, 834 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */, 832 835 1ABC3DED1899BE6D004F0626 /* Navigation.mm */, 833 836 CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */, 834 837 C95501BE19AD2FAF0049BE3E /* Preferences.mm */, 838 37D36F311B004DD400BAF5D9 /* ProvisionalURLChange.mm */, 835 839 7CC3E1FA197E234100BE6252 /* UserContentController.mm */, 836 840 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */, 837 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */,838 841 ); 839 842 name = "WebKit2 Cocoa"; … … 1426 1429 7CCE7EBA1A411A7E00447C4C /* DeviceScaleFactorOnBack.mm in Sources */, 1427 1430 7CCE7EE91A411AE600447C4C /* DidAssociateFormControls.cpp in Sources */, 1431 37D36F321B004DD400BAF5D9 /* ProvisionalURLChange.mm in Sources */, 1428 1432 7CCE7EEA1A411AE600447C4C /* DidNotHandleKeyDown.cpp in Sources */, 1429 1433 7CCE7EEB1A411AE600447C4C /* DocumentStartUserScriptAlertCrash.cpp in Sources */, -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm
r183698 r184151 1 1 /* 2 * Copyright (C) 201 4Apple Inc. All rights reserved.2 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without
Note:
See TracChangeset
for help on using the changeset viewer.