Title: [175008] branches/safari-600.2-branch/Source/_javascript_Core

Diff

Modified: branches/safari-600.2-branch/Source/_javascript_Core/ChangeLog (175007 => 175008)


--- branches/safari-600.2-branch/Source/_javascript_Core/ChangeLog	2014-10-22 01:17:38 UTC (rev 175007)
+++ branches/safari-600.2-branch/Source/_javascript_Core/ChangeLog	2014-10-22 01:35:50 UTC (rev 175008)
@@ -1,3 +1,21 @@
+2014-10-21  Dana Burkart  <[email protected]>
+
+        Merge r173238
+
+    2014-09-03  Joseph Pecoraro  <[email protected]>
+
+            Avoid warning if a process does not have access to com.apple.webinspector
+            https://bugs.webkit.org/show_bug.cgi?id=136473
+
+            Reviewed by Alexey Proskuryakov.
+
+            Pre-check for access to the mach port to avoid emitting warnings
+            in syslog for processes that do not have access.
+
+            * inspector/remote/RemoteInspector.mm:
+            (Inspector::canAccessWebInspectorMachPort):
+            (Inspector::RemoteInspector::shared):
+
 2014-08-21  Matthew Hanson  <[email protected]>
 
         Merge r172707. <rdar://problem/18043281>

Modified: branches/safari-600.2-branch/Source/_javascript_Core/inspector/remote/RemoteInspector.mm (175007 => 175008)


--- branches/safari-600.2-branch/Source/_javascript_Core/inspector/remote/RemoteInspector.mm	2014-10-22 01:17:38 UTC (rev 175007)
+++ branches/safari-600.2-branch/Source/_javascript_Core/inspector/remote/RemoteInspector.mm	2014-10-22 01:35:50 UTC (rev 175008)
@@ -39,12 +39,28 @@
 #import <wtf/text/WTFString.h>
 #import <xpc/xpc.h>
 
+#if __has_include(<sandbox/private.h>)
+#import <sandbox/private.h>
+#else
+enum sandbox_filter_type {
+    SANDBOX_FILTER_GLOBAL_NAME,
+};
+#endif
+extern "C" {
+    int sandbox_check(pid_t, const char *operation, enum sandbox_filter_type, ...);
+}
+
 #if PLATFORM(IOS)
 #import <wtf/ios/WebCoreThread.h>
 #endif
 
 namespace Inspector {
 
+static bool canAccessWebInspectorMachPort()
+{
+    return sandbox_check(getpid(), "mach-lookup", SANDBOX_FILTER_GLOBAL_NAME, WIRXPCMachPortName) == 0;
+}
+
 static void dispatchAsyncOnQueueSafeForAnyDebuggable(void (^block)())
 {
 #if PLATFORM(IOS)
@@ -70,9 +86,11 @@
 
     static dispatch_once_t once;
     dispatch_once(&once, ^{
-        JSC::initializeThreading();
-        if (RemoteInspector::startEnabled)
-            shared.get().start();
+        if (canAccessWebInspectorMachPort()) {
+            JSC::initializeThreading();
+            if (RemoteInspector::startEnabled)
+                shared.get().start();
+        }
     });
 
     return shared;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to