Diff
Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (191494 => 191495)
--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-10-23 08:39:01 UTC (rev 191494)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-10-23 14:07:12 UTC (rev 191495)
@@ -1,3 +1,21 @@
+2015-10-23 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r191487. rdar://problem/22811325
+
+ 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-20 Matthew Hanson <matthew_han...@apple.com>
Merge r191357. rdar://problem/23103005
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/URL.cpp (191494 => 191495)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/URL.cpp 2015-10-23 08:39:01 UTC (rev 191494)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/URL.cpp 2015-10-23 14:07:12 UTC (rev 191495)
@@ -1592,6 +1592,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: branches/safari-601.1.46-branch/Source/WebCore/platform/URL.h (191494 => 191495)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/URL.h 2015-10-23 08:39:01 UTC (rev 191494)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/URL.h 2015-10-23 14:07:12 UTC (rev 191495)
@@ -232,6 +232,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: branches/safari-601.1.46-branch/Source/WebKit/mac/ChangeLog (191494 => 191495)
--- branches/safari-601.1.46-branch/Source/WebKit/mac/ChangeLog 2015-10-23 08:39:01 UTC (rev 191494)
+++ branches/safari-601.1.46-branch/Source/WebKit/mac/ChangeLog 2015-10-23 14:07:12 UTC (rev 191495)
@@ -1,3 +1,19 @@
+2015-10-23 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r191487. rdar://problem/22811325
+
+ 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-15 Matthew Hanson <matthew_han...@apple.com>
Rollout r188486. rdar://problem/22707497
Modified: branches/safari-601.1.46-branch/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (191494 => 191495)
--- branches/safari-601.1.46-branch/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm 2015-10-23 08:39:01 UTC (rev 191494)
+++ branches/safari-601.1.46-branch/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm 2015-10-23 14:07:12 UTC (rev 191495)
@@ -885,7 +885,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: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (191494 => 191495)
--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog 2015-10-23 08:39:01 UTC (rev 191494)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog 2015-10-23 14:07:12 UTC (rev 191495)
@@ -1,3 +1,27 @@
+2015-10-23 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r191487. rdar://problem/22811325
+
+ 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-20 Matthew Hanson <matthew_han...@apple.com>
Merge r191063. rdar://problem/22900764
Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (191494 => 191495)
--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm 2015-10-23 08:39:01 UTC (rev 191494)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm 2015-10-23 14:07:12 UTC (rev 191495)
@@ -113,7 +113,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 navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.ptr(), nullptr, request, WebCore::URL(), shouldOpenAppLinks);
RetainPtr<WKWebView> webView = [delegate.get() webView:m_uiDelegate.m_webView createWebViewWithConfiguration:configuration.get() forNavigationAction:wrapper(navigationAction) windowFeatures:adoptNS([[WKWindowFeatures alloc] _initWithWindowFeatures:windowFeatures]).get()];
Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (191494 => 191495)
--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-10-23 08:39:01 UTC (rev 191494)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-10-23 14:07:12 UTC (rev 191495)
@@ -3334,7 +3334,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);
@@ -3368,7 +3368,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());
@@ -3539,7 +3539,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: branches/safari-601.1.46-branch/Tools/ChangeLog (191494 => 191495)
--- branches/safari-601.1.46-branch/Tools/ChangeLog 2015-10-23 08:39:01 UTC (rev 191494)
+++ branches/safari-601.1.46-branch/Tools/ChangeLog 2015-10-23 14:07:12 UTC (rev 191495)
@@ -1,3 +1,19 @@
+2015-10-23 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r191487. rdar://problem/22811325
+
+ 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-21 Matthew Hanson <matthew_han...@apple.com>
Merge r191395. rdar://problem/22846455
Modified: branches/safari-601.1.46-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm (191494 => 191495)
--- branches/safari-601.1.46-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm 2015-10-23 08:39:01 UTC (rev 191494)
+++ branches/safari-601.1.46-branch/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm 2015-10-23 14:07:12 UTC (rev 191495)
@@ -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]);