Title: [244239] trunk/Source
Revision
244239
Author
wenson_hs...@apple.com
Date
2019-04-12 20:54:10 -0700 (Fri, 12 Apr 2019)

Log Message

Enable modern compatibility mode by default in WKWebView on some devices
https://bugs.webkit.org/show_bug.cgi?id=196883
<rdar://problem/49864527>

Reviewed by Tim Horton.

Source/WebCore:

Add a new helper function to determine whether an app is pre-installed on iOS, for the purposes of ensuring
compatibility with existing Apple apps that are not affected by linked-on-or-after. This involves all apps with
a bundle ID that begins with "com.apple.".

* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::setApplicationBundleIdentifier):
(WebCore::applicationBundleStartsWith):
(WebCore::IOSApplication::isAppleApplication):

Source/WebKit:

Make some minor adjustments to new API.

* Shared/WebCompatibilityMode.h:

Rename WebCompatibilityMode::Default to WebCompatibilityMode::Recommended.

* Shared/WebPreferences.yaml:
* Shared/WebPreferencesDefaultValues.h:

Now that the role of the UseModernCompatibilityModeByDefault debug preference is limited to bypassing linked-on-
or-after and app bundle compatibility hacks, we no longer make this default to true in iOSMac.

* UIProcess/API/APIWebsitePolicies.h:
* UIProcess/API/Cocoa/WKNavigationDelegate.h:

Rename the withPreferences: label to just preferences:.

* UIProcess/API/Cocoa/WKWebViewConfiguration.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::setNavigationDelegate):
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
* UIProcess/Cocoa/VersionChecks.h:
* UIProcess/ios/WebPageProxyIOS.mm:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (244238 => 244239)


--- trunk/Source/WebCore/ChangeLog	2019-04-13 03:04:18 UTC (rev 244238)
+++ trunk/Source/WebCore/ChangeLog	2019-04-13 03:54:10 UTC (rev 244239)
@@ -1,3 +1,21 @@
+2019-04-12  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Enable modern compatibility mode by default in WKWebView on some devices
+        https://bugs.webkit.org/show_bug.cgi?id=196883
+        <rdar://problem/49864527>
+
+        Reviewed by Tim Horton.
+
+        Add a new helper function to determine whether an app is pre-installed on iOS, for the purposes of ensuring
+        compatibility with existing Apple apps that are not affected by linked-on-or-after. This involves all apps with
+        a bundle ID that begins with "com.apple.".
+
+        * platform/RuntimeApplicationChecks.h:
+        * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
+        (WebCore::setApplicationBundleIdentifier):
+        (WebCore::applicationBundleStartsWith):
+        (WebCore::IOSApplication::isAppleApplication):
+
 2019-04-12  Justin Fan  <justin_...@apple.com>
 
         [Web GPU] Prevent narrowing conversions during Metal function calls on 32-bit platforms

Modified: trunk/Source/WebCore/platform/RuntimeApplicationChecks.h (244238 => 244239)


--- trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2019-04-13 03:04:18 UTC (rev 244238)
+++ trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2019-04-13 03:54:10 UTC (rev 244239)
@@ -91,6 +91,7 @@
 WEBCORE_EXPORT bool isNike();
 bool isMoviStarPlus();
 WEBCORE_EXPORT bool isFirefox();
+WEBCORE_EXPORT bool isAppleApplication();
 
 } // IOSApplication
 

Modified: trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm (244238 => 244239)


--- trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm	2019-04-13 03:04:18 UTC (rev 244238)
+++ trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm	2019-04-13 03:54:10 UTC (rev 244239)
@@ -62,7 +62,7 @@
 void setApplicationBundleIdentifier(const String& bundleIdentifier)
 {
     ASSERT(RunLoop::isMain());
-    ASSERT_WITH_MESSAGE(!applicationBundleIdentifierOverrideWasQueried, "applicationBundleIsEqualTo() should not be called before setApplicationBundleIdentifier()");
+    ASSERT_WITH_MESSAGE(!applicationBundleIdentifierOverrideWasQueried, "applicationBundleIsEqualTo() and applicationBundleStartsWith() should not be called before setApplicationBundleIdentifier()");
     applicationBundleIdentifierOverride() = bundleIdentifier;
 }
 
@@ -191,6 +191,11 @@
 
 #if PLATFORM(IOS_FAMILY)
 
+static bool applicationBundleStartsWith(const String& bundleIdentifierPrefix)
+{
+    return applicationBundleIdentifier().startsWith(bundleIdentifierPrefix);
+}
+
 bool IOSApplication::isMobileMail()
 {
     static bool isMobileMail = applicationBundleIsEqualTo("com.apple.mobilemail"_s);
@@ -283,6 +288,12 @@
     return isFirefox;
 }
 
+bool IOSApplication::isAppleApplication()
+{
+    static bool isAppleApplication = applicationBundleStartsWith("com.apple."_s);
+    return isAppleApplication;
+}
+
 #endif
 
 } // namespace WebCore

Modified: trunk/Source/WebKit/ChangeLog (244238 => 244239)


--- trunk/Source/WebKit/ChangeLog	2019-04-13 03:04:18 UTC (rev 244238)
+++ trunk/Source/WebKit/ChangeLog	2019-04-13 03:54:10 UTC (rev 244239)
@@ -1,3 +1,35 @@
+2019-04-12  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Enable modern compatibility mode by default in WKWebView on some devices
+        https://bugs.webkit.org/show_bug.cgi?id=196883
+        <rdar://problem/49864527>
+
+        Reviewed by Tim Horton.
+
+        Make some minor adjustments to new API.
+
+        * Shared/WebCompatibilityMode.h:
+
+        Rename WebCompatibilityMode::Default to WebCompatibilityMode::Recommended.
+
+        * Shared/WebPreferences.yaml:
+        * Shared/WebPreferencesDefaultValues.h:
+
+        Now that the role of the UseModernCompatibilityModeByDefault debug preference is limited to bypassing linked-on-
+        or-after and app bundle compatibility hacks, we no longer make this default to true in iOSMac.
+
+        * UIProcess/API/APIWebsitePolicies.h:
+        * UIProcess/API/Cocoa/WKNavigationDelegate.h:
+
+        Rename the withPreferences: label to just preferences:.
+
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::setNavigationDelegate):
+        (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
+        * UIProcess/Cocoa/VersionChecks.h:
+        * UIProcess/ios/WebPageProxyIOS.mm:
+
 2019-04-12  Brian Burg  <bb...@apple.com>
 
         WebDriver: fix typo in EnterFullscreen.js in error-handling code

Modified: trunk/Source/WebKit/Shared/WebCompatibilityMode.h (244238 => 244239)


--- trunk/Source/WebKit/Shared/WebCompatibilityMode.h	2019-04-13 03:04:18 UTC (rev 244238)
+++ trunk/Source/WebKit/Shared/WebCompatibilityMode.h	2019-04-13 03:54:10 UTC (rev 244239)
@@ -30,7 +30,7 @@
 namespace WebKit {
 
 enum class WebCompatibilityMode {
-    Default,
+    Recommended,
     Legacy,
     Modern,
 };

Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (244238 => 244239)


--- trunk/Source/WebKit/Shared/WebPreferences.yaml	2019-04-13 03:04:18 UTC (rev 244238)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml	2019-04-13 03:54:10 UTC (rev 244239)
@@ -1060,7 +1060,7 @@
 
 UseModernCompatibilityModeByDefault:
   type: bool
-  defaultValue: USE_MODERN_COMPATIBILITY_MODE_BY_DEFAULT
+  defaultValue: false
   humanReadableName: "Use Modern Compatibility Mode"
   humanReadableDescription: "Use modern compatibility mode by default"
   webcoreBinding: none

Modified: trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h (244238 => 244239)


--- trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h	2019-04-13 03:04:18 UTC (rev 244238)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h	2019-04-13 03:54:10 UTC (rev 244239)
@@ -266,9 +266,3 @@
 #else
 #define DEFAULT_APPLE_PAY_ENABLED false
 #endif
-
-#if PLATFORM(IOS_FAMILY) && !PLATFORM(IOSMAC)
-#define USE_MODERN_COMPATIBILITY_MODE_BY_DEFAULT false
-#else
-#define USE_MODERN_COMPATIBILITY_MODE_BY_DEFAULT true
-#endif

Modified: trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h (244238 => 244239)


--- trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h	2019-04-13 03:04:18 UTC (rev 244238)
+++ trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h	2019-04-13 03:54:10 UTC (rev 244239)
@@ -111,7 +111,7 @@
     WTF::String m_customUserAgent;
     WTF::String m_customJavaScriptUserAgentAsSiteSpecificQuirks;
     WTF::String m_customNavigatorPlatform;
-    WebKit::WebCompatibilityMode m_preferredCompatibilityMode { WebKit::WebCompatibilityMode::Default };
+    WebKit::WebCompatibilityMode m_preferredCompatibilityMode { WebKit::WebCompatibilityMode::Recommended };
     WebKit::WebsiteMetaViewportPolicy m_metaViewportPolicy { WebKit::WebsiteMetaViewportPolicy::Default };
     WebKit::WebsiteMediaSourcePolicy m_mediaSourcePolicy { WebKit::WebsiteMediaSourcePolicy::Default };
     WebKit::WebsiteSimulatedMouseEventsDispatchPolicy m_simulatedMouseEventsDispatchPolicy { WebKit::WebsiteSimulatedMouseEventsDispatchPolicy::Default };

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegate.h (244238 => 244239)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegate.h	2019-04-13 03:04:18 UTC (rev 244238)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegate.h	2019-04-13 03:54:10 UTC (rev 244239)
@@ -86,7 +86,7 @@
  @discussion If you implement this method,
  -webView:decidePolicyForNavigationAction:decisionHandler: will not be called.
  */
-- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction withPreferences:(WKWebpagePreferences *)preferences decisionHandler:(void (^)(WKNavigationActionPolicy, WKWebpagePreferences *))decisionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction preferences:(WKWebpagePreferences *)preferences decisionHandler:(void (^)(WKNavigationActionPolicy, WKWebpagePreferences *))decisionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 /*! @abstract Decides whether to allow or cancel a navigation after its
  response is known.

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.h (244238 => 244239)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.h	2019-04-13 03:04:18 UTC (rev 244238)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.h	2019-04-13 03:54:10 UTC (rev 244239)
@@ -132,7 +132,7 @@
 
 /*! @abstract The set of default webpage preferences to use when loading and rendering content.
  @discussion These default webpage preferences are additionally passed to the navigation delegate
- in -webView:decidePolicyForNavigationAction:withPreferences:decisionHandler:.
+ in -webView:decidePolicyForNavigationAction:preferences:decisionHandler:.
  */
 @property (null_resettable, nonatomic, copy) WKWebpagePreferences *defaultWebpagePreferences WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (244238 => 244239)


--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm	2019-04-13 03:04:18 UTC (rev 244238)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm	2019-04-13 03:54:10 UTC (rev 244239)
@@ -149,7 +149,7 @@
     m_navigationDelegate = delegate;
 
     m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionDecisionHandler = [delegate respondsToSelector:@selector(webView:decidePolicyForNavigationAction:decisionHandler:)];
-    m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionWithPreferencesDecisionHandler = [delegate respondsToSelector:@selector(webView:decidePolicyForNavigationAction:withPreferences:decisionHandler:)];
+    m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionWithPreferencesDecisionHandler = [delegate respondsToSelector:@selector(webView:decidePolicyForNavigationAction:preferences:decisionHandler:)];
     m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionDecisionHandlerWebsitePolicies = [delegate respondsToSelector:@selector(_webView:decidePolicyForNavigationAction:decisionHandler:)];
     m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionUserInfoDecisionHandlerWebsitePolicies = [delegate respondsToSelector:@selector(_webView:decidePolicyForNavigationAction:userInfo:decisionHandler:)];
     m_navigationDelegateMethods.webViewDecidePolicyForNavigationResponseDecisionHandler = [delegate respondsToSelector:@selector(webView:decidePolicyForNavigationResponse:decisionHandler:)];
@@ -560,7 +560,7 @@
 
     auto selectorForCompletionHandlerChecker = ([&] () -> SEL {
         if (delegateHasWebpagePreferences)
-            return @selector(webView:decidePolicyForNavigationAction:withPreferences:decisionHandler:);
+            return @selector(webView:decidePolicyForNavigationAction:preferences:decisionHandler:);
         if (delegateHasWebsitePolicies)
             return @selector(_webView:decidePolicyForNavigationAction:decisionHandler:);
         return @selector(webView:decidePolicyForNavigationAction:decisionHandler:);
@@ -631,7 +631,7 @@
     };
 
     if (delegateHasWebpagePreferences)
-        [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationAction:wrapper(navigationAction) withPreferences:wrapper(defaultWebsitePolicies) decisionHandler:makeBlockPtr(WTFMove(decisionHandlerWithPreferencesOrPolicies)).get()];
+        [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationAction:wrapper(navigationAction) preferences:wrapper(defaultWebsitePolicies) decisionHandler:makeBlockPtr(WTFMove(decisionHandlerWithPreferencesOrPolicies)).get()];
     else if (delegateHasWebsitePolicies) {
         auto decisionHandler = makeBlockPtr(WTFMove(decisionHandlerWithPreferencesOrPolicies));
         if (m_navigationState.m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionUserInfoDecisionHandlerWebsitePolicies)

Modified: trunk/Source/WebKit/UIProcess/Cocoa/VersionChecks.h (244238 => 244239)


--- trunk/Source/WebKit/UIProcess/Cocoa/VersionChecks.h	2019-04-13 03:04:18 UTC (rev 244238)
+++ trunk/Source/WebKit/UIProcess/Cocoa/VersionChecks.h	2019-04-13 03:54:10 UTC (rev 244239)
@@ -35,6 +35,7 @@
 #define DYLD_IOS_VERSION_FIRST_WITH_SNAPSHOT_AFTER_SCREEN_UPDATES 0
 #define DYLD_IOS_VERSION_FIRST_WHERE_DOWNLOAD_ATTRIBUTE_DOES_NOT_OVERRIDE_NAVIGATION_DELEGATE 0
 #define DYLD_IOS_VERSION_FIRST_THAT_DECIDES_POLICY_BEFORE_LOADING_QUICK_LOOK_PREVIEW 0
+#define DYLD_IOS_VERSION_FIRST_WITH_MODERN_COMPATIBILITY_MODE_BY_DEFAULT 0
 #define DYLD_MACOS_VERSION_FIRST_WITH_SNAPSHOT_AFTER_SCREEN_UPDATES 0
 #define DYLD_MACOS_VERSION_FIRST_WHERE_DOWNLOAD_ATTRIBUTE_DOES_NOT_OVERRIDE_NAVIGATION_DELEGATE 0
 #endif
@@ -71,6 +72,7 @@
     FirstWithDeviceOrientationAndMotionPermissionAPI = DYLD_IOS_VERSION_FIRST_WITH_DEVICE_ORIENTATION_AND_MOTION_PERMISSION_API,
     FirstThatDecidesPolicyBeforeLoadingQuickLookPreview = DYLD_IOS_VERSION_FIRST_THAT_DECIDES_POLICY_BEFORE_LOADING_QUICK_LOOK_PREVIEW,
     FirstWithExceptionsForRelatedWebViewsUsingDifferentDataStores = DYLD_IOS_VERSION_FIRST_WITH_EXCEPTIONS_FOR_RELATED_WEBVIEWS_USING_DIFFERENT_DATA_STORES,
+    FirstWithModernCompabilityModeByDefault = DYLD_IOS_VERSION_FIRST_WITH_MODERN_COMPATIBILITY_MODE_BY_DEFAULT,
 #elif PLATFORM(MAC)
     FirstWithNetworkCache = DYLD_MACOSX_VERSION_10_11,
     FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_MACOSX_VERSION_10_13,

Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (244238 => 244239)


--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-04-13 03:04:18 UTC (rev 244238)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-04-13 03:54:10 UTC (rev 244239)
@@ -58,6 +58,7 @@
 #import <WebCore/FrameView.h>
 #import <WebCore/NotImplemented.h>
 #import <WebCore/PlatformScreen.h>
+#import <WebCore/RuntimeApplicationChecks.h>
 #import <WebCore/SharedBuffer.h>
 #import <WebCore/UserAgent.h>
 #import <WebCore/ValidationBubble.h>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to