Bug 141475
| Summary: | Web Inspector: silent failure if introducing local variable in console when debugger paused | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Brian Burg <burg> |
| Component: | Web Inspector | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | ggaren, inspector-bugzilla-changes, jonowells, mark.lam, saam, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | 528+ (Nightly build) | ||
| Hardware: | All | ||
| OS: | All | ||
Brian Burg
When the debugger is paused, running
> var x = 42;
in the console will not actually assign x to a local variable. This is fine, except that the command silently fails. If you later type
> x
while still paused, a TypeError will be thrown. This is confusing if you don't know how the console/debugger is implemented.
So, should an error be thrown when a variable is introduced when debugger is paused, or should this work somehow?
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/19796707>
Saam Barati
I would expect this to just work while debugging.
Timothy Hatcher
To work with strict mode we have to make a closure and call eval() inside it while paused in the debugger.
http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js#L409
The closure captures the var and it is thrown away each time. We could potentially reuse it while paused. But we really just need JSC support to avoid this hack.
It we could use with() while in strict mode, then we wouldn't need the closure.
Joseph Pecoraro
So this code has changed a bunch.
I believe doing `var x` will work outside of strict mode code.
Using `let x` probably won't work in strict or non-strict. And `var` probably won't work in strict mode.
If we wanted this to work, we'd probably have to do some really tricky stuff. How do debuggers like lldb make this work? They store the result in a temporary variable, or you can create custom variables. Maybe we could approach this problem from that angle.