An error message is written to stderr when the WebContent process is blocking WindowS...
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 May 2018 16:31:53 +0000 (16:31 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 May 2018 16:31:53 +0000 (16:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184701

Reviewed by Brent Fulgham.

Calling 'setApplicationIsDaemon(true)' instead of 'CGSSetDenyWindowServerConnections(true)' to disable
access to the WindowServer in the WebContent process, will remove this error message. After this change,
the url of the WebContent process is still showing up in Activity Monitor, which previously was a
problem when calling 'setApplicationIsDaemon(true)'.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeProcess):

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

Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebProcess.cpp
Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm

index 6bb98ea..9cc3cda 100644 (file)
@@ -1,3 +1,20 @@
+2018-05-03  Per Arne Vollan  <pvollan@apple.com>
+
+        An error message is written to stderr when the WebContent process is blocking WindowServer access.
+        https://bugs.webkit.org/show_bug.cgi?id=184701
+
+        Reviewed by Brent Fulgham.
+
+        Calling 'setApplicationIsDaemon(true)' instead of 'CGSSetDenyWindowServerConnections(true)' to disable
+        access to the WindowServer in the WebContent process, will remove this error message. After this change,
+        the url of the WebContent process is still showing up in Activity Monitor, which previously was a
+        problem when calling 'setApplicationIsDaemon(true)'.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeProcess):
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeProcess):
+
 2018-05-03  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r231253.
index b8e62a8..d062752 100644 (file)
@@ -224,23 +224,6 @@ void WebProcess::initializeProcess(const ChildProcessInitializationParameters& p
 
     MessagePortChannelProvider::setSharedProvider(WebMessagePortChannelProvider::singleton());
     
-#if PLATFORM(MAC)
-#if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
-    // Deny the WebContent process access to the WindowServer.
-    // We cannot call setApplicationIsDaemon here, since Activity Monitor will not show the
-    // url of the WebContent process, then.
-    // This call will not succeed if there are open WindowServer connections at this point.
-    CGError error = CGSSetDenyWindowServerConnections(true);
-    ASSERT(error == kCGErrorSuccess);
-    if (error != kCGErrorSuccess)
-        WTFLogAlways("Failed to deny WindowServer connections, error = %d", error);
-#endif
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
-    // This call is needed when the WebProcess is not running the NSApplication event loop.
-    // Otherwise, calling enableSandboxStyleFileQuarantine() will fail.
-    launchServicesCheckIn();
-#endif
-#endif
     platformInitializeProcess(parameters);
 }
 
index b3f6d33..bc7db23 100644 (file)
@@ -298,6 +298,20 @@ void WebProcess::registerWithStateDumper()
 
 void WebProcess::platformInitializeProcess(const ChildProcessInitializationParameters&)
 {
+#if PLATFORM(MAC)
+#if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+    // Deny the WebContent process access to the WindowServer.
+    // This call will not succeed if there are open WindowServer connections at this point.
+    setApplicationIsDaemon();
+#else
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    // This call is needed when the WebProcess is not running the NSApplication event loop.
+    // Otherwise, calling enableSandboxStyleFileQuarantine() will fail.
+    launchServicesCheckIn();
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+#endif // ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+#endif // PLATFORM(MAC)
+
     registerWithAccessibility();
 
 #if USE(OS_STATE)