Bug 34161

Summary: Local scope is shown as With scope in scope chain pane
Product: WebKit Reporter: Yury Semikhatsky <yurys>
Component: Web Inspector (Deprecated)Assignee: Yury Semikhatsky <yurys>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, oliver, pfeldman, timothy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
patch
none
patch
none
patch none

Description Yury Semikhatsky 2010-01-26 04:40:48 PST
When debugger is paused on a breakpoint Local scope is displayed as With scope and 'this' variable is missing in it. This is a regression after http://trac.webkit.org/changeset/53766
Comment 1 Oliver Hunt 2010-01-26 12:17:15 PST
Any word on this?
Comment 2 Oliver Hunt 2010-01-26 12:25:20 PST
This only happens if the global object has a property with the same name of a variable in the scope chain :-/
Comment 3 Yury Semikhatsky 2010-01-27 08:23:24 PST
Created attachment 47538 [details]
patch
Comment 4 Yury Semikhatsky 2010-01-27 08:34:33 PST
Created attachment 47539 [details]
patch

Added ChangeLog entry.
Comment 5 Oliver Hunt 2010-01-27 08:36:05 PST
Comment on attachment 47539 [details]
patch

r=me
Comment 6 Yury Semikhatsky 2010-01-27 11:30:51 PST
Comment on attachment 47539 [details]
patch

Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebCore/ChangeLog
	M	WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
	M	WebCore/inspector/InjectedScriptHost.idl
	M	WebCore/inspector/front-end/InjectedScript.js
	A	WebCore/manual-tests/inspector/debugger-scopes-inspection.html
Committed r53945
Comment 7 Darin Adler 2010-01-27 12:48:35 PST
Comment on attachment 47539 [details]
patch

> +JSValue JSInjectedScriptHost::isActivation(ExecState* exec, const ArgList& args)
> +{
> +    if (args.size() < 1)
> +        return jsUndefined();
> +
> +    JSValue value = args.at(0);
> +    if (!value.isObject())
> +        return jsBoolean(false);
> +
> +    JSObject* object = value.toObject(exec);
> +    return jsBoolean(object->isActivationObject());

This is unnecessarily inefficient. There is no need to check args.size() at all, since args.at(0) already does. And the toObject function is not needed for a value already known to be an object. The function could be this:

    JSObject* object = args.at(0).getObject();
    return jsBoolean(object && object->isActivationObject());
Comment 8 Yury Semikhatsky 2010-01-28 01:06:16 PST
Created attachment 47598 [details]
patch

isActivation code is simplified according to Darin's suggestion.
Comment 9 Yury Semikhatsky 2010-01-28 01:06:58 PST
I'd like to improve the code.
Comment 10 WebKit Commit Bot 2010-01-28 02:46:33 PST
Comment on attachment 47598 [details]
patch

Clearing flags on attachment: 47598

Committed r53993: <http://trac.webkit.org/changeset/53993>
Comment 11 WebKit Commit Bot 2010-01-28 02:46:40 PST
All reviewed patches have been landed.  Closing bug.