Speculative fix for Mojave API test after r241223
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Feb 2019 07:04:47 +0000 (07:04 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Feb 2019 07:04:47 +0000 (07:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194427

* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
(WebKit::XPCInitializationHandler):
(WebKit::XPCServiceMain):
Set the __APPLEEVENTSSERVICENAME environment variable before handling any xpc messages like we used to.
I'll worry about making things right in the daemon later.

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

Source/WebKit/ChangeLog
Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm

index 8d87b5c..302c8e2 100644 (file)
@@ -1,3 +1,14 @@
+2019-02-08  Alex Christensen  <achristensen@webkit.org>
+
+        Speculative fix for Mojave API test after r241223
+        https://bugs.webkit.org/show_bug.cgi?id=194427
+
+        * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:
+        (WebKit::XPCInitializationHandler):
+        (WebKit::XPCServiceMain):
+        Set the __APPLEEVENTSSERVICENAME environment variable before handling any xpc messages like we used to.
+        I'll worry about making things right in the daemon later.
+
 2019-02-08  Chris Dumez  <cdumez@apple.com>
 
         [WK2][macOS] Avoid creating new CVDisplayLink objects for each WebProcess
index 4304c48..2cfc787 100644 (file)
@@ -108,19 +108,6 @@ void XPCInitializationHandler(xpc_object_t event)
 
     static std::once_flag once;
     std::call_once(once, [event] {
-#if PLATFORM(MAC)
-        // Don't allow Apple Events in WebKit processes. This can be removed when <rdar://problem/14012823> is fixed.
-        setenv("__APPLEEVENTSSERVICENAME", "", 1);
-
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
-        // We don't need to talk to the dock.
-        if (Class nsApplicationClass = NSClassFromString(@"NSApplication")) {
-            if ([nsApplicationClass respondsToSelector:@selector(_preventDockConnections)])
-                [nsApplicationClass _preventDockConnections];
-        }
-#endif
-#endif
-
 #if defined(__i386__)
         // FIXME: This should only be done for the 32-bit plug-in XPC service so we rely on the fact that
         // it's the only of the XPC services that are 32-bit. We should come up with a more targeted #if check.
@@ -169,6 +156,19 @@ void XPCInitializationHandler(xpc_object_t event)
 
 int XPCServiceMain(int, const char**)
 {
+#if PLATFORM(MAC)
+    // Don't allow Apple Events in WebKit processes. This can be removed when <rdar://problem/14012823> is fixed.
+    setenv("__APPLEEVENTSSERVICENAME", "", 1);
+    
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    // We don't need to talk to the dock.
+    if (Class nsApplicationClass = NSClassFromString(@"NSApplication")) {
+        if ([nsApplicationClass respondsToSelector:@selector(_preventDockConnections)])
+            [nsApplicationClass _preventDockConnections];
+    }
+#endif
+#endif
+
     xpc_main([] (xpc_connection_t peer) {
         XPCEventHandler(peer, AuxiliaryProcessType::XPCService);
     });