- Revision
- 202329
- Author
- [email protected]
- Date
- 2016-06-22 09:55:49 -0700 (Wed, 22 Jun 2016)
Log Message
WKWebView with no WKNavigationDelegate does not follow universal links
<rdar://problem/24374110>
https://bugs.webkit.org/show_bug.cgi?id=158997
Reviewed by Dan Bernstein.
Source/WebKit2:
API Test:
WKWebView.DefaultNavigationDelegate
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
When initializing the WKWebView, set a default navigation client.
Tools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewDefaultNavigationDelegate.mm: Added.
Add a new test that shows that we have a default navigation delegate by swizzling
-[NSWorkspace openURL:]. This will only be called if there is a default client.
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (202328 => 202329)
--- trunk/Source/WebKit2/ChangeLog 2016-06-22 08:59:31 UTC (rev 202328)
+++ trunk/Source/WebKit2/ChangeLog 2016-06-22 16:55:49 UTC (rev 202329)
@@ -1,3 +1,18 @@
+2016-06-21 Sam Weinig <[email protected]>
+
+ WKWebView with no WKNavigationDelegate does not follow universal links
+ <rdar://problem/24374110>
+ https://bugs.webkit.org/show_bug.cgi?id=158997
+
+ Reviewed by Dan Bernstein.
+
+ API Test:
+ WKWebView.DefaultNavigationDelegate
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _initializeWithConfiguration:]):
+ When initializing the WKWebView, set a default navigation client.
+
2016-06-21 Chris Dumez <[email protected]>
Unreviewed, rolling out r202296.
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (202328 => 202329)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-06-22 08:59:31 UTC (rev 202328)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-06-22 16:55:49 UTC (rev 202329)
@@ -542,6 +542,8 @@
_page->setApplicationNameForUserAgent(applicationNameForUserAgent);
_navigationState = std::make_unique<WebKit::NavigationState>(self);
+ _page->setNavigationClient(_navigationState->createNavigationClient());
+
_uiDelegate = std::make_unique<WebKit::UIDelegate>(self);
_page->setFindClient(std::make_unique<WebKit::FindClient>(self));
_page->setDiagnosticLoggingClient(std::make_unique<WebKit::DiagnosticLoggingClient>(self));
Modified: trunk/Tools/ChangeLog (202328 => 202329)
--- trunk/Tools/ChangeLog 2016-06-22 08:59:31 UTC (rev 202328)
+++ trunk/Tools/ChangeLog 2016-06-22 16:55:49 UTC (rev 202329)
@@ -1,3 +1,16 @@
+2016-06-21 Sam Weinig <[email protected]>
+
+ WKWebView with no WKNavigationDelegate does not follow universal links
+ <rdar://problem/24374110>
+ https://bugs.webkit.org/show_bug.cgi?id=158997
+
+ Reviewed by Dan Bernstein.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewDefaultNavigationDelegate.mm: Added.
+ Add a new test that shows that we have a default navigation delegate by swizzling
+ -[NSWorkspace openURL:]. This will only be called if there is a default client.
+
2016-06-22 Per Arne Vollan <[email protected]>
[Win] Implement modal dialog support in MiniBrowser.
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (202328 => 202329)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-06-22 08:59:31 UTC (rev 202328)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-06-22 16:55:49 UTC (rev 202329)
@@ -100,6 +100,7 @@
7AE9E5091AE5AE8B00CF874B /* test.pdf in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7AE9E5081AE5AE8B00CF874B /* test.pdf */; };
7C3965061CDD74F90094DBB8 /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3965051CDD74F90094DBB8 /* Color.cpp */; };
7C3DB8E41D12129B00AE8CC3 /* CommandBackForward.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C3DB8E21D12129B00AE8CC3 /* CommandBackForward.mm */; };
+ 7C417F331D19E14800B8EF53 /* WKWebViewDefaultNavigationDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C417F311D19E14800B8EF53 /* WKWebViewDefaultNavigationDelegate.mm */; };
7C486BA11AA12567003F6F9B /* bundle-file.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7C486BA01AA1254B003F6F9B /* bundle-file.html */; };
7C54A4BE1AA11CCA00380F78 /* WKBundleFileHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C54A4BC1AA11CCA00380F78 /* WKBundleFileHandle.cpp */; };
7C54A4C11AA11CE400380F78 /* WKBundleFileHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C54A4BF1AA11CE400380F78 /* WKBundleFileHandle_Bundle.cpp */; };
@@ -752,6 +753,7 @@
7AE9E5081AE5AE8B00CF874B /* test.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = test.pdf; sourceTree = "<group>"; };
7C3965051CDD74F90094DBB8 /* Color.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Color.cpp; sourceTree = "<group>"; };
7C3DB8E21D12129B00AE8CC3 /* CommandBackForward.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CommandBackForward.mm; sourceTree = "<group>"; };
+ 7C417F311D19E14800B8EF53 /* WKWebViewDefaultNavigationDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewDefaultNavigationDelegate.mm; sourceTree = "<group>"; };
7C486BA01AA1254B003F6F9B /* bundle-file.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "bundle-file.html"; sourceTree = "<group>"; };
7C54A4BC1AA11CCA00380F78 /* WKBundleFileHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleFileHandle.cpp; sourceTree = "<group>"; };
7C54A4BF1AA11CE400380F78 /* WKBundleFileHandle_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleFileHandle_Bundle.cpp; sourceTree = "<group>"; };
@@ -1166,6 +1168,7 @@
7C882E051C80C624006BF731 /* UserContentWorldProtocol.h */,
93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */,
2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */,
+ 7C417F311D19E14800B8EF53 /* WKWebViewDefaultNavigationDelegate.mm */,
0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */,
9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */,
51714EB61CF8C7A4004723C4 /* WebProcessKillIDBCleanup.mm */,
@@ -2099,6 +2102,7 @@
7C83E0BB1D0A650000FEBCF3 /* FindInPage.mm in Sources */,
7CCE7EAF1A411A3800447C4C /* PlatformUtilities.cpp in Sources */,
0F139E781A423A6B00F590F5 /* PlatformUtilitiesCocoa.mm in Sources */,
+ 7C417F331D19E14800B8EF53 /* WKWebViewDefaultNavigationDelegate.mm in Sources */,
7CCE7EA61A411A0F00447C4C /* PlatformUtilitiesMac.mm in Sources */,
7CCE7EA71A411A1300447C4C /* PlatformWebViewMac.mm in Sources */,
7CCE7F261A411AF600447C4C /* Preferences.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewDefaultNavigationDelegate.mm (0 => 202329)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewDefaultNavigationDelegate.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewDefaultNavigationDelegate.mm 2016-06-22 16:55:49 UTC (rev 202329)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 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"
+
+#if WK_API_ENABLED
+#if PLATFORM(MAC)
+
+#import "InstanceMethodSwizzler.h"
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import <WebKit/WKWebView.h>
+
+static NSString *nonHTTPURLString = @"notreal:/hello";
+
+static bool isDone;
+
+static void newOpenURL(id self, SEL _cmd, NSURL* value)
+{
+ EXPECT_WK_STREQ(nonHTTPURLString, [value absoluteString]);
+ isDone = true;
+}
+
+TEST(WKWebView, DefaultNavigationDelegate)
+{
+ TestWebKitAPI::InstanceMethodSwizzler swizzle([NSWorkspace class], @selector(openURL:), reinterpret_cast<IMP>(newOpenURL));
+
+ WKWebView *webView = [[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)];
+
+ NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"notreal:/hello"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&isDone);
+}
+
+#endif
+#endif