Title: [280433] trunk/Source/WebKit
Revision
280433
Author
peng.l...@apple.com
Date
2021-07-29 10:50:38 -0700 (Thu, 29 Jul 2021)

Log Message

The bundle path of downlevel Safari is wrong
https://bugs.webkit.org/show_bug.cgi?id=228339

Reviewed by Tim Horton.

Use the same approach as `isSystemWebKit` to check whether the WebKit bundle
is from the staged framework.

* Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
(WebKit::isFeatureFlagEnabled):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (280432 => 280433)


--- trunk/Source/WebKit/ChangeLog	2021-07-29 17:48:28 UTC (rev 280432)
+++ trunk/Source/WebKit/ChangeLog	2021-07-29 17:50:38 UTC (rev 280433)
@@ -1,3 +1,16 @@
+2021-07-29  Peng Liu  <peng.l...@apple.com>
+
+        The bundle path of downlevel Safari is wrong
+        https://bugs.webkit.org/show_bug.cgi?id=228339
+
+        Reviewed by Tim Horton.
+
+        Use the same approach as `isSystemWebKit` to check whether the WebKit bundle
+        is from the staged framework.
+
+        * Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
+        (WebKit::isFeatureFlagEnabled):
+
 2021-07-29  Kate Cheney  <katherine_che...@apple.com>
 
         CORS preflight checks not attributed to the correct application

Modified: trunk/Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm (280432 => 280433)


--- trunk/Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm	2021-07-29 17:48:28 UTC (rev 280432)
+++ trunk/Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm	2021-07-29 17:50:38 UTC (rev 280433)
@@ -40,7 +40,10 @@
 // Because of <rdar://problem/60608008>, WebKit has to parse the feature flags plist file
 bool isFeatureFlagEnabled(const String& featureName)
 {
-    BOOL isWebKitBundleFromStagedFramework = [[[NSBundle mainBundle] bundlePath] hasPrefix:@"/Library/Apple/System/Library/StagedFrameworks/Safari"];
+    static bool isWebKitBundleFromStagedFramework = [] {
+        NSBundle *webkit2Bundle = [NSBundle bundleForClass:NSClassFromString(@"WKWebView")];
+        return [webkit2Bundle.bundlePath hasPrefix:@"/Library/Apple/System/Library/StagedFrameworks/Safari/"];
+    }();
 
     if (!isWebKitBundleFromStagedFramework)
         return _os_feature_enabled_impl("WebKit", (const char*)featureName.utf8().data());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to