<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[186664] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/186664">186664</a></dd>
<dt>Author</dt> <dd>mitz@apple.com</dd>
<dt>Date</dt> <dd>2015-07-09 22:18:53 -0700 (Thu, 09 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>
Source/WebCore:
WebCore part of Track and expose policies for external URL schemes and App Links separately
https://bugs.webkit.org/show_bug.cgi?id=146822

Reviewed by Anders Carlsson.

* loader/FrameLoaderTypes.h: Added ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes,
meaning external schemes are allowed but App Links are not. The opposite state doesn’t
exist.

* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected): Opening a link in a new window
or in the current window should never open it as an App Link.

Source/WebKit2:
WebKit2 part of Track and expose policies for external URL schemes and App Links separately
https://bugs.webkit.org/show_bug.cgi?id=146822

Reviewed by Anders Carlsson.

* Shared/NavigationActionData.cpp:
(WebKit::NavigationActionData::encode):
(WebKit::NavigationActionData::decode):
* Shared/NavigationActionData.h:
  Replaced the shouldOpenExternalURLsPolicy boolean member with a
  shouldOpenExternalURLsPolicy member whose type is ShouldOpenExternalURLsPolicy, and
  updated encoding and decoding:

* UIProcess/API/APINavigationAction.h:
  Added shouldOpenAppLinks boolean to NavigationAction::create and the constructor. It
  augments the policy in the NavigationActionData with a valude decided in the UI process.
  Replaced shouldOpenExternalURLs() with shouldOpenExternalSchemes() and
  shouldOpenAppLinks() which check the policy and the new m_shouldOpenAppLinks boolean.

* UIProcess/API/Cocoa/WKNavigationAction.mm:
(-[WKNavigationAction _shouldOpenExternalSchemes]): Getter for new property, calls through
  to the NavigationAction.
(-[WKNavigationAction _shouldOpenAppLinks]): Ditto.
(-[WKNavigationAction _shouldOpenExternalURLs]): Now deprecated and returns the
  _shouldOpenExternalSchemes value.
* UIProcess/API/Cocoa/WKNavigationActionPrivate.h: Declared new properties for the two
  policies and deprecated old property.

* UIProcess/Cocoa/NavigationState.mm:
(WebKit::tryAppLink): Changed to use NavigationAction::shouldOpenAppLinks, which
  encapsulates logic that used to be here.

* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::createNewPage): Allow App Links (if already allowed by policy).

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForNavigationAction): Moved logic from tryAppLink in
  NavigationState.mm here and pass the result to NavigationAction::create.
(WebKit::WebPageProxy::decidePolicyForNewWindowAction): Allow App Links (if already allowed
  by policy).
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::loadRequest): Changed the default policy to not allow App Links (but
  still allow external schemes).

* WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp:
(WKBundleNavigationActionGetShouldTryAppLinks): Added this getter.
* WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h:

* WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
(WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
* WebProcess/InjectedBundle/InjectedBundleNavigationAction.h:
  Added m_shouldTryAppLinks boolean member, initialized from the policy. Updated the
  initialization of m_shouldOpenExternalURLs to account for the new policy.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Pass the policy
  in the navigation data.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoaderTypesh">trunk/Source/WebCore/loader/FrameLoaderTypes.h</a></li>
<li><a href="#trunkSourceWebCorepageContextMenuControllercpp">trunk/Source/WebCore/page/ContextMenuController.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedNavigationActionDatacpp">trunk/Source/WebKit2/Shared/NavigationActionData.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedNavigationActionDatah">trunk/Source/WebKit2/Shared/NavigationActionData.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPINavigationActionh">trunk/Source/WebKit2/UIProcess/API/APINavigationAction.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKNavigationActionmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKNavigationActionPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationActionPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaNavigationStatemm">trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaUIDelegatemm">trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundleNavigationActioncpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundleNavigationActionPrivateh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundleNavigationActioncpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundleNavigationActionh">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebCore/ChangeLog        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-07-09  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        WebCore part of Track and expose policies for external URL schemes and App Links separately
+        https://bugs.webkit.org/show_bug.cgi?id=146822
+
+        Reviewed by Anders Carlsson.
+
+        * loader/FrameLoaderTypes.h: Added ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes,
+        meaning external schemes are allowed but App Links are not. The opposite state doesn’t
+        exist.
+
+        * page/ContextMenuController.cpp:
+        (WebCore::ContextMenuController::contextMenuItemSelected): Opening a link in a new window
+        or in the current window should never open it as an App Link.
+
</ins><span class="cx"> 2015-07-09  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fetching Content Security Policy report URL should respect same origin policy
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoaderTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoaderTypes.h (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoaderTypes.h        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebCore/loader/FrameLoaderTypes.h        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -73,6 +73,7 @@
</span><span class="cx"> 
</span><span class="cx"> enum class ShouldOpenExternalURLsPolicy {
</span><span class="cx">     ShouldNotAllow,
</span><ins>+    ShouldAllowExternalSchemes,
</ins><span class="cx">     ShouldAllow,
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageContextMenuControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ContextMenuController.cpp (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ContextMenuController.cpp        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebCore/page/ContextMenuController.cpp        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -238,7 +238,7 @@
</span><span class="cx"> 
</span><span class="cx">     switch (item-&gt;action()) {
</span><span class="cx">     case ContextMenuItemTagOpenLinkInNewWindow:
</span><del>-        openNewWindow(m_context.hitTestResult().absoluteLinkURL(), frame, ShouldOpenExternalURLsPolicy::ShouldAllow);
</del><ins>+        openNewWindow(m_context.hitTestResult().absoluteLinkURL(), frame, ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes);
</ins><span class="cx">         break;
</span><span class="cx">     case ContextMenuItemTagDownloadLinkToDisk:
</span><span class="cx">         // FIXME: Some day we should be able to do this from within WebCore. (Bug 117709)
</span><span class="lines">@@ -406,7 +406,7 @@
</span><span class="cx">             openNewWindow(m_context.hitTestResult().absoluteLinkURL(), frame, ShouldOpenExternalURLsPolicy::ShouldAllow);
</span><span class="cx">         break;
</span><span class="cx">     case ContextMenuItemTagOpenLinkInThisWindow:
</span><del>-        frame-&gt;loader().loadFrameRequest(FrameLoadRequest(frame-&gt;document()-&gt;securityOrigin(), ResourceRequest(m_context.hitTestResult().absoluteLinkURL(), frame-&gt;loader().outgoingReferrer()), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, ShouldOpenExternalURLsPolicy::ShouldAllow), nullptr, nullptr);
</del><ins>+        frame-&gt;loader().loadFrameRequest(FrameLoadRequest(frame-&gt;document()-&gt;securityOrigin(), ResourceRequest(m_context.hitTestResult().absoluteLinkURL(), frame-&gt;loader().outgoingReferrer()), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes), nullptr, nullptr);
</ins><span class="cx">         break;
</span><span class="cx">     case ContextMenuItemTagBold:
</span><span class="cx">         frame-&gt;editor().command(&quot;ToggleBold&quot;).execute();
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/ChangeLog        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -1,3 +1,63 @@
</span><ins>+2015-07-09  Dan Bernstein  &lt;mitz@apple.com&gt;
+
+        WebKit2 part of Track and expose policies for external URL schemes and App Links separately
+        https://bugs.webkit.org/show_bug.cgi?id=146822
+
+        Reviewed by Anders Carlsson.
+
+        * Shared/NavigationActionData.cpp:
+        (WebKit::NavigationActionData::encode):
+        (WebKit::NavigationActionData::decode):
+        * Shared/NavigationActionData.h:
+          Replaced the shouldOpenExternalURLsPolicy boolean member with a
+          shouldOpenExternalURLsPolicy member whose type is ShouldOpenExternalURLsPolicy, and
+          updated encoding and decoding:
+
+        * UIProcess/API/APINavigationAction.h:
+          Added shouldOpenAppLinks boolean to NavigationAction::create and the constructor. It
+          augments the policy in the NavigationActionData with a valude decided in the UI process.
+          Replaced shouldOpenExternalURLs() with shouldOpenExternalSchemes() and
+          shouldOpenAppLinks() which check the policy and the new m_shouldOpenAppLinks boolean.
+
+        * UIProcess/API/Cocoa/WKNavigationAction.mm:
+        (-[WKNavigationAction _shouldOpenExternalSchemes]): Getter for new property, calls through
+          to the NavigationAction.
+        (-[WKNavigationAction _shouldOpenAppLinks]): Ditto.
+        (-[WKNavigationAction _shouldOpenExternalURLs]): Now deprecated and returns the
+          _shouldOpenExternalSchemes value.
+        * UIProcess/API/Cocoa/WKNavigationActionPrivate.h: Declared new properties for the two
+          policies and deprecated old property.
+
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::tryAppLink): Changed to use NavigationAction::shouldOpenAppLinks, which
+          encapsulates logic that used to be here.
+
+        * UIProcess/Cocoa/UIDelegate.mm:
+        (WebKit::UIDelegate::UIClient::createNewPage): Allow App Links (if already allowed by policy).
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::decidePolicyForNavigationAction): Moved logic from tryAppLink in
+          NavigationState.mm here and pass the result to NavigationAction::create.
+        (WebKit::WebPageProxy::decidePolicyForNewWindowAction): Allow App Links (if already allowed
+          by policy).
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::loadRequest): Changed the default policy to not allow App Links (but
+          still allow external schemes).
+
+        * WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp:
+        (WKBundleNavigationActionGetShouldTryAppLinks): Added this getter.
+        * WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h:
+
+        * WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp:
+        (WebKit::InjectedBundleNavigationAction::InjectedBundleNavigationAction):
+        * WebProcess/InjectedBundle/InjectedBundleNavigationAction.h:
+          Added m_shouldTryAppLinks boolean member, initialized from the policy. Updated the
+          initialization of m_shouldOpenExternalURLs to account for the new policy.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Pass the policy
+          in the navigation data.
+
</ins><span class="cx"> 2015-07-09  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use CoreAnimation fences instead of synchronous IPC to synchronize resize
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedNavigationActionDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/NavigationActionData.cpp (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/NavigationActionData.cpp        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/Shared/NavigationActionData.cpp        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx">     encoder.encodeEnum(mouseButton);
</span><span class="cx">     encoder &lt;&lt; isProcessingUserGesture;
</span><span class="cx">     encoder &lt;&lt; canHandleRequest;
</span><del>-    encoder &lt;&lt; shouldOpenExternalURLs;
</del><ins>+    encoder.encodeEnum(shouldOpenExternalURLsPolicy);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool NavigationActionData::decode(IPC::ArgumentDecoder&amp; decoder, NavigationActionData&amp; result)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(result.canHandleRequest))
</span><span class="cx">         return false;
</span><del>-    if (!decoder.decode(result.shouldOpenExternalURLs))
</del><ins>+    if (!decoder.decodeEnum(result.shouldOpenExternalURLsPolicy))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     return true;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedNavigationActionDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/NavigationActionData.h (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/NavigationActionData.h        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/Shared/NavigationActionData.h        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">     WebMouseEvent::Button mouseButton { WebMouseEvent::NoButton };
</span><span class="cx">     bool isProcessingUserGesture { false };
</span><span class="cx">     bool canHandleRequest { false };
</span><del>-    bool shouldOpenExternalURLs { false };
</del><ins>+    WebCore::ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy { WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPINavigationActionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/APINavigationAction.h (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APINavigationAction.h        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/UIProcess/API/APINavigationAction.h        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -38,16 +38,17 @@
</span><span class="cx"> 
</span><span class="cx"> class NavigationAction final : public ObjectImpl&lt;Object::Type::NavigationAction&gt; {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;NavigationAction&gt; create(const WebKit::NavigationActionData&amp; navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, const WebCore::ResourceRequest&amp; request, const WebCore::URL&amp; originalURL)
</del><ins>+    static Ref&lt;NavigationAction&gt; create(const WebKit::NavigationActionData&amp; navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, const WebCore::ResourceRequest&amp; request, const WebCore::URL&amp; originalURL, bool shouldOpenAppLinks)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new NavigationAction(navigationActionData, sourceFrame, targetFrame, request, originalURL));
</del><ins>+        return adoptRef(*new NavigationAction(navigationActionData, sourceFrame, targetFrame, request, originalURL, shouldOpenAppLinks));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    NavigationAction(const WebKit::NavigationActionData&amp; navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, const WebCore::ResourceRequest&amp; request, const WebCore::URL&amp; originalURL)
</del><ins>+    NavigationAction(const WebKit::NavigationActionData&amp; navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, const WebCore::ResourceRequest&amp; request, const WebCore::URL&amp; originalURL, bool shouldOpenAppLinks)
</ins><span class="cx">         : m_sourceFrame(sourceFrame)
</span><span class="cx">         , m_targetFrame(targetFrame)
</span><span class="cx">         , m_request(request)
</span><span class="cx">         , m_originalURL(originalURL)
</span><ins>+        , m_shouldOpenAppLinks(shouldOpenAppLinks)
</ins><span class="cx">         , m_navigationActionData(navigationActionData)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="lines">@@ -63,7 +64,8 @@
</span><span class="cx">     WebKit::WebMouseEvent::Button mouseButton() const { return m_navigationActionData.mouseButton; }
</span><span class="cx">     bool isProcessingUserGesture() const { return m_navigationActionData.isProcessingUserGesture; }
</span><span class="cx">     bool canHandleRequest() const { return m_navigationActionData.canHandleRequest; }
</span><del>-    bool shouldOpenExternalURLs() const { return m_navigationActionData.shouldOpenExternalURLs; }
</del><ins>+    bool shouldOpenExternalSchemes() const { return m_navigationActionData.shouldOpenExternalURLsPolicy == WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow || m_navigationActionData.shouldOpenExternalURLsPolicy == WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes; }
+    bool shouldOpenAppLinks() const { return m_shouldOpenAppLinks &amp;&amp; m_navigationActionData.shouldOpenExternalURLsPolicy == WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow; }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     RefPtr&lt;FrameInfo&gt; m_sourceFrame;
</span><span class="lines">@@ -72,6 +74,8 @@
</span><span class="cx">     WebCore::ResourceRequest m_request;
</span><span class="cx">     WebCore::URL m_originalURL;
</span><span class="cx"> 
</span><ins>+    bool m_shouldOpenAppLinks;
+
</ins><span class="cx">     WebKit::NavigationActionData m_navigationActionData;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKNavigationActionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -172,9 +172,19 @@
</span><span class="cx">     return _navigationAction-&gt;canHandleRequest();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (BOOL)_shouldOpenExternalSchemes
+{
+    return _navigationAction-&gt;shouldOpenExternalSchemes();
+}
+
+- (BOOL)_shouldOpenAppLinks
+{
+    return _navigationAction-&gt;shouldOpenAppLinks();
+}
+
</ins><span class="cx"> - (BOOL)_shouldOpenExternalURLs
</span><span class="cx"> {
</span><del>-    return _navigationAction-&gt;shouldOpenExternalURLs();
</del><ins>+    return [self _shouldOpenExternalSchemes];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKNavigationActionPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationActionPrivate.h (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationActionPrivate.h        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationActionPrivate.h        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -32,8 +32,11 @@
</span><span class="cx"> @property (nonatomic, readonly) NSURL *_originalURL;
</span><span class="cx"> @property (nonatomic, readonly, getter=_isUserInitiated) BOOL _userInitiated;
</span><span class="cx"> @property (nonatomic, readonly) BOOL _canHandleRequest;
</span><del>-@property (nonatomic, readonly) BOOL _shouldOpenExternalURLs;
</del><ins>+@property (nonatomic, readonly) BOOL _shouldOpenExternalSchemes WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+@property (nonatomic, readonly) BOOL _shouldOpenAppLinks WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
</ins><span class="cx"> 
</span><ins>+@property (nonatomic, readonly) BOOL _shouldOpenExternalURLs WK_DEPRECATED(WK_MAC_TBA, WK_MAC_TBA, WK_IOS_TBA, WK_IOS_TBA, &quot;use _shouldOpenExternalSchemes and _shouldOpenAppLinks&quot;);
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaNavigationStatemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -248,20 +248,11 @@
</span><span class="cx"> static void tryAppLink(RefPtr&lt;API::NavigationAction&gt; navigationAction, const String&amp; currentMainFrameURL, std::function&lt;void (bool)&gt; completionHandler)
</span><span class="cx"> {
</span><span class="cx"> #if HAVE(APP_LINKS)
</span><del>-    bool mainFrameNavigation = !navigationAction-&gt;targetFrame() || navigationAction-&gt;targetFrame()-&gt;isMainFrame();
-    bool shouldOpenExternalURLs = navigationAction-&gt;shouldOpenExternalURLs();
-    if (!mainFrameNavigation || !shouldOpenExternalURLs) {
</del><ins>+    if (!navigationAction-&gt;shouldOpenAppLinks()) {
</ins><span class="cx">         completionHandler(false);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // If the new URL is within the same origin as the current URL, do not try to open it externally.
-    URL currentURL = URL(ParsedURLString, currentMainFrameURL);
-    if (protocolHostAndPortAreEqual(currentURL, navigationAction-&gt;request().url())) {
-        completionHandler(false);
-        return;
-    }
-
</del><span class="cx">     auto* localCompletionHandler = new std::function&lt;void (bool)&gt;(WTF::move(completionHandler));
</span><span class="cx">     [LSAppLink openWithURL:navigationAction-&gt;request().url() completionHandler:[localCompletionHandler](BOOL success, NSError *) {
</span><span class="cx">         dispatch_async(dispatch_get_main_queue(), [localCompletionHandler, success] {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaUIDelegatemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx">     [configuration _setRelatedWebView:m_uiDelegate.m_webView];
</span><span class="cx"> 
</span><span class="cx">     auto sourceFrameInfo = API::FrameInfo::create(*initiatingFrame, securityOriginData.securityOrigin());
</span><del>-    auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.ptr(), nullptr, request, WebCore::URL());
</del><ins>+    auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.ptr(), nullptr, request, WebCore::URL(), true);
</ins><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;WKWebView&gt; webView = [delegate.get() webView:m_uiDelegate.m_webView createWebViewWithConfiguration:configuration.get() forNavigationAction:wrapper(navigationAction) windowFeatures:adoptNS([[WKWindowFeatures alloc] _initWithWindowFeatures:windowFeatures]).get()];
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -3255,8 +3255,10 @@
</span><span class="cx">         else if (originatingFrame)
</span><span class="cx">             sourceFrameInfo = API::FrameInfo::create(*originatingFrame, originatingFrameSecurityOrigin.securityOrigin());
</span><span class="cx"> 
</span><del>-        auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.get(), destinationFrameInfo.get(), request, originalRequest.url());
</del><ins>+        bool shouldOpenAppLinks = (!destinationFrameInfo || destinationFrameInfo-&gt;isMainFrame()) &amp;&amp; !protocolHostAndPortAreEqual(URL(ParsedURLString, m_mainFrame-&gt;url()), request.url());
</ins><span class="cx"> 
</span><ins>+        auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.get(), destinationFrameInfo.get(), request, originalRequest.url(), shouldOpenAppLinks);
+
</ins><span class="cx">         m_navigationClient-&gt;decidePolicyForNavigationAction(*this, navigationAction.get(), WTF::move(listener), m_process-&gt;transformHandlesToObjects(userData.object()).get());
</span><span class="cx">     } else
</span><span class="cx">         m_policyClient-&gt;decidePolicyForNavigationAction(*this, frame, navigationActionData, originatingFrame, originalRequest, request, WTF::move(listener), m_process-&gt;transformHandlesToObjects(userData.object()).get());
</span><span class="lines">@@ -3284,7 +3286,7 @@
</span><span class="cx">         if (frame)
</span><span class="cx">             sourceFrameInfo = API::FrameInfo::create(*frame, frameSecurityOrigin.securityOrigin());
</span><span class="cx"> 
</span><del>-        auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.get(), nullptr, request, request.url());
</del><ins>+        auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.get(), nullptr, request, request.url(), true);
</ins><span class="cx"> 
</span><span class="cx">         m_navigationClient-&gt;decidePolicyForNavigationAction(*this, navigationAction.get(), WTF::move(listener), m_process-&gt;transformHandlesToObjects(userData.object()).get());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -363,7 +363,7 @@
</span><span class="cx">     bool tryClose();
</span><span class="cx">     bool isClosed() const { return m_isClosed; }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;API::Navigation&gt; loadRequest(const WebCore::ResourceRequest&amp;, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow, API::Object* userData = nullptr);
</del><ins>+    RefPtr&lt;API::Navigation&gt; loadRequest(const WebCore::ResourceRequest&amp;, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, API::Object* userData = nullptr);
</ins><span class="cx">     RefPtr&lt;API::Navigation&gt; loadFile(const String&amp; fileURL, const String&amp; resourceDirectoryURL, API::Object* userData = nullptr);
</span><span class="cx">     RefPtr&lt;API::Navigation&gt; loadData(API::Data*, const String&amp; MIMEType, const String&amp; encoding, const String&amp; baseURL, API::Object* userData = nullptr);
</span><span class="cx">     RefPtr&lt;API::Navigation&gt; loadHTMLString(const String&amp; htmlString, const String&amp; baseURL, API::Object* userData = nullptr);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundleNavigationActioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -71,3 +71,8 @@
</span><span class="cx"> {
</span><span class="cx">     return toImpl(navigationActionRef)-&gt;shouldOpenExternalURLs();
</span><span class="cx"> }
</span><ins>+
+bool WKBundleNavigationActionGetShouldTryAppLinks(WKBundleNavigationActionRef navigationActionRef)
+{
+    return toImpl(navigationActionRef)-&gt;shouldTryAppLinks();
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundleNavigationActionPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> WK_EXPORT bool WKBundleNavigationActionGetShouldOpenExternalURLs(WKBundleNavigationActionRef);
</span><ins>+WK_EXPORT bool WKBundleNavigationActionGetShouldTryAppLinks(WKBundleNavigationActionRef);
</ins><span class="cx"> 
</span><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundleNavigationActioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -90,7 +90,8 @@
</span><span class="cx">     : m_navigationType(navigationAction.type())
</span><span class="cx">     , m_modifiers(modifiersForNavigationAction(navigationAction))
</span><span class="cx">     , m_mouseButton(WebMouseEvent::NoButton)
</span><del>-    , m_shouldOpenExternalURLs(navigationAction.shouldOpenExternalURLsPolicy() == ShouldOpenExternalURLsPolicy::ShouldAllow)
</del><ins>+    , m_shouldOpenExternalURLs(navigationAction.shouldOpenExternalURLsPolicy() == ShouldOpenExternalURLsPolicy::ShouldAllow || navigationAction.shouldOpenExternalURLsPolicy() == ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes)
+    , m_shouldTryAppLinks(navigationAction.shouldOpenExternalURLsPolicy() == ShouldOpenExternalURLsPolicy::ShouldAllow)
</ins><span class="cx"> {
</span><span class="cx">     if (const MouseEvent* mouseEvent = mouseEventForNavigationAction(navigationAction)) {
</span><span class="cx">         m_hitTestResult = InjectedBundleHitTestResult::create(frame-&gt;coreFrame()-&gt;eventHandler().hitTestResultAtPoint(mouseEvent-&gt;absoluteLocation()));
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundleNavigationActionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx">     InjectedBundleNodeHandle* formElement() const { return m_formElement.get(); }
</span><span class="cx"> 
</span><span class="cx">     bool shouldOpenExternalURLs() const { return m_shouldOpenExternalURLs; }
</span><ins>+    bool shouldTryAppLinks() const { return m_shouldTryAppLinks; }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     InjectedBundleNavigationAction(WebFrame*, const WebCore::NavigationAction&amp;, PassRefPtr&lt;WebCore::FormState&gt;);
</span><span class="lines">@@ -67,6 +68,7 @@
</span><span class="cx">     RefPtr&lt;InjectedBundleHitTestResult&gt; m_hitTestResult;
</span><span class="cx">     RefPtr&lt;InjectedBundleNodeHandle&gt; m_formElement;
</span><span class="cx">     bool m_shouldOpenExternalURLs;
</span><ins>+    bool m_shouldTryAppLinks;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (186663 => 186664)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2015-07-10 05:10:18 UTC (rev 186663)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2015-07-10 05:18:53 UTC (rev 186664)
</span><span class="lines">@@ -801,7 +801,7 @@
</span><span class="cx">     navigationActionData.mouseButton = action-&gt;mouseButton();
</span><span class="cx">     navigationActionData.isProcessingUserGesture = navigationAction.processingUserGesture();
</span><span class="cx">     navigationActionData.canHandleRequest = webPage-&gt;canHandleRequest(request);
</span><del>-    navigationActionData.shouldOpenExternalURLs = navigationAction.shouldOpenExternalURLsPolicy() == ShouldOpenExternalURLsPolicy::ShouldAllow;
</del><ins>+    navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
</ins><span class="cx"> 
</span><span class="cx">     WebCore::Frame* coreFrame = m_frame-&gt;coreFrame();
</span><span class="cx">     WebDocumentLoader* documentLoader = static_cast&lt;WebDocumentLoader*&gt;(coreFrame-&gt;loader().policyDocumentLoader());
</span></span></pre>
</div>
</div>

</body>
</html>