Bug 130032

Summary: Web Inspector: Hang in Remote Inspection triggering breakpoint from console
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ggaren, graouts, joepeck, timothy, webkit-bug-importer
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix timothy: review+

Description Joseph Pecoraro 2014-03-10 12:08:19 PDT
* SUMMARY
By hitting the breakpoint on our serial dispatch_queue for debuggable connections we run a nested runloop and block future tasks on that queue, including any incoming debugger commands!

* TEST:
<script>
function foo() {
    console.log('a');
    console.log('b');
    console.log('c');
}
</script>

* STEPS TO REPRODUCE
1. Remotely inspect test.
2. Set a breakpoint in foo (e.g. "b" line)
3. In console: js> foo();
  => Breakpoint is hit, and we can no longer do anything.
Comment 1 Joseph Pecoraro 2014-03-10 12:18:43 PDT
Created attachment 226328 [details]
[PATCH] Proposed Fix

This approach is modeled after the WebThreadRun queue with run loop source. It uses the CFMainRunLoop, which is fine because currently remote inspection requires a runloop.
Comment 2 Timothy Hatcher 2014-03-12 11:43:20 PDT
Comment on attachment 226328 [details]
[PATCH] Proposed Fix

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

> Source/JavaScriptCore/inspector/EventLoop.cpp:43
> +CFStringRef EventLoop::remoteInspectorRunLoopMode()
> +{
> +    return CFSTR("com.apple.JavaScriptCore.remote-inspector-runloop-mode");
> +}

This makes EventLoop more about Inspector than before. But it is in the inspector directory, so I guess it is fine.

> Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm:123
> +        CFRunLoopAddSource(CFRunLoopGetMain(), rwiRunLoopSource, kCFRunLoopDefaultMode);
> +        CFRunLoopAddSource(CFRunLoopGetMain(), rwiRunLoopSource, EventLoop::remoteInspectorRunLoopMode());

Needs added to both so paused and non-paused works? Maybe add a comment?
Comment 3 Joseph Pecoraro 2014-03-12 16:41:12 PDT
<http://trac.webkit.org/changeset/165508>