Commit 99b9ed9f authored by yurys@chromium.org's avatar yurys@chromium.org

2010-01-27 Yury Semikhatsky <yurys@chromium.org>

        Reviewed by Oliver Hunt.

        Instead of relying on Object.prototype.toString result use JSObject::isActivationObject
        to check if a scope node is a JSActivation. Object.prototype.toString for JSActivation
        will call JSActivation::toThisObject whose result depends on the current call stack.

        https://bugs.webkit.org/show_bug.cgi?id=34161

        Test: WebCore/manual-tests/inspector/debugger-scopes-inspection.html

        * bindings/js/JSInjectedScriptHostCustom.cpp:
        (WebCore::JSInjectedScriptHost::isActivation):
        * inspector/InjectedScriptHost.idl:
        * inspector/front-end/InjectedScript.js:
        (injectedScriptConstructor.):
        * manual-tests/inspector/debugger-scopes-inspection.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53945 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2e1771cf
2010-01-27 Yury Semikhatsky <yurys@chromium.org>
Reviewed by Oliver Hunt.
Instead of relying on Object.prototype.toString result use JSObject::isActivationObject
to check if a scope node is a JSActivation. Object.prototype.toString for JSActivation
will call JSActivation::toThisObject whose result depends on the current call stack.
https://bugs.webkit.org/show_bug.cgi?id=34161
Test: WebCore/manual-tests/inspector/debugger-scopes-inspection.html
* bindings/js/JSInjectedScriptHostCustom.cpp:
(WebCore::JSInjectedScriptHost::isActivation):
* inspector/InjectedScriptHost.idl:
* inspector/front-end/InjectedScript.js:
(injectedScriptConstructor.):
* manual-tests/inspector/debugger-scopes-inspection.html: Added.
2010-01-27 Anton Muhin <antonm@google.com>
Review by Adam Barth.
......@@ -126,6 +126,19 @@ JSValue JSInjectedScriptHost::currentCallFrame(ExecState* exec, const ArgList&)
return toJS(exec, callFrame);
}
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());
}
#endif
JSValue JSInjectedScriptHost::nodeForId(ExecState* exec, const ArgList& args)
......
......@@ -43,6 +43,7 @@ module core {
#if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
[Custom] DOMObject currentCallFrame();
[Custom] boolean isActivation(in DOMObject object);
#endif
#if defined(ENABLE_DATABASE) && ENABLE_DATABASE
......
......@@ -1182,7 +1182,7 @@ InjectedScript.CallFrameProxy.prototype = {
var scopeObject = scopeChain[i];
var scopeObjectProxy = InjectedScript.createProxyObject(scopeObject, { callFrame: this.id, chainIndex: i }, true);
if (Object.prototype.toString.call(scopeObject) === "[object JSActivation]") {
if (InjectedScriptHost.isActivation(scopeObject)) {
if (!foundLocalScope)
scopeObjectProxy.thisObject = InjectedScript.createProxyObject(callFrame.thisObject, { callFrame: this.id, thisObject: true }, true);
else
......
<script>
var obj = {
objField: 30
};
function handleLoad(e) {
new C().m();
}
function C() {
this.a = 10;
this.timestamp = Date.now();
}
C.prototype.m = function() {
this.timestamp = Date.now();
with (obj) {
debugger;
objField++;
}
var self = this;
setTimeout(function() {
self.m();
}, 1000);
};
</script>
<body onload="handleLoad(event)">
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=34161"> Bug 34161 - Local scope is shown as With scope in scope chain pane </a>.</p>
<p>To test, open the Inspector and start a debugging session. In a second debugger will pause. While paused look at scope chain pane. There should be three scopes: 'With scope' containing objField variable, 'Local scope' with this and self variables and 'Global scope'. All scopes but 'Global' should be expanced. 'Global' scope should be collapsed(it takes too long to expand DOMWindow so we prefer to do it on demand). </p>
</body>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment