RESOLVED DUPLICATE of bug 121208 118314
Web Inspector: cannot access `arguments` object from the console while debugger is paused
https://bugs.webkit.org/show_bug.cgi?id=118314
Summary Web Inspector: cannot access `arguments` object from the console while debugg...
Paul Miller
Reported 2013-07-02 11:57:49 PDT
set a breakpoint in function, execute `arguments` in console. You will get an array with 22 elements: [function eval() { [native code] }, "arguments", function $$() { [Command Line API] }, function $x() { [Command Line API] }, function dir() { [Command Line API] }, function dirxml() { [Command Line API] }, function keys() { [Command Line API] }, function values() { [Command Line API] }, function profile() { [Command Line API] }, function profileEnd() { [Command Line API] }, function monitorEvents() { [Command Line API] }, function unmonitorEvents() { [Command Line API] }, function inspect() { [Command Line API] }, function copy() { [Command Line API] }, function clear() { [Command Line API] }, function getEventListeners() { [Command Line API] }, <body style>…</body> , undefined, undefined, undefined, undefined, undefined]
Attachments
Right arguments in the sidebar (151.94 KB, image/png)
2015-01-08 18:50 PST, Nikita Vasilyev
no flags
Radar WebKit Bug Importer
Comment 1 2013-07-02 11:58:14 PDT
Timothy Hatcher
Comment 2 2013-07-02 12:01:19 PDT
Yep, this was a sacrifice to make strict mode debugging work.
Nikita Vasilyev
Comment 3 2015-01-08 18:50:06 PST
Created attachment 244313 [details] Right arguments in the sidebar How come we can show the right arguments on the right sidebar but the wrong ones in the console and while hovering over `arguments` in the source code?
Joseph Pecoraro
Comment 4 2015-01-08 19:13:01 PST
Evaluating in the console is doing some very non-trivial stuff. Check out InjectedScript.prototype._evaluteOn in Source/JavaScriptCore/inspector/InjectedScriptSource.js. If you say "arguments" in the console it is boiling down to something like this: > var expressionFunctionBody = "" + > "var global = Function('return this')() || (1, eval)('this');" + > "var __originalEval = global.eval; global.eval = __eval;" + > "try { return eval(__currentExpression); }" + > "finally { global.eval = __originalEval; }"; > > var expressionFunctionString = "(function(__eval, __currentExpression, " + parameterNames.join(", ") + ") { " + expressionFunctionBody + " })"; > var boundExpressionFunctionString = "(function(__function, __thisObject) { return function() { return __function.apply(__thisObject, arguments) }; })(" + expressionFunctionString + ", this)"; > > var parameters = [InjectedScriptHost.evaluate, expression]; > var expressionFunction = evalFunction.call(object, boundExpressionFunctionString); > var result = expressionFunction.apply(null, parameters); You may be able to see some of this if you sprinkle around some "//# sourceURL=foo". The Scope Chain sidebar values are populated from the actual scope chain objects from JavaScriptCore.
Timothy Hatcher
Comment 5 2015-01-10 10:17:37 PST
*** This bug has been marked as a duplicate of bug 121208 ***
Note You need to log in before you can comment on or make changes to this bug.