Bug 130032 - Web Inspector: Hang in Remote Inspection triggering breakpoint from console
Summary: Web Inspector: Hang in Remote Inspection triggering breakpoint from console
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-10 12:08 PDT by Joseph Pecoraro
Modified: 2014-03-12 16:41 PDT (History)
5 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (10.22 KB, patch)
2014-03-10 12:18 PDT, Joseph Pecoraro
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>