Title: [186664] trunk/Source
Revision
186664
Author
m...@apple.com
Date
2015-07-09 22:18:53 -0700 (Thu, 09 Jul 2015)

Log Message

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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (186663 => 186664)


--- 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)
@@ -1,3 +1,18 @@
+2015-07-09  Dan Bernstein  <m...@apple.com>
+
+        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.
+
 2015-07-09  Daniel Bates  <daba...@apple.com>
 
         Fetching Content Security Policy report URL should respect same origin policy

Modified: trunk/Source/WebCore/loader/FrameLoaderTypes.h (186663 => 186664)


--- 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)
@@ -73,6 +73,7 @@
 
 enum class ShouldOpenExternalURLsPolicy {
     ShouldNotAllow,
+    ShouldAllowExternalSchemes,
     ShouldAllow,
 };
 

Modified: trunk/Source/WebCore/page/ContextMenuController.cpp (186663 => 186664)


--- 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)
@@ -238,7 +238,7 @@
 
     switch (item->action()) {
     case ContextMenuItemTagOpenLinkInNewWindow:
-        openNewWindow(m_context.hitTestResult().absoluteLinkURL(), frame, ShouldOpenExternalURLsPolicy::ShouldAllow);
+        openNewWindow(m_context.hitTestResult().absoluteLinkURL(), frame, ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes);
         break;
     case ContextMenuItemTagDownloadLinkToDisk:
         // FIXME: Some day we should be able to do this from within WebCore. (Bug 117709)
@@ -406,7 +406,7 @@
             openNewWindow(m_context.hitTestResult().absoluteLinkURL(), frame, ShouldOpenExternalURLsPolicy::ShouldAllow);
         break;
     case ContextMenuItemTagOpenLinkInThisWindow:
-        frame->loader().loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(m_context.hitTestResult().absoluteLinkURL(), frame->loader().outgoingReferrer()), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, ShouldOpenExternalURLsPolicy::ShouldAllow), nullptr, nullptr);
+        frame->loader().loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(m_context.hitTestResult().absoluteLinkURL(), frame->loader().outgoingReferrer()), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes), nullptr, nullptr);
         break;
     case ContextMenuItemTagBold:
         frame->editor().command("ToggleBold").execute();

Modified: trunk/Source/WebKit2/ChangeLog (186663 => 186664)


--- 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)
@@ -1,3 +1,63 @@
+2015-07-09  Dan Bernstein  <m...@apple.com>
+
+        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.
+
 2015-07-09  Tim Horton  <timothy_hor...@apple.com>
 
         Use CoreAnimation fences instead of synchronous IPC to synchronize resize

Modified: trunk/Source/WebKit2/Shared/NavigationActionData.cpp (186663 => 186664)


--- 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)
@@ -40,7 +40,7 @@
     encoder.encodeEnum(mouseButton);
     encoder << isProcessingUserGesture;
     encoder << canHandleRequest;
-    encoder << shouldOpenExternalURLs;
+    encoder.encodeEnum(shouldOpenExternalURLsPolicy);
 }
 
 bool NavigationActionData::decode(IPC::ArgumentDecoder& decoder, NavigationActionData& result)
@@ -55,7 +55,7 @@
         return false;
     if (!decoder.decode(result.canHandleRequest))
         return false;
-    if (!decoder.decode(result.shouldOpenExternalURLs))
+    if (!decoder.decodeEnum(result.shouldOpenExternalURLsPolicy))
         return false;
 
     return true;

Modified: trunk/Source/WebKit2/Shared/NavigationActionData.h (186663 => 186664)


--- 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)
@@ -45,7 +45,7 @@
     WebMouseEvent::Button mouseButton { WebMouseEvent::NoButton };
     bool isProcessingUserGesture { false };
     bool canHandleRequest { false };
-    bool shouldOpenExternalURLs { false };
+    WebCore::ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy { WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow };
 };
 
 }

Modified: trunk/Source/WebKit2/UIProcess/API/APINavigationAction.h (186663 => 186664)


--- 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)
@@ -38,16 +38,17 @@
 
 class NavigationAction final : public ObjectImpl<Object::Type::NavigationAction> {
 public:
-    static Ref<NavigationAction> create(const WebKit::NavigationActionData& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, const WebCore::ResourceRequest& request, const WebCore::URL& originalURL)
+    static Ref<NavigationAction> create(const WebKit::NavigationActionData& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, const WebCore::ResourceRequest& request, const WebCore::URL& originalURL, bool shouldOpenAppLinks)
     {
-        return adoptRef(*new NavigationAction(navigationActionData, sourceFrame, targetFrame, request, originalURL));
+        return adoptRef(*new NavigationAction(navigationActionData, sourceFrame, targetFrame, request, originalURL, shouldOpenAppLinks));
     }
 
-    NavigationAction(const WebKit::NavigationActionData& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, const WebCore::ResourceRequest& request, const WebCore::URL& originalURL)
+    NavigationAction(const WebKit::NavigationActionData& navigationActionData, API::FrameInfo* sourceFrame, API::FrameInfo* targetFrame, const WebCore::ResourceRequest& request, const WebCore::URL& originalURL, bool shouldOpenAppLinks)
         : m_sourceFrame(sourceFrame)
         , m_targetFrame(targetFrame)
         , m_request(request)
         , m_originalURL(originalURL)
+        , m_shouldOpenAppLinks(shouldOpenAppLinks)
         , m_navigationActionData(navigationActionData)
     {
     }
@@ -63,7 +64,8 @@
     WebKit::WebMouseEvent::Button mouseButton() const { return m_navigationActionData.mouseButton; }
     bool isProcessingUserGesture() const { return m_navigationActionData.isProcessingUserGesture; }
     bool canHandleRequest() const { return m_navigationActionData.canHandleRequest; }
-    bool shouldOpenExternalURLs() const { return m_navigationActionData.shouldOpenExternalURLs; }
+    bool shouldOpenExternalSchemes() const { return m_navigationActionData.shouldOpenExternalURLsPolicy == WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow || m_navigationActionData.shouldOpenExternalURLsPolicy == WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes; }
+    bool shouldOpenAppLinks() const { return m_shouldOpenAppLinks && m_navigationActionData.shouldOpenExternalURLsPolicy == WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow; }
 
 private:
     RefPtr<FrameInfo> m_sourceFrame;
@@ -72,6 +74,8 @@
     WebCore::ResourceRequest m_request;
     WebCore::URL m_originalURL;
 
+    bool m_shouldOpenAppLinks;
+
     WebKit::NavigationActionData m_navigationActionData;
 };
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm (186663 => 186664)


--- 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)
@@ -172,9 +172,19 @@
     return _navigationAction->canHandleRequest();
 }
 
+- (BOOL)_shouldOpenExternalSchemes
+{
+    return _navigationAction->shouldOpenExternalSchemes();
+}
+
+- (BOOL)_shouldOpenAppLinks
+{
+    return _navigationAction->shouldOpenAppLinks();
+}
+
 - (BOOL)_shouldOpenExternalURLs
 {
-    return _navigationAction->shouldOpenExternalURLs();
+    return [self _shouldOpenExternalSchemes];
 }
 
 @end

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKNavigationActionPrivate.h (186663 => 186664)


--- 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)
@@ -32,8 +32,11 @@
 @property (nonatomic, readonly) NSURL *_originalURL;
 @property (nonatomic, readonly, getter=_isUserInitiated) BOOL _userInitiated;
 @property (nonatomic, readonly) BOOL _canHandleRequest;
-@property (nonatomic, readonly) BOOL _shouldOpenExternalURLs;
+@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);
 
+@property (nonatomic, readonly) BOOL _shouldOpenExternalURLs WK_DEPRECATED(WK_MAC_TBA, WK_MAC_TBA, WK_IOS_TBA, WK_IOS_TBA, "use _shouldOpenExternalSchemes and _shouldOpenAppLinks");
+
 @end
 
 #endif

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (186663 => 186664)


--- 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)
@@ -248,20 +248,11 @@
 static void tryAppLink(RefPtr<API::NavigationAction> navigationAction, const String& currentMainFrameURL, std::function<void (bool)> completionHandler)
 {
 #if HAVE(APP_LINKS)
-    bool mainFrameNavigation = !navigationAction->targetFrame() || navigationAction->targetFrame()->isMainFrame();
-    bool shouldOpenExternalURLs = navigationAction->shouldOpenExternalURLs();
-    if (!mainFrameNavigation || !shouldOpenExternalURLs) {
+    if (!navigationAction->shouldOpenAppLinks()) {
         completionHandler(false);
         return;
     }
 
-    // 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->request().url())) {
-        completionHandler(false);
-        return;
-    }
-
     auto* localCompletionHandler = new std::function<void (bool)>(WTF::move(completionHandler));
     [LSAppLink openWithURL:navigationAction->request().url() completionHandler:[localCompletionHandler](BOOL success, NSError *) {
         dispatch_async(dispatch_get_main_queue(), [localCompletionHandler, success] {

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (186663 => 186664)


--- 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)
@@ -105,7 +105,7 @@
     [configuration _setRelatedWebView:m_uiDelegate.m_webView];
 
     auto sourceFrameInfo = API::FrameInfo::create(*initiatingFrame, securityOriginData.securityOrigin());
-    auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.ptr(), nullptr, request, WebCore::URL());
+    auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.ptr(), nullptr, request, WebCore::URL(), true);
 
     RetainPtr<WKWebView> webView = [delegate.get() webView:m_uiDelegate.m_webView createWebViewWithConfiguration:configuration.get() forNavigationAction:wrapper(navigationAction) windowFeatures:adoptNS([[WKWindowFeatures alloc] _initWithWindowFeatures:windowFeatures]).get()];
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (186663 => 186664)


--- 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)
@@ -3255,8 +3255,10 @@
         else if (originatingFrame)
             sourceFrameInfo = API::FrameInfo::create(*originatingFrame, originatingFrameSecurityOrigin.securityOrigin());
 
-        auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.get(), destinationFrameInfo.get(), request, originalRequest.url());
+        bool shouldOpenAppLinks = (!destinationFrameInfo || destinationFrameInfo->isMainFrame()) && !protocolHostAndPortAreEqual(URL(ParsedURLString, m_mainFrame->url()), request.url());
 
+        auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.get(), destinationFrameInfo.get(), request, originalRequest.url(), shouldOpenAppLinks);
+
         m_navigationClient->decidePolicyForNavigationAction(*this, navigationAction.get(), WTF::move(listener), m_process->transformHandlesToObjects(userData.object()).get());
     } else
         m_policyClient->decidePolicyForNavigationAction(*this, frame, navigationActionData, originatingFrame, originalRequest, request, WTF::move(listener), m_process->transformHandlesToObjects(userData.object()).get());
@@ -3284,7 +3286,7 @@
         if (frame)
             sourceFrameInfo = API::FrameInfo::create(*frame, frameSecurityOrigin.securityOrigin());
 
-        auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.get(), nullptr, request, request.url());
+        auto navigationAction = API::NavigationAction::create(navigationActionData, sourceFrameInfo.get(), nullptr, request, request.url(), true);
 
         m_navigationClient->decidePolicyForNavigationAction(*this, navigationAction.get(), WTF::move(listener), m_process->transformHandlesToObjects(userData.object()).get());
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (186663 => 186664)


--- 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)
@@ -363,7 +363,7 @@
     bool tryClose();
     bool isClosed() const { return m_isClosed; }
 
-    RefPtr<API::Navigation> loadRequest(const WebCore::ResourceRequest&, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow, API::Object* userData = nullptr);
+    RefPtr<API::Navigation> loadRequest(const WebCore::ResourceRequest&, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, API::Object* userData = nullptr);
     RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, API::Object* userData = nullptr);
     RefPtr<API::Navigation> loadData(API::Data*, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr);
     RefPtr<API::Navigation> loadHTMLString(const String& htmlString, const String& baseURL, API::Object* userData = nullptr);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationAction.cpp (186663 => 186664)


--- 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)
@@ -71,3 +71,8 @@
 {
     return toImpl(navigationActionRef)->shouldOpenExternalURLs();
 }
+
+bool WKBundleNavigationActionGetShouldTryAppLinks(WKBundleNavigationActionRef navigationActionRef)
+{
+    return toImpl(navigationActionRef)->shouldTryAppLinks();
+}

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNavigationActionPrivate.h (186663 => 186664)


--- 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)
@@ -33,6 +33,7 @@
 #endif
 
 WK_EXPORT bool WKBundleNavigationActionGetShouldOpenExternalURLs(WKBundleNavigationActionRef);
+WK_EXPORT bool WKBundleNavigationActionGetShouldTryAppLinks(WKBundleNavigationActionRef);
 
 #ifdef __cplusplus
 }

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.cpp (186663 => 186664)


--- 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)
@@ -90,7 +90,8 @@
     : m_navigationType(navigationAction.type())
     , m_modifiers(modifiersForNavigationAction(navigationAction))
     , m_mouseButton(WebMouseEvent::NoButton)
-    , m_shouldOpenExternalURLs(navigationAction.shouldOpenExternalURLsPolicy() == ShouldOpenExternalURLsPolicy::ShouldAllow)
+    , m_shouldOpenExternalURLs(navigationAction.shouldOpenExternalURLsPolicy() == ShouldOpenExternalURLsPolicy::ShouldAllow || navigationAction.shouldOpenExternalURLsPolicy() == ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes)
+    , m_shouldTryAppLinks(navigationAction.shouldOpenExternalURLsPolicy() == ShouldOpenExternalURLsPolicy::ShouldAllow)
 {
     if (const MouseEvent* mouseEvent = mouseEventForNavigationAction(navigationAction)) {
         m_hitTestResult = InjectedBundleHitTestResult::create(frame->coreFrame()->eventHandler().hitTestResultAtPoint(mouseEvent->absoluteLocation()));

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleNavigationAction.h (186663 => 186664)


--- 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)
@@ -57,6 +57,7 @@
     InjectedBundleNodeHandle* formElement() const { return m_formElement.get(); }
 
     bool shouldOpenExternalURLs() const { return m_shouldOpenExternalURLs; }
+    bool shouldTryAppLinks() const { return m_shouldTryAppLinks; }
 
 private:
     InjectedBundleNavigationAction(WebFrame*, const WebCore::NavigationAction&, PassRefPtr<WebCore::FormState>);
@@ -67,6 +68,7 @@
     RefPtr<InjectedBundleHitTestResult> m_hitTestResult;
     RefPtr<InjectedBundleNodeHandle> m_formElement;
     bool m_shouldOpenExternalURLs;
+    bool m_shouldTryAppLinks;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (186663 => 186664)


--- 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)
@@ -801,7 +801,7 @@
     navigationActionData.mouseButton = action->mouseButton();
     navigationActionData.isProcessingUserGesture = navigationAction.processingUserGesture();
     navigationActionData.canHandleRequest = webPage->canHandleRequest(request);
-    navigationActionData.shouldOpenExternalURLs = navigationAction.shouldOpenExternalURLsPolicy() == ShouldOpenExternalURLsPolicy::ShouldAllow;
+    navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
 
     WebCore::Frame* coreFrame = m_frame->coreFrame();
     WebDocumentLoader* documentLoader = static_cast<WebDocumentLoader*>(coreFrame->loader().policyDocumentLoader());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to