Title: [258512] trunk/Source/WebKit
Revision
258512
Author
pvol...@apple.com
Date
2020-03-16 12:50:59 -0700 (Mon, 16 Mar 2020)

Log Message

[Cocoa] Only set CF prefs direct mode for the WebContent process
https://bugs.webkit.org/show_bug.cgi?id=209091
<rdar://problem/60337842>

Reviewed by Brent Fulgham.

Currently, we enable CF prefs direct mode in XPCServiceMain. This is incorrect, it should only be enabled
for the WebContent process.

* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceMain):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (258511 => 258512)


--- trunk/Source/WebKit/ChangeLog	2020-03-16 18:49:48 UTC (rev 258511)
+++ trunk/Source/WebKit/ChangeLog	2020-03-16 19:50:59 UTC (rev 258512)
@@ -1,3 +1,17 @@
+2020-03-16  Per Arne Vollan  <pvol...@apple.com>
+
+        [Cocoa] Only set CF prefs direct mode for the WebContent process
+        https://bugs.webkit.org/show_bug.cgi?id=209091
+        <rdar://problem/60337842>
+
+        Reviewed by Brent Fulgham.
+
+        Currently, we enable CF prefs direct mode in XPCServiceMain. This is incorrect, it should only be enabled
+        for the WebContent process.
+
+        * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
+        (WebKit::XPCServiceMain):
+
 2020-03-16  David Kilzer  <ddkil...@apple.com>
 
         WebPage::GetDataSelectionForPasteboard should validate its `size` variable

Modified: trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm (258511 => 258512)


--- trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm	2020-03-16 18:49:48 UTC (rev 258511)
+++ trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm	2020-03-16 19:50:59 UTC (rev 258512)
@@ -70,7 +70,6 @@
                 else
                     RELEASE_ASSERT_NOT_REACHED();
 
-                
                 typedef void (*InitializerFunction)(xpc_connection_t, xpc_object_t, xpc_object_t);
                 InitializerFunction initializerFunctionPtr = reinterpret_cast<InitializerFunction>(CFBundleGetFunctionPointerForName(webKitBundle, entryPointFunctionName));
                 if (!initializerFunctionPtr) {
@@ -106,8 +105,17 @@
     xpc_connection_resume(peer);
 }
 
-int XPCServiceMain(int, const char**)
+int XPCServiceMain(int argc, const char** argv)
 {
+    ASSERT(argc >= 1);
+    ASSERT(argv[0]);
+#if ENABLE(CFPREFS_DIRECT_MODE)
+    if (argc >= 1 && argv[0] && strstr(argv[0], "com.apple.WebKit.WebContent")) {
+        // Enable CFPrefs direct mode to avoid unsuccessfully attempting to connect to the daemon and getting blocked by the sandbox.
+        _CFPrefsSetDirectModeEnabled(YES);
+    }
+#endif
+
     auto bootstrap = adoptOSObject(xpc_copy_bootstrap());
 #if PLATFORM(IOS_FAMILY)
     auto containerEnvironmentVariables = xpc_dictionary_get_value(bootstrap.get(), "ContainerEnvironmentVariables");
@@ -117,11 +125,6 @@
     });
 #endif
 
-#if ENABLE(CFPREFS_DIRECT_MODE)
-    // Enable CF prefs direct mode to avoid connecting to the CF prefs daemon.
-    _CFPrefsSetDirectModeEnabled(YES);
-#endif
-
     if (bootstrap) {
 #if PLATFORM(MAC)
         if (const char* webKitBundleVersion = xpc_dictionary_get_string(bootstrap.get(), "WebKitBundleVersion")) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to