[iOS] WKWebView should not allow app links to be opened on back or forward navigation
authorcpugh@apple.com <cpugh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Dec 2016 22:50:28 +0000 (22:50 +0000)
committercpugh@apple.com <cpugh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Dec 2016 22:50:28 +0000 (22:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=165502

Reviewed by Dan Bernstein.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForNavigationAction): Add a condition to shouldOpenAppLinks
(which we use when creating a NavigationAction) that the navigationActionData is not a navigation
of type BackForward. This way, we don't open app links when a navigation is done via back or
forward.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209573 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebPageProxy.cpp

index d311fef..0417330 100644 (file)
@@ -1,3 +1,16 @@
+2016-12-08  Chelsea Pugh  <cpugh@apple.com>
+
+        [iOS] WKWebView should not allow app links to be opened on back or forward navigation
+        https://bugs.webkit.org/show_bug.cgi?id=165502
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::decidePolicyForNavigationAction): Add a condition to shouldOpenAppLinks
+        (which we use when creating a NavigationAction) that the navigationActionData is not a navigation
+        of type BackForward. This way, we don't open app links when a navigation is done via back or
+        forward.
+
 2016-12-08  Filip Pizlo  <fpizlo@apple.com>
 
         Enable SharedArrayBuffer, remove the flag
index 4ae79c6..c5a088a 100644 (file)
@@ -3662,7 +3662,7 @@ void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, const Secur
             sourceFrameInfo = API::FrameInfo::create(*originatingFrame, originatingFrameSecurityOrigin.securityOrigin());
 
         auto userInitiatedActivity = m_process->userInitiatedActivity(navigationActionData.userGestureTokenIdentifier);
-        bool shouldOpenAppLinks = !m_shouldSuppressAppLinksInNextNavigationPolicyDecision && (!destinationFrameInfo || destinationFrameInfo->isMainFrame()) && !hostsAreEqual(URL(ParsedURLString, m_mainFrame->url()), request.url());
+        bool shouldOpenAppLinks = !m_shouldSuppressAppLinksInNextNavigationPolicyDecision && (!destinationFrameInfo || destinationFrameInfo->isMainFrame()) && !hostsAreEqual(URL(ParsedURLString, m_mainFrame->url()), request.url()) && navigationActionData.navigationType != WebCore::NavigationType::BackForward;
 
         auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.get(), destinationFrameInfo.get(), request, originalRequest.url(), shouldOpenAppLinks, WTFMove(userInitiatedActivity));