Diff
Modified: trunk/Source/WebCore/ChangeLog (184150 => 184151)
--- trunk/Source/WebCore/ChangeLog 2015-05-12 04:01:50 UTC (rev 184150)
+++ trunk/Source/WebCore/ChangeLog 2015-05-12 05:38:11 UTC (rev 184151)
@@ -1,3 +1,27 @@
+2015-05-11 Dan Bernstein <[email protected]>
+
+ WebCore part of <rdar://problem/20878075> Trying to navigate to an invalid URL loads about:blank, but -[WKWebView URL] returns the invalid URL
+
+ Reviewed by Alexey Proskuryakov.
+
+ Test: TestWebKitAPI/Tests/WebKit2Cocoa/ProvisionalURLChange.mm
+
+ In some cases, trying to navigate to an invalid URL results in navigation to about:blank.
+ When the about:blank load is committed, the UI process still thinks that the provisional
+ URL is the original, invalid URL, and updates its state to reflect that that’s the URL that
+ has been committed.
+
+ The provisional URL changes (1) when a provisional load begins, (2) when a server redirect
+ happens, (3) when the client changes the request in willSendRequest, and (4) in this
+ about:blank case. For (1) and (2), there are frame loader client callbacks. (3) is client-
+ initiated. So this patch addresses (4).
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::maybeLoadEmpty): If our request URL is changing to about:blank and
+ while loading the main resource, call FrameLoaderClient::dispatchDidChangeProvisionalURL.
+ * loader/FrameLoaderClient.h: Added dispatchDidChangeProvisionalURL with an empty
+ implementation.
+
2015-05-11 Zalan Bujtas <[email protected]>
Text is misplaced when custom font does not have space glyph.
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (184150 => 184151)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2015-05-12 04:01:50 UTC (rev 184150)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2015-05-12 05:38:11 UTC (rev 184151)
@@ -1354,8 +1354,12 @@
if (!shouldLoadEmpty && !frameLoader()->client().representationExistsForURLScheme(m_request.url().protocol()))
return false;
- if (m_request.url().isEmpty() && !frameLoader()->stateMachine().creatingInitialEmptyDocument())
+ if (m_request.url().isEmpty() && !frameLoader()->stateMachine().creatingInitialEmptyDocument()) {
m_request.setURL(blankURL());
+ if (isLoadingMainResource())
+ frameLoader()->client().dispatchDidChangeProvisionalURL();
+ }
+
String mimeType = shouldLoadEmpty ? "text/html" : frameLoader()->client().generatedMIMETypeForURLScheme(m_request.url().protocol());
m_response = ResourceResponse(m_request.url(), mimeType, 0, String());
finishedLoading(monotonicallyIncreasingTime());
Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (184150 => 184151)
--- trunk/Source/WebCore/loader/FrameLoaderClient.h 2015-05-12 04:01:50 UTC (rev 184150)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h 2015-05-12 05:38:11 UTC (rev 184151)
@@ -154,6 +154,7 @@
virtual void dispatchDidHandleOnloadEvents() = 0;
virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() = 0;
+ virtual void dispatchDidChangeProvisionalURL() { }
virtual void dispatchDidCancelClientRedirect() = 0;
virtual void dispatchWillPerformClientRedirect(const URL&, double interval, double fireDate) = 0;
virtual void dispatchDidNavigateWithinPage() { }
Modified: trunk/Source/WebKit2/ChangeLog (184150 => 184151)
--- trunk/Source/WebKit2/ChangeLog 2015-05-12 04:01:50 UTC (rev 184150)
+++ trunk/Source/WebKit2/ChangeLog 2015-05-12 05:38:11 UTC (rev 184151)
@@ -1,5 +1,25 @@
2015-05-11 Dan Bernstein <[email protected]>
+ WebKit2 part of <rdar://problem/20878075> Trying to navigate to an invalid URL loads about:blank, but -[WKWebView URL] returns the invalid URL
+
+ Reviewed by Alexey Proskuryakov.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): Added. Update internal state the
+ same way we update it for server redirects, but don’t make client callbacks. Clients
+ observing the URL property will see it change.
+ * UIProcess/WebPageProxy.h:
+
+ * UIProcess/WebPageProxy.messages.in: Added DidChangeProvisionalURLForFrame.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDidChangeProvisionalURL): Override this new
+ FrameLoaderClient function to send a DidChangeProvisionalURLForFrame message to the UI
+ process.
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+
+2015-05-11 Dan Bernstein <[email protected]>
+
<rdar://problem/19773721> [iOS] Find on page feels like it zooms in too much
https://bugs.webkit.org/show_bug.cgi?id=144891
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (184150 => 184151)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-05-12 04:01:50 UTC (rev 184150)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-05-12 05:38:11 UTC (rev 184151)
@@ -2838,6 +2838,23 @@
m_loaderClient->didReceiveServerRedirectForProvisionalLoadForFrame(*this, *frame, navigation.get(), m_process->transformHandlesToObjects(userData.object()).get());
}
+void WebPageProxy::didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t, const String& url)
+{
+ WebFrameProxy* frame = m_process->webFrame(frameID);
+ MESSAGE_CHECK(frame);
+ MESSAGE_CHECK(frame->frameLoadState().state() == FrameLoadState::State::Provisional);
+ MESSAGE_CHECK_URL(url);
+
+ auto transaction = m_pageLoadState.transaction();
+
+ // Internally, we handle this the same way we handle a server redirect. There are no client callbacks
+ // for this, but if this is the main frame, clients may observe a change to the page's URL.
+ if (frame->isMainFrame())
+ m_pageLoadState.didReceiveServerRedirectForProvisionalLoad(transaction, url);
+
+ frame->didReceiveServerRedirectForProvisionalLoad(url);
+}
+
void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& provisionalURL, const ResourceError& error, const UserData& userData)
{
WebFrameProxy* frame = m_process->webFrame(frameID);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (184150 => 184151)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-05-12 04:01:50 UTC (rev 184150)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-05-12 05:38:11 UTC (rev 184151)
@@ -1088,6 +1088,7 @@
void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& url, const String& unreachableURL, const UserData&);
void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String&, const UserData&);
+ void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, const String& url);
void didFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&);
void didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, const UserData&);
void didFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (184150 => 184151)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2015-05-12 04:01:50 UTC (rev 184150)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2015-05-12 05:38:11 UTC (rev 184151)
@@ -129,6 +129,7 @@
# Frame load messages
DidStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String url, String unreachableURL, WebKit::UserData userData)
DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String url, WebKit::UserData userData)
+ DidChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, String url)
DidFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String provisionalURL, WebCore::ResourceError error, WebKit::UserData userData)
DidCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, String mimeType, bool hasCustomContentProvider, uint32_t loadType, WebCore::CertificateInfo certificateInfo, WebKit::UserData userData)
DidFailLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceError error, WebKit::UserData userData)
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (184150 => 184151)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2015-05-12 04:01:50 UTC (rev 184150)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2015-05-12 05:38:11 UTC (rev 184151)
@@ -294,6 +294,16 @@
webPage->send(Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), url, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
+void WebFrameLoaderClient::dispatchDidChangeProvisionalURL()
+{
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return;
+
+ WebDocumentLoader& documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().provisionalDocumentLoader());
+ webPage->send(Messages::WebPageProxy::DidChangeProvisionalURLForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.url().string()));
+}
+
void WebFrameLoaderClient::dispatchDidCancelClientRedirect()
{
WebPage* webPage = m_frame->page();
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (184150 => 184151)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2015-05-12 04:01:50 UTC (rev 184150)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2015-05-12 05:38:11 UTC (rev 184151)
@@ -80,6 +80,7 @@
virtual void dispatchDidHandleOnloadEvents() override;
virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() override;
+ virtual void dispatchDidChangeProvisionalURL() override;
virtual void dispatchDidCancelClientRedirect() override;
virtual void dispatchWillPerformClientRedirect(const WebCore::URL&, double interval, double fireDate) override;
virtual void dispatchDidChangeLocationWithinPage() override;
Modified: trunk/Tools/ChangeLog (184150 => 184151)
--- trunk/Tools/ChangeLog 2015-05-12 04:01:50 UTC (rev 184150)
+++ trunk/Tools/ChangeLog 2015-05-12 05:38:11 UTC (rev 184151)
@@ -1,3 +1,14 @@
+2015-05-11 Dan Bernstein <[email protected]>
+
+ Test for <rdar://problem/20878075> Trying to navigate to an invalid URL loads about:blank, but -[WKWebView URL] returns the invalid URL
+
+ Reviewed by Alexey Proskuryakov.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm: Fixed copyright header.
+ * TestWebKitAPI/Tests/WebKit2Cocoa/ProvisionalURLChange.mm: Added.
+ (-[ProvisionalURLChangeController webView:didFinishNavigation:]):
+
2015-05-11 Jake Nielsen <[email protected]>
Fix internal build configuration issues
@@ -812,6 +823,18 @@
* gtk/install-dependencies:
+2015-05-01 Dan Bernstein <[email protected]>
+
+ Test for <rdar://problem/8636045> Back/forward navigation to an error page in Safari breaks the back-forward list
+ https://bugs.webkit.org/show_bug.cgi?id=144501
+
+ Reviewed by Darin Adler.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm: Added.
+ (-[LoadAlternateHTMLStringFromProvisionalLoadErrorController webView:didFailProvisionalNavigation:withError:]):
+ (-[LoadAlternateHTMLStringFromProvisionalLoadErrorController webView:didFinishNavigation:]):
+
2015-05-01 Mario Sanchez Prada <[email protected]>
check-webkit-style fails due to system pylint
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (184150 => 184151)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2015-05-12 04:01:50 UTC (rev 184150)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2015-05-12 05:38:11 UTC (rev 184151)
@@ -42,6 +42,7 @@
378E64791632707400B6C676 /* link-with-title.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 378E647816326FDF00B6C676 /* link-with-title.html */; };
379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */; };
37D36ED71AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */; };
+ 37D36F321B004DD400BAF5D9 /* ProvisionalURLChange.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37D36F311B004DD400BAF5D9 /* ProvisionalURLChange.mm */; };
37DC6791140D7D7600ABCCDB /* DOMRangeOfString.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */; };
37E1064C1697681800B78BD0 /* DOMHTMLTableCellElementCellAbove.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 37E1064B169767F700B78BD0 /* DOMHTMLTableCellElementCellAbove.html */; };
4BFDFFA71314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFDFFA61314776C0061F24B /* HitTestResultNodeHandle_Bundle.cpp */; };
@@ -490,6 +491,7 @@
37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SubresourceErrorCrash.mm; sourceTree = "<group>"; };
37C784DE197C8F2E0010A496 /* RenderedImageFromDOMNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMNode.mm; sourceTree = "<group>"; };
37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LoadAlternateHTMLString.mm; sourceTree = "<group>"; };
+ 37D36F311B004DD400BAF5D9 /* ProvisionalURLChange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProvisionalURLChange.mm; sourceTree = "<group>"; };
37DC678B140D7C5000ABCCDB /* DOMRangeOfString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMRangeOfString.mm; sourceTree = "<group>"; };
37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DOMRangeOfString.html; sourceTree = "<group>"; };
37E1064A1697676400B78BD0 /* DOMHTMLTableCellCellAbove.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLTableCellCellAbove.mm; sourceTree = "<group>"; };
@@ -829,12 +831,13 @@
7CEFA9641AC0B9E200B910FD /* _WKUserContentExtensionStore.mm */,
A1A4FE5D18DD3DB700B5EA8A /* Download.mm */,
2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */,
+ 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */,
1ABC3DED1899BE6D004F0626 /* Navigation.mm */,
CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */,
C95501BE19AD2FAF0049BE3E /* Preferences.mm */,
+ 37D36F311B004DD400BAF5D9 /* ProvisionalURLChange.mm */,
7CC3E1FA197E234100BE6252 /* UserContentController.mm */,
0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */,
- 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */,
);
name = "WebKit2 Cocoa";
path = WebKit2Cocoa;
@@ -1425,6 +1428,7 @@
7CCE7EB91A411A7E00447C4C /* DeviceScaleFactorInDashboardRegions.mm in Sources */,
7CCE7EBA1A411A7E00447C4C /* DeviceScaleFactorOnBack.mm in Sources */,
7CCE7EE91A411AE600447C4C /* DidAssociateFormControls.cpp in Sources */,
+ 37D36F321B004DD400BAF5D9 /* ProvisionalURLChange.mm in Sources */,
7CCE7EEA1A411AE600447C4C /* DidNotHandleKeyDown.cpp in Sources */,
7CCE7EEB1A411AE600447C4C /* DocumentStartUserScriptAlertCrash.cpp in Sources */,
7CCE7EBB1A411A7E00447C4C /* DOMHTMLTableCellCellAbove.mm in Sources */,
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm (184150 => 184151)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm 2015-05-12 04:01:50 UTC (rev 184150)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LoadAlternateHTMLString.mm 2015-05-12 05:38:11 UTC (rev 184151)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ProvisionalURLChange.mm (0 => 184151)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ProvisionalURLChange.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ProvisionalURLChange.mm 2015-05-12 05:38:11 UTC (rev 184151)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import <wtf/RetainPtr.h>
+
+static bool isDone;
+
+@interface ProvisionalURLChangeController : NSObject <WKNavigationDelegate>
+@end
+
+@implementation ProvisionalURLChangeController
+
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
+{
+ isDone = true;
+}
+
+@end
+
+TEST(WKWebView, ProvisionalURLChange)
+{
+ auto webView = adoptNS([[WKWebView alloc] init]);
+ auto controller = adoptNS([[ProvisionalURLChangeController alloc] init]);
+ [webView setNavigationDelegate:controller.get()];
+
+ [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"data:text/html,start"]]];
+ TestWebKitAPI::Util::run(&isDone);
+ isDone = false;
+
+ [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.webkit.org!"]]];
+ TestWebKitAPI::Util::run(&isDone);
+ isDone = false;
+
+ EXPECT_STREQ([webView URL].absoluteString.UTF8String, "about:blank");
+}
+
+#endif