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]
<rdar://problem/14335152>
Yep, this was a sacrifice to make strict mode debugging work.
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?
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.
*** This bug has been marked as a duplicate of bug 121208 ***