[Cocoa] Add a way for Apple-internal clients to opt into recommended compatibility...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2019 01:32:38 +0000 (01:32 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Apr 2019 01:32:38 +0000 (01:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196977
<rdar://problem/49871194>

Reviewed by Tim Horton.

Add a helper method to query whether the navigation client should bypass policy safeguards when determining the
recommended compatibility mode. We bypass policy safeguards in Cocoa platforms if the navigation delegate
implements the new navigation delegate API.

* UIProcess/API/APINavigationClient.h:
(API::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::shouldBypassCompatibilityModeSafeguards const):

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APINavigationClient.h
Source/WebKit/UIProcess/Cocoa/NavigationState.h
Source/WebKit/UIProcess/Cocoa/NavigationState.mm

index 1cd6729..a485fa7 100644 (file)
@@ -1,3 +1,21 @@
+2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [Cocoa] Add a way for Apple-internal clients to opt into recommended compatibility mode
+        https://bugs.webkit.org/show_bug.cgi?id=196977
+        <rdar://problem/49871194>
+
+        Reviewed by Tim Horton.
+
+        Add a helper method to query whether the navigation client should bypass policy safeguards when determining the
+        recommended compatibility mode. We bypass policy safeguards in Cocoa platforms if the navigation delegate
+        implements the new navigation delegate API.
+
+        * UIProcess/API/APINavigationClient.h:
+        (API::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
+        * UIProcess/Cocoa/NavigationState.h:
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
+
 2019-04-16  Per Arne Vollan  <pvollan@apple.com>
 
         -[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:] never returns _WKWebsiteDataTypeCredentials
index 1105780..021256e 100644 (file)
@@ -91,6 +91,7 @@ public:
     virtual void renderingProgressDidChange(WebKit::WebPageProxy&, OptionSet<WebCore::LayoutMilestone>) { }
 
     virtual void didReceiveAuthenticationChallenge(WebKit::WebPageProxy&, WebKit::AuthenticationChallengeProxy& challenge) { challenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::PerformDefaultHandling); }
+    virtual bool shouldBypassCompatibilityModeSafeguards() const { return false; }
 
     // FIXME: These function should not be part of this client.
     virtual bool processDidTerminate(WebKit::WebPageProxy&, WebKit::ProcessTerminationReason) { return false; }
index da6bf5c..7bae166 100644 (file)
@@ -109,6 +109,8 @@ private:
 
         void renderingProgressDidChange(WebPageProxy&, OptionSet<WebCore::LayoutMilestone>) override;
 
+        bool shouldBypassCompatibilityModeSafeguards() const final;
+
         void didReceiveAuthenticationChallenge(WebPageProxy&, AuthenticationChallengeProxy&) override;
         bool processDidTerminate(WebPageProxy&, ProcessTerminationReason) override;
         void processDidBecomeResponsive(WebPageProxy&) override;
index 6a705c5..526947f 100644 (file)
@@ -939,6 +939,11 @@ void NavigationState::NavigationClient::renderingProgressDidChange(WebPageProxy&
     [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView renderingProgressDidChange:renderingProgressEvents(layoutMilestones)];
 }
 
+bool NavigationState::NavigationClient::shouldBypassCompatibilityModeSafeguards() const
+{
+    return m_navigationState.m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionWithPreferencesDecisionHandler;
+}
+
 static AuthenticationChallengeDisposition toAuthenticationChallengeDisposition(NSURLSessionAuthChallengeDisposition disposition)
 {
     switch (disposition) {