Changeset 173238 in webkit


Ignore:
Timestamp:
Sep 3, 2014 3:50:17 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Avoid warning if a process does not have access to com.apple.webinspector
https://bugs.webkit.org/show_bug.cgi?id=136473

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2014-09-03
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):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r173237 r173238  
     12014-09-03  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Avoid warning if a process does not have access to com.apple.webinspector
     4        https://bugs.webkit.org/show_bug.cgi?id=136473
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Pre-check for access to the mach port to avoid emitting warnings
     9        in syslog for processes that do not have access.
     10
     11        * inspector/remote/RemoteInspector.mm:
     12        (Inspector::canAccessWebInspectorMachPort):
     13        (Inspector::RemoteInspector::shared):
     14
    1152014-09-03  Filip Pizlo  <fpizlo@apple.com>
    216
  • trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm

    r172532 r173238  
    4141#if __has_include(<xpc/xpc.h>)
    4242#import <xpc/xpc.h>
    43 #else
     43#endif
    4444extern "C" {
    4545    xpc_connection_t xpc_connection_create_mach_service(const char* name, dispatch_queue_t, uint64_t flags);
    4646    void xpc_release(xpc_object_t);
    4747}
     48
     49#if __has_include(<sandbox/private.h>)
     50#import <sandbox/private.h>
     51#else
     52enum sandbox_filter_type {
     53    SANDBOX_FILTER_GLOBAL_NAME,
     54};
    4855#endif
     56extern "C" {
     57    int sandbox_check(pid_t, const char *operation, enum sandbox_filter_type, ...);
     58}
    4959
    5060#if PLATFORM(IOS)
     
    5464namespace Inspector {
    5565
     66static bool canAccessWebInspectorMachPort()
     67{
     68    return sandbox_check(getpid(), "mach-lookup", SANDBOX_FILTER_GLOBAL_NAME, WIRXPCMachPortName) == 0;
     69}
     70
    5671static void dispatchAsyncOnQueueSafeForAnyDebuggable(void (^block)())
    5772{
     
    7994    static dispatch_once_t once;
    8095    dispatch_once(&once, ^{
    81         JSC::initializeThreading();
    82         if (RemoteInspector::startEnabled)
    83             shared.get().start();
     96        if (canAccessWebInspectorMachPort()) {
     97            JSC::initializeThreading();
     98            if (RemoteInspector::startEnabled)
     99                shared.get().start();
     100        }
    84101    });
    85102
Note: See TracChangeset for help on using the changeset viewer.