Bug 131406

Summary: Web Inspector: Prevent deadlocks receiving WIRPermissionDenied message
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, graouts, joepeck, mrowe, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix
timothy: review+
[PATCH] For Landing none

Description Joseph Pecoraro 2014-04-08 16:13:52 PDT
When processing the WIRPermissionDenied message we have to avoid grabs of the mutex in RemoteInspector and RemoteInspectorXPCConnection. Address both of these by creating a stop/close path that takes locks, and a path that does not take locks.
Comment 1 Radar WebKit Bug Importer 2014-04-08 16:14:07 PDT
<rdar://problem/16559247>
Comment 2 Joseph Pecoraro 2014-04-08 16:22:41 PDT
Created attachment 228907 [details]
[PATCH] Proposed Fix

Tested with a daemon that always responded with WIRPermissionDenied, and this fixes the issue.
Comment 3 Timothy Hatcher 2014-04-08 16:37:09 PDT
Comment on attachment 228907 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=228907&action=review

> Source/JavaScriptCore/inspector/remote/RemoteInspector.h:68
> +    enum StopSource { StopSourceAPI, StopSourceXPCMessage };

IIRC, we don't typically repeat the enum name. So:

enum StopSource { API, XPCMessage };

But I could be wrong.
Comment 4 Joseph Pecoraro 2014-04-08 16:39:06 PDT
(In reply to comment #3)
> (From update of attachment 228907 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=228907&action=review
> 
> > Source/JavaScriptCore/inspector/remote/RemoteInspector.h:68
> > +    enum StopSource { StopSourceAPI, StopSourceXPCMessage };
> 
> IIRC, we don't typically repeat the enum name. So:
> 
> enum StopSource { API, XPCMessage };
> 
> But I could be wrong.

Seems fine. I'll make that change.
Comment 5 Joseph Pecoraro 2014-04-08 16:41:49 PDT
Even better:

    enum class StopSource { API, XPCMessage };

And call sites use:

    StopSource::API, StopSource::XPCMessage
Comment 6 Joseph Pecoraro 2014-04-08 16:43:25 PDT
Created attachment 228914 [details]
[PATCH] For Landing
Comment 7 WebKit Commit Bot 2014-04-08 16:46:03 PDT
Attachment 228914 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/inspector/remote/RemoteInspector.h:68:  enum members should use InterCaps with an initial capital letter.  [readability/enum_casing] [4]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 WebKit Commit Bot 2014-04-08 17:12:37 PDT
Comment on attachment 228914 [details]
[PATCH] For Landing

Clearing flags on attachment: 228914

Committed r166982: <http://trac.webkit.org/changeset/166982>
Comment 9 WebKit Commit Bot 2014-04-08 17:12:42 PDT
All reviewed patches have been landed.  Closing bug.