Summary: | Web Inspector: cannot access `arguments` object from the console while debugger is paused | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Paul Miller <paul+bugs> | ||||
Component: | Web Inspector | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED DUPLICATE | ||||||
Severity: | Normal | CC: | burg, joepeck, timothy, webkit-bug-importer | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Attachments: |
|
Description
Paul Miller
2013-07-02 11:57:49 PDT
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 *** |