Diff
Modified: trunk/Source/WebCore/ChangeLog (191486 => 191487)
--- trunk/Source/WebCore/ChangeLog 2015-10-22 23:31:53 UTC (rev 191486)
+++ trunk/Source/WebCore/ChangeLog 2015-10-23 00:09:20 UTC (rev 191487)
@@ -1,3 +1,17 @@
+2015-10-22 Sam Weinig <s...@webkit.org>
+
+ Navigations on the same host (but with different schemes and ports) should not trigger universal links
+ <rdar://problem/22811325>
+ https://bugs.webkit.org/show_bug.cgi?id=150481
+
+ Reviewed by Dan Bernstein.
+
+ Add new helper which efficiently compares the hosts of two URLs.
+
+ * platform/URL.cpp:
+ (WebCore::hostsAreEqual):
+ * platform/URL.h:
+
2015-10-22 Joseph Pecoraro <pecor...@apple.com>
Web Inspector: Remove unused Timeline GCEvent Record type
Modified: trunk/Source/WebCore/platform/URL.cpp (191486 => 191487)
--- trunk/Source/WebCore/platform/URL.cpp 2015-10-22 23:31:53 UTC (rev 191486)
+++ trunk/Source/WebCore/platform/URL.cpp 2015-10-23 00:09:20 UTC (rev 191487)
@@ -1597,6 +1597,23 @@
return true;
}
+bool hostsAreEqual(const URL& a, const URL& b)
+{
+ int hostStartA = a.hostStart();
+ int hostLengthA = a.hostEnd() - hostStartA;
+ int hostStartB = b.hostStart();
+ int hostLengthB = b.hostEnd() - hostStartB;
+ if (hostLengthA != hostLengthB)
+ return false;
+
+ for (int i = 0; i < hostLengthA; ++i) {
+ if (a.string()[hostStartA + i] != b.string()[hostStartB + i])
+ return false;
+ }
+
+ return true;
+}
+
String encodeWithURLEscapeSequences(const String& notEncodedString, PercentEncodeCharacterClass whatToEncode)
{
CString asUTF8 = notEncodedString.utf8();
Modified: trunk/Source/WebCore/platform/URL.h (191486 => 191487)
--- trunk/Source/WebCore/platform/URL.h 2015-10-22 23:31:53 UTC (rev 191486)
+++ trunk/Source/WebCore/platform/URL.h 2015-10-23 00:09:20 UTC (rev 191487)
@@ -233,6 +233,7 @@
WEBCORE_EXPORT bool equalIgnoringFragmentIdentifier(const URL&, const URL&);
WEBCORE_EXPORT bool protocolHostAndPortAreEqual(const URL&, const URL&);
+WEBCORE_EXPORT bool hostsAreEqual(const URL&, const URL&);
WEBCORE_EXPORT const URL& blankURL();
Modified: trunk/Source/WebKit/mac/ChangeLog (191486 => 191487)
--- trunk/Source/WebKit/mac/ChangeLog 2015-10-22 23:31:53 UTC (rev 191486)
+++ trunk/Source/WebKit/mac/ChangeLog 2015-10-23 00:09:20 UTC (rev 191487)
@@ -1,3 +1,15 @@
+2015-10-22 Sam Weinig <s...@webkit.org>
+
+ Navigations on the same host (but with different schemes and ports) should not trigger universal links
+ <rdar://problem/22811325>
+ https://bugs.webkit.org/show_bug.cgi?id=150481
+
+ Reviewed by Dan Bernstein.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (shouldTryAppLink):
+ Update the policy for following universal links to only take host into consideration.
+
2015-10-22 Gordon Sheridan <gordon_sheri...@apple.com>
Fix build for clang-700.0.59.5 by replacing deprecated calls to convert points between screen and window coordinates for Mac.
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (191486 => 191487)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm 2015-10-22 23:31:53 UTC (rev 191486)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm 2015-10-23 00:09:20 UTC (rev 191487)
@@ -887,7 +887,7 @@
if (!action.processingUserGesture())
return NO;
- if (targetFrame && targetFrame->document() && protocolHostAndPortAreEqual(targetFrame->document()->url(), action.url()))
+ if (targetFrame && targetFrame->document() && hostsAreEqual(targetFrame->document()->url(), action.url()))
return NO;
return YES;
Modified: trunk/Source/WebKit2/ChangeLog (191486 => 191487)
--- trunk/Source/WebKit2/ChangeLog 2015-10-22 23:31:53 UTC (rev 191486)
+++ trunk/Source/WebKit2/ChangeLog 2015-10-23 00:09:20 UTC (rev 191487)
@@ -1,3 +1,23 @@
+2015-10-22 Sam Weinig <s...@webkit.org>
+
+ Navigations on the same host (but with different schemes and ports) should not trigger universal links
+ <rdar://problem/22811325>
+ https://bugs.webkit.org/show_bug.cgi?id=150481
+
+ Reviewed by Dan Bernstein.
+
+ Update the policy for following universal links to only take host into consideration.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageUIClient):
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::UIClient::createNewPage):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+ (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
+ (WebKit::WebPageProxy::createNewPage):
+ (WebKit::WebPageProxy::showPage):
+
2015-10-22 Anders Carlsson <ander...@apple.com>
Simplify menu creation
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (191486 => 191487)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2015-10-22 23:31:53 UTC (rev 191486)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2015-10-23 00:09:20 UTC (rev 191487)
@@ -1579,7 +1579,7 @@
auto sourceFrameInfo = API::FrameInfo::create(*initiatingFrame, securityOriginData.securityOrigin());
- bool shouldOpenAppLinks = !protocolHostAndPortAreEqual(WebCore::URL(WebCore::ParsedURLString, initiatingFrame->url()), resourceRequest.url());
+ bool shouldOpenAppLinks = !hostsAreEqual(WebCore::URL(WebCore::ParsedURLString, initiatingFrame->url()), resourceRequest.url());
auto apiNavigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.ptr(), nullptr, resourceRequest, WebCore::URL(), shouldOpenAppLinks);
auto apiWindowFeatures = API::WindowFeatures::create(windowFeatures);
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (191486 => 191487)
--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm 2015-10-22 23:31:53 UTC (rev 191486)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm 2015-10-23 00:09:20 UTC (rev 191487)
@@ -111,7 +111,7 @@
auto sourceFrameInfo = API::FrameInfo::create(*initiatingFrame, securityOriginData.securityOrigin());
- bool shouldOpenAppLinks = !protocolHostAndPortAreEqual(WebCore::URL(WebCore::ParsedURLString, initiatingFrame->url()), request.url());
+ bool shouldOpenAppLinks = !hostsAreEqual(WebCore::URL(WebCore::ParsedURLString, initiatingFrame->url()), request.url());
auto apiNavigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.ptr(), nullptr, request, WebCore::URL(), shouldOpenAppLinks);
auto apiWindowFeatures = API::WindowFeatures::create(windowFeatures);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (191486 => 191487)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-10-22 23:31:53 UTC (rev 191486)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-10-23 00:09:20 UTC (rev 191487)
@@ -3301,7 +3301,7 @@
else if (originatingFrame)
sourceFrameInfo = API::FrameInfo::create(*originatingFrame, originatingFrameSecurityOrigin.securityOrigin());
- bool shouldOpenAppLinks = !m_shouldSuppressAppLinksInNextNavigationPolicyDecision && (!destinationFrameInfo || destinationFrameInfo->isMainFrame()) && !protocolHostAndPortAreEqual(URL(ParsedURLString, m_mainFrame->url()), request.url());
+ bool shouldOpenAppLinks = !m_shouldSuppressAppLinksInNextNavigationPolicyDecision && (!destinationFrameInfo || destinationFrameInfo->isMainFrame()) && !hostsAreEqual(URL(ParsedURLString, m_mainFrame->url()), request.url());
auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.get(), destinationFrameInfo.get(), request, originalRequest.url(), shouldOpenAppLinks);
@@ -3335,7 +3335,7 @@
if (frame)
sourceFrameInfo = API::FrameInfo::create(*frame, frameSecurityOrigin.securityOrigin());
- bool shouldOpenAppLinks = !protocolHostAndPortAreEqual(URL(ParsedURLString, m_mainFrame->url()), request.url());
+ bool shouldOpenAppLinks = !hostsAreEqual(URL(ParsedURLString, m_mainFrame->url()), request.url());
auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.get(), nullptr, request, request.url(), shouldOpenAppLinks);
m_navigationClient->decidePolicyForNavigationAction(*this, navigationAction.get(), WTF::move(listener), m_process->transformHandlesToObjects(userData.object()).get());
@@ -3506,7 +3506,7 @@
newPageParameters = newPage->creationParameters();
WebsiteDataStore::cloneSessionData(*this, *newPage);
- newPage->m_shouldSuppressAppLinksInNextNavigationPolicyDecision = protocolHostAndPortAreEqual(URL(ParsedURLString, mainFrameURL), request.url());
+ newPage->m_shouldSuppressAppLinksInNextNavigationPolicyDecision = hostsAreEqual(URL(ParsedURLString, mainFrameURL), request.url());
}
void WebPageProxy::showPage()
Modified: trunk/Tools/ChangeLog (191486 => 191487)
--- trunk/Tools/ChangeLog 2015-10-22 23:31:53 UTC (rev 191486)
+++ trunk/Tools/ChangeLog 2015-10-23 00:09:20 UTC (rev 191487)
@@ -1,3 +1,15 @@
+2015-10-22 Sam Weinig <s...@webkit.org>
+
+ Navigations on the same host (but with different schemes and ports) should not trigger universal links
+ <rdar://problem/22811325>
+ https://bugs.webkit.org/show_bug.cgi?id=150481
+
+ Reviewed by Dan Bernstein.
+
+ * TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm:
+ Update test to test that navigations on the same host but with different schemes does not
+ trigger universal links, but that changes in the host do.
+
2015-10-22 Ryosuke Niwa <rn...@webkit.org>
REGRESSION (r181972): Scroll position changes to top of youtube page when switching tabs
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm (191486 => 191487)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm 2015-10-22 23:31:53 UTC (rev 191486)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm 2015-10-23 00:09:20 UTC (rev 191487)
@@ -80,7 +80,7 @@
[webView setNavigationDelegate:controller.get()];
[webView setUIDelegate:controller.get()];
- [webView loadHTMLString:@"<body _onclick_=\"window.open('http://webkit.org/destination')\">" baseURL:[NSURL URLWithString:@"http://webkit.org"]];
+ [webView loadHTMLString:@"<body _onclick_=\"window.open('https://webkit.org/destination')\">" baseURL:[NSURL URLWithString:@"http://webkit.org"]];
TestWebKitAPI::Util::run(&finishedNavigation);
finishedNavigation = false;
@@ -91,7 +91,7 @@
TestWebKitAPI::Util::run(&createdWebView);
createdWebView = false;
- // User-initiated window.open to the same scheme, host and port should allow external schemes but not App Links.
+ // User-initiated window.open to the same host should allow external schemes but not App Links.
ASSERT_TRUE([action _shouldOpenExternalSchemes]);
ASSERT_FALSE([action _shouldOpenAppLinks]);
@@ -100,11 +100,11 @@
TestWebKitAPI::Util::run(&decidedPolicy);
decidedPolicy = false;
- // User-initiated window.open to the same scheme, host and port should allow external schemes but not App Links.
+ // User-initiated window.open to the same host should allow external schemes but not App Links.
ASSERT_TRUE([action _shouldOpenExternalSchemes]);
ASSERT_FALSE([action _shouldOpenAppLinks]);
- [webView loadHTMLString:@"<body _onclick_=\"window.open('https://webkit.org/destination')\">" baseURL:[NSURL URLWithString:@"http://webkit.org"]];
+ [webView loadHTMLString:@"<body _onclick_=\"window.open('http://apple.com/destination')\">" baseURL:[NSURL URLWithString:@"http://webkit.org"]];
TestWebKitAPI::Util::run(&finishedNavigation);
finishedNavigation = false;
@@ -113,7 +113,7 @@
TestWebKitAPI::Util::run(&createdWebView);
createdWebView = false;
- // User-initiated window.open to different scheme, host or port should allow external schemes and App Links.
+ // User-initiated window.open to different host should allow external schemes and App Links.
ASSERT_TRUE([action _shouldOpenExternalSchemes]);
ASSERT_TRUE([action _shouldOpenAppLinks]);
@@ -122,7 +122,7 @@
TestWebKitAPI::Util::run(&decidedPolicy);
decidedPolicy = false;
- // User-initiated window.open to different scheme, host or port should allow external schemes and App Links.
+ // User-initiated window.open to different host should allow external schemes and App Links.
ASSERT_TRUE([action _shouldOpenExternalSchemes]);
ASSERT_TRUE([action _shouldOpenAppLinks]);
@@ -141,7 +141,7 @@
[webView setNavigationDelegate:controller.get()];
[webView setUIDelegate:controller.get()];
- [webView loadHTMLString:@"<a style=\"display: block; height: 100%\" href="" target=\"_blank\">" baseURL:[NSURL URLWithString:@"http://webkit.org"]];
+ [webView loadHTMLString:@"<a style=\"display: block; height: 100%\" href="" target=\"_blank\">" baseURL:[NSURL URLWithString:@"http://webkit.org"]];
TestWebKitAPI::Util::run(&finishedNavigation);
finishedNavigation = false;
@@ -153,14 +153,14 @@
TestWebKitAPI::Util::run(&decidedPolicy);
decidedPolicy = false;
- // User-initiated targeted navigation to the same scheme, host and port should allow external schemes but not App Links.
+ // User-initiated targeted navigation to the same host should allow external schemes but not App Links.
ASSERT_TRUE([action _shouldOpenExternalSchemes]);
ASSERT_FALSE([action _shouldOpenAppLinks]);
TestWebKitAPI::Util::run(&createdWebView);
createdWebView = false;
- // User-initiated targeted navigation to the same scheme, host and port should allow external schemes but not App Links.
+ // User-initiated targeted navigation to the same host should allow external schemes but not App Links.
ASSERT_TRUE([action _shouldOpenExternalSchemes]);
ASSERT_FALSE([action _shouldOpenAppLinks]);
@@ -169,11 +169,11 @@
TestWebKitAPI::Util::run(&decidedPolicy);
decidedPolicy = false;
- // User-initiated targeted navigation to the same scheme, host and port should allow external schemes but not App Links.
+ // User-initiated targeted navigation to the same host should allow external schemes but not App Links.
ASSERT_TRUE([action _shouldOpenExternalSchemes]);
ASSERT_FALSE([action _shouldOpenAppLinks]);
- [webView loadHTMLString:@"<a style=\"display: block; height: 100%\" href="" target=\"_blank\">" baseURL:[NSURL URLWithString:@"http://webkit.org"]];
+ [webView loadHTMLString:@"<a style=\"display: block; height: 100%\" href="" target=\"_blank\">" baseURL:[NSURL URLWithString:@"http://webkit.org"]];
TestWebKitAPI::Util::run(&finishedNavigation);
finishedNavigation = false;
@@ -183,14 +183,14 @@
TestWebKitAPI::Util::run(&decidedPolicy);
decidedPolicy = false;
- // User-initiated targeted navigation to different scheme, host or port should allow external schemes and App Links.
+ // User-initiated targeted navigation to different host should allow external schemes and App Links.
ASSERT_TRUE([action _shouldOpenExternalSchemes]);
ASSERT_TRUE([action _shouldOpenAppLinks]);
TestWebKitAPI::Util::run(&createdWebView);
createdWebView = false;
- // User-initiated targeted navigation to different scheme, host or port should allow external schemes and App Links.
+ // User-initiated targeted navigation to different host should allow external schemes and App Links.
ASSERT_TRUE([action _shouldOpenExternalSchemes]);
ASSERT_TRUE([action _shouldOpenAppLinks]);
@@ -199,7 +199,7 @@
TestWebKitAPI::Util::run(&decidedPolicy);
decidedPolicy = false;
- // User-initiated targeted navigation to different scheme, host or port should allow external schemes and App Links.
+ // User-initiated targeted navigation to different host should allow external schemes and App Links.
ASSERT_TRUE([action _shouldOpenExternalSchemes]);
ASSERT_TRUE([action _shouldOpenAppLinks]);