Bug 113607 - REGRESSION(r146840): At breakpoints, inspector's "this" refers to JavaScriptCallFrame
Summary: REGRESSION(r146840): At breakpoints, inspector's "this" refers to JavaScriptC...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-03-29 13:52 PDT by Vicki Pfau
Modified: 2013-04-01 13:31 PDT (History)
5 users (show)

See Also:


Attachments
Proposed Change (6.18 KB, patch)
2013-03-29 18:32 PDT, Timothy Hatcher
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vicki Pfau 2013-03-29 13:52:50 PDT
Starting in r146840, attempting to use the "this" object in the Web Inspector while at a breakpoint will reveal the JavaScriptCallFrame object instead of the "this" object that is currently in the scope of the execution state.
Comment 1 Radar WebKit Bug Importer 2013-03-29 13:53:02 PDT
<rdar://problem/13538351>
Comment 2 Timothy Hatcher 2013-03-29 18:32:08 PDT
Created attachment 195834 [details]
Proposed Change
Comment 3 Joseph Pecoraro 2013-04-01 11:13:47 PDT
Comment on attachment 195834 [details]
Proposed Change

View in context: https://bugs.webkit.org/attachment.cgi?id=195834&action=review

Change looks good. It might be nice to create a test for this.

> Source/WebCore/inspector/InjectedScriptSource.js:583
> +            // Bind 'this' to the function expression using another closure instead of Function.prototype.bind. This ensures things will work if the page replaces bind.
> +            var boundExpressionFunctionString = "(function(__function, __thisObject) { return function() { return __function.apply(__thisObject, arguments) }; })(" + expressionFunctionString + ", this)";
> +            var expressionFunction = evalFunction.call(object, boundExpressionFunctionString);
> +            var result = expressionFunction.apply(null, parameters);

Hmm, there are uses of Function.prototype.apply and Function.prototype.call here which can be overridden by the page. We may need to look into providing those from the backend like evalFunction.
Comment 4 WebKit Review Bot 2013-04-01 13:31:26 PDT
Comment on attachment 195834 [details]
Proposed Change

Clearing flags on attachment: 195834

Committed r147356: <http://trac.webkit.org/changeset/147356>
Comment 5 WebKit Review Bot 2013-04-01 13:31:30 PDT
All reviewed patches have been landed.  Closing bug.