NEW141475
Web Inspector: silent failure if introducing local variable in console when debugger paused
https://bugs.webkit.org/show_bug.cgi?id=141475
Summary Web Inspector: silent failure if introducing local variable in console when d...
Brian Burg
Reported 2015-02-11 08:21:34 PST
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
Radar WebKit Bug Importer
Comment 1 2015-02-11 08:21:54 PST
Saam Barati
Comment 2 2015-02-11 10:47:50 PST
I would expect this to just work while debugging.
Timothy Hatcher
Comment 3 2015-02-12 09:24:54 PST
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
Comment 4 2016-05-20 11:42:28 PDT
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.
Note You need to log in before you can comment on or make changes to this bug.