Title: [186591] branches/safari-600.1.4.17-branch

Diff

Modified: branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog (186590 => 186591)


--- branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog	2015-07-09 08:58:49 UTC (rev 186590)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog	2015-07-09 14:41:30 UTC (rev 186591)
@@ -1,3 +1,33 @@
+2015-07-09  David Kilzer  <ddkil...@apple.com>
+
+        <rdar://problem/21716549> Donner: Safari URL And _javascript_ Prompt Origin Spoof Vulnerability
+
+        Merge r184151.
+
+    2015-05-11  Dan Bernstein  <m...@apple.com>
+
+        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-07-08  Lucas Forschler  <lforsch...@apple.com>
 
         Merge r186165. rdar://problem/21533207

Modified: branches/safari-600.1.4.17-branch/Source/WebCore/loader/DocumentLoader.cpp (186590 => 186591)


--- branches/safari-600.1.4.17-branch/Source/WebCore/loader/DocumentLoader.cpp	2015-07-09 08:58:49 UTC (rev 186590)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/loader/DocumentLoader.cpp	2015-07-09 14:41:30 UTC (rev 186591)
@@ -1389,8 +1389,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(), String());
     finishedLoading(monotonicallyIncreasingTime());

Modified: branches/safari-600.1.4.17-branch/Source/WebCore/loader/FrameLoaderClient.h (186590 => 186591)


--- branches/safari-600.1.4.17-branch/Source/WebCore/loader/FrameLoaderClient.h	2015-07-09 08:58:49 UTC (rev 186590)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/loader/FrameLoaderClient.h	2015-07-09 14:41:30 UTC (rev 186591)
@@ -153,6 +153,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: branches/safari-600.1.4.17-branch/Source/WebKit2/ChangeLog (186590 => 186591)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/ChangeLog	2015-07-09 08:58:49 UTC (rev 186590)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/ChangeLog	2015-07-09 14:41:30 UTC (rev 186591)
@@ -1,3 +1,38 @@
+2015-07-09  David Kilzer  <ddkil...@apple.com>
+
+        <rdar://problem/21716549> Donner: Safari URL And _javascript_ Prompt Origin Spoof Vulnerability
+
+        Merge r184151.
+
+        * UIProcess/FrameLoadState.h:
+        (WebKit::FrameLoadState::state):
+        (WebKit::FrameLoadState::url):
+        (WebKit::FrameLoadState::provisionalURL):
+        (WebKit::FrameLoadState::unreachableURL):
+        - Merge FrameLoadState getter methods from r183813.  Only
+          FrameLoadState::state() is used in this patch, but there may
+          be later patches that depend on these methods.
+
+    2015-05-11  Dan Bernstein  <m...@apple.com>
+
+        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-07-08  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r183861. rdar://problem/21716677

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/UIProcess/FrameLoadState.h (186590 => 186591)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/UIProcess/FrameLoadState.h	2015-07-09 08:58:49 UTC (rev 186590)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/UIProcess/FrameLoadState.h	2015-07-09 14:41:30 UTC (rev 186591)
@@ -51,7 +51,12 @@
 
     void didSameDocumentNotification(const String&);
 
+    State state() const { return m_state; }
+    const String& url() const { return m_url; }
+    const String& provisionalURL() const { return m_provisionalURL; }
+
     void setUnreachableURL(const String&);
+    const String& unreachableURL() const { return m_unreachableURL; }
 
     // FIXME: These should all be private, and FrameLoadState should
     // provide state transition member functions.

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (186590 => 186591)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-07-09 08:58:49 UTC (rev 186590)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-07-09 14:41:30 UTC (rev 186591)
@@ -2558,6 +2558,23 @@
     m_loaderClient->didReceiveServerRedirectForProvisionalLoadForFrame(this, frame, navigationID, userData.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 ResourceError& error, IPC::MessageDecoder& decoder)
 {
     RefPtr<API::Object> userData;

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/UIProcess/WebPageProxy.h (186590 => 186591)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2015-07-09 08:58:49 UTC (rev 186590)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2015-07-09 14:41:30 UTC (rev 186591)
@@ -959,6 +959,7 @@
 
     void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& url, const String& unreachableURL, IPC::MessageDecoder&);
     void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String&, IPC::MessageDecoder&);
+    void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, const String& url);
     void didFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const WebCore::ResourceError&, IPC::MessageDecoder&);
     void didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, IPC::MessageDecoder&);
     void didFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, IPC::MessageDecoder&);

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in (186590 => 186591)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2015-07-09 08:58:49 UTC (rev 186590)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2015-07-09 14:41:30 UTC (rev 186591)
@@ -128,6 +128,7 @@
     # Frame load messages
     DidStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String url, String unreachableURL, WebKit::InjectedBundleUserMessageEncoder userData) Variadic
     DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String url, WebKit::InjectedBundleUserMessageEncoder userData) Variadic
+    DidChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, String url)
     DidFailProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData) Variadic
     DidCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, String mimeType, bool hasCustomContentProvider, uint32_t loadType, WebCore::CertificateInfo certificateInfo, WebKit::InjectedBundleUserMessageEncoder userData) Variadic
     DidFailLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceError error, WebKit::InjectedBundleUserMessageEncoder userData) Variadic

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (186590 => 186591)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2015-07-09 08:58:49 UTC (rev 186590)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2015-07-09 14:41:30 UTC (rev 186591)
@@ -299,6 +299,16 @@
     webPage->send(Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), url, InjectedBundleUserMessageEncoder(userData.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: branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (186590 => 186591)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2015-07-09 08:58:49 UTC (rev 186590)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2015-07-09 14:41:30 UTC (rev 186591)
@@ -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: branches/safari-600.1.4.17-branch/Tools/ChangeLog (186590 => 186591)


--- branches/safari-600.1.4.17-branch/Tools/ChangeLog	2015-07-09 08:58:49 UTC (rev 186590)
+++ branches/safari-600.1.4.17-branch/Tools/ChangeLog	2015-07-09 14:41:30 UTC (rev 186591)
@@ -1,3 +1,20 @@
+2015-07-09  David Kilzer  <ddkil...@apple.com>
+
+        <rdar://problem/21716549> Donner: Safari URL And _javascript_ Prompt Origin Spoof Vulnerability
+
+        Merge r184151.
+
+    2015-05-11  Dan Bernstein  <m...@apple.com>
+
+        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-07-08  Lucas Forschler  <lforsch...@apple.com>
 
         Merge r184975. rdar://problem/21716564 
@@ -812,6 +829,18 @@
         Reviewed by Simon Fraser.
 
         * Scripts/webkitpy/layout_tests/models/test_run_results.py:
+2015-05-01  Dan Bernstein  <m...@apple.com>
+
+        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:]):
+
         * Scripts/webkitpy/layout_tests/views/buildbot_results.py:
         Count these as regressions, not as flaky tests.
 

Modified: branches/safari-600.1.4.17-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (186590 => 186591)


--- branches/safari-600.1.4.17-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2015-07-09 08:58:49 UTC (rev 186590)
+++ branches/safari-600.1.4.17-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2015-07-09 14:41:30 UTC (rev 186591)
@@ -82,6 +82,7 @@
 		3799AD3A14120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */; };
 		37A6895F148A9B50005100FA /* SubresourceErrorCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */; };
 		37C784E0197C8F2E0010A496 /* RenderedImageFromDOMNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37C784DE197C8F2E0010A496 /* RenderedImageFromDOMNode.mm */; };
+		37D36F321B004DD400BAF5D9 /* ProvisionalURLChange.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37D36F311B004DD400BAF5D9 /* ProvisionalURLChange.mm */; };
 		37DC678D140D7C5000ABCCDB /* DOMRangeOfString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37DC678B140D7C5000ABCCDB /* DOMRangeOfString.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 */; };
@@ -425,6 +426,7 @@
 		3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringByEvaluatingJavaScriptFromString.mm; sourceTree = "<group>"; };
 		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>"; };
+		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>"; };
@@ -710,6 +712,7 @@
 				A1A4FE5D18DD3DB700B5EA8A /* Download.mm */,
 				1ABC3DED1899BE6D004F0626 /* Navigation.mm */,
 				CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */,
+				37D36F311B004DD400BAF5D9 /* ProvisionalURLChange.mm */,
 				7CC3E1FA197E234100BE6252 /* UserContentController.mm */,
 			);
 			name = "WebKit2 Cocoa";
@@ -1231,6 +1234,7 @@
 				29AB8AA1164C735800D49BEC /* CustomProtocolsTest.mm in Sources */,
 				3776BC63150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm in Sources */,
 				939BA91714103412001A01BD /* DeviceScaleFactorOnBack.mm in Sources */,
+				37D36F321B004DD400BAF5D9 /* ProvisionalURLChange.mm in Sources */,
 				BCB68040126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp in Sources */,
 				37E1064D16976C8500B78BD0 /* DOMHTMLTableCellCellAbove.mm in Sources */,
 				7560917819259C59009EF06E /* MemoryCacheAddImageToCacheIOS.mm in Sources */,

Copied: branches/safari-600.1.4.17-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ProvisionalURLChange.mm (from rev 186577, branches/safari-600.1.4.17-branch/Source/WebKit2/UIProcess/FrameLoadState.h) (0 => 186591)


--- branches/safari-600.1.4.17-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ProvisionalURLChange.mm	                        (rev 0)
+++ branches/safari-600.1.4.17-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ProvisionalURLChange.mm	2015-07-09 14:41:30 UTC (rev 186591)
@@ -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
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to