Assert that calling CGSSetDenyWindowServerConnections(true) succeeds
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Aug 2018 15:53:31 +0000 (15:53 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Aug 2018 15:53:31 +0000 (15:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188615

Reviewed by Brent Fulgham.

If the call to CGSSetDenyWindowServerConnections(true) fails, it means there are open WindowServer connections
at this point, and future WindowServer connections will not be denied. We should assert that this call succeeds.

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

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

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

index 577b067..2eaba8a 100644 (file)
@@ -1,3 +1,16 @@
+2018-08-16  Per Arne Vollan  <pvollan@apple.com>
+
+        Assert that calling CGSSetDenyWindowServerConnections(true) succeeds
+        https://bugs.webkit.org/show_bug.cgi?id=188615
+
+        Reviewed by Brent Fulgham.
+
+        If the call to CGSSetDenyWindowServerConnections(true) fails, it means there are open WindowServer connections
+        at this point, and future WindowServer connections will not be denied. We should assert that this call succeeds.
+
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeProcess):
+
 2018-08-16  Philippe Normand  <pnormand@igalia.com>
 
         Unreviewed, WPE build fix after r234920.
index 97e5fd2..eedb923 100644 (file)
@@ -323,7 +323,8 @@ void WebProcess::platformInitializeProcess(const ChildProcessInitializationParam
 #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.
-    CGSSetDenyWindowServerConnections(true);
+    auto retval = CGSSetDenyWindowServerConnections(true);
+    RELEASE_ASSERT(retval == kCGErrorSuccess);
     // Make sure that we close any WindowServer connections after checking in with Launch Services.
     CGSShutdownServerConnections();
 #else