Skip to content
Permalink
Browse files
2011-04-11 Pavel Feldman <pfeldman@chromium.org>
        Reviewed by Yury Semikhatsky.

        Web Inspector: refactor / document call frames in debugger domain.
        https://bugs.webkit.org/show_bug.cgi?id=58187

        Note that we are not special casing with(element) and with(document) anymore
        and do not tell user that it is "Event target" and "Event document". Strictly speaking,
        we should not have done it for with(element) not necessarily being related to an event.

        * English.lproj/localizedStrings.js:
        * inspector/InjectedScriptSource.js:
        * inspector/Inspector.json:
        * inspector/front-end/ScopeChainSidebarPane.js:
        (WebInspector.ScopeChainSidebarPane.prototype.update):

Canonical link: https://commits.webkit.org/73206@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83434 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
pavelfeldman committed Apr 11, 2011
1 parent 88ceffc commit 30b10c87a3e18e9034d31e07b5753ccf1befc8b4
Showing 6 changed files with 75 additions and 53 deletions.
@@ -1,3 +1,20 @@
2011-04-11 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: refactor / document call frames in debugger domain.
https://bugs.webkit.org/show_bug.cgi?id=58187

Note that we are not special casing with(element) and with(document) anymore
and do not tell user that it is "Event target" and "Event document". Strictly speaking,
we should not have done it for with(element) not necessarily being related to an event.

* English.lproj/localizedStrings.js:
* inspector/InjectedScriptSource.js:
* inspector/Inspector.json:
* inspector/front-end/ScopeChainSidebarPane.js:
(WebInspector.ScopeChainSidebarPane.prototype.update):

2011-04-10 ChangSeok Oh <shivamidow@gmail.com>

Reviewed by Eric Seidel.
Binary file not shown.
@@ -299,7 +299,6 @@ InjectedScript.prototype = {
if (!callFrame)
return false;

injectedScript.releaseObjectGroup("backtrace");
var result = [];
var depth = 0;
do {
@@ -487,38 +486,28 @@ InjectedScript.CallFrameProxy.prototype = {
const WITH_SCOPE = 2;
const CLOSURE_SCOPE = 3;
const CATCH_SCOPE = 4;


var scopeTypeNames = {};
scopeTypeNames[GLOBAL_SCOPE] = "global";
scopeTypeNames[LOCAL_SCOPE] = "local";
scopeTypeNames[WITH_SCOPE] = "with";
scopeTypeNames[CLOSURE_SCOPE] = "closure";
scopeTypeNames[CATCH_SCOPE] = "catch";

var scopeChain = callFrame.scopeChain;
var scopeChainProxy = [];
var foundLocalScope = false;
for (var i = 0; i < scopeChain.length; i++) {
var scope = {};
scope.object = injectedScript._wrapObject(scopeChain[i], "backtrace");

var scopeType = callFrame.scopeType(i);
var scopeObject = scopeChain[i];
var scopeObjectProxy = injectedScript._wrapObject(scopeObject, "backtrace");

switch(scopeType) {
case LOCAL_SCOPE: {
foundLocalScope = true;
scopeObjectProxy.isLocal = true;
scopeObjectProxy.thisObject = injectedScript._wrapObject(callFrame.thisObject, "backtrace");
break;
}
case CLOSURE_SCOPE: {
scopeObjectProxy.isClosure = true;
break;
}
case WITH_SCOPE:
case CATCH_SCOPE: {
if (foundLocalScope && scopeObject instanceof inspectedWindow.Element)
scopeObjectProxy.isElement = true;
else if (foundLocalScope && scopeObject instanceof inspectedWindow.Document)
scopeObjectProxy.isDocument = true;
else
scopeObjectProxy.isWithBlock = true;
break;
}
}
scopeChainProxy.push(scopeObjectProxy);
scope.type = scopeTypeNames[scopeType];

if (scopeType === LOCAL_SCOPE)
scope.this = injectedScript._wrapObject(callFrame.thisObject, "backtrace");

scopeChainProxy.push(scope);
}
return scopeChainProxy;
}
@@ -1240,10 +1240,20 @@
"id": "CallFrame",
"type": "object",
"properties": {
"id": { "type": "string", "description": "Call frame identifier" },
"id": { "type": "string", "description": "Call frame identifier." },
"functionName": { "type": "string", "description": "Name of the function called on this frame." },
"location": { "$ref": "Location", "description": "Location in the source code." },
"scopeChain": { "type": "array", "items": { "type": "object" }, "description": "Scope chain for given call frame. // FIXME" }
"scopeChain": { "type": "array", "items": { "$ref": "Scope" }, "description": "Scope chain for given call frame." }
},
"description": "Debugger call frame. Array of call frames form call stack."
},
{
"id": "Scope",
"type": "object",
"properties": {
"type": { "type": "string", "enum": ["global", "local", "with", "closure", "catch"], "description": "Scope type." },
"object": { "$ref": "RemoteObject", "description": "Object representing the scope." },
"this": { "$ref": "RemoteObject", "optional": true, "description": "<code>this</code> object for local scope." },
},
"description": "Debugger call frame. Array of call frames form call stack."
}
@@ -314,6 +314,7 @@ void InspectorDebuggerAgent::pause(ErrorString*)

void InspectorDebuggerAgent::resume(ErrorString*)
{
m_injectedScriptManager->releaseObjectGroup("backtrace");
scriptDebugServer().continueProgram();
}

@@ -59,40 +59,45 @@ WebInspector.ScopeChainSidebarPane.prototype = {
var foundLocalScope = false;
var scopeChain = callFrame.scopeChain;
for (var i = 0; i < scopeChain.length; ++i) {
var scopeObjectProxy = scopeChain[i];
var scope = scopeChain[i];
var title = null;
var subtitle = scopeObjectProxy.description;
var subtitle = scope.object.description;
var emptyPlaceholder = null;
var extraProperties = null;

if (scopeObjectProxy.isLocal) {
foundLocalScope = true;
title = WebInspector.UIString("Local");
emptyPlaceholder = WebInspector.UIString("No Variables");
subtitle = null;
if (scopeObjectProxy.thisObject)
extraProperties = [ new WebInspector.RemoteObjectProperty("this", WebInspector.RemoteObject.fromPayload(scopeObjectProxy.thisObject)) ];
} else if (scopeObjectProxy.isClosure) {
title = WebInspector.UIString("Closure");
emptyPlaceholder = WebInspector.UIString("No Variables");
subtitle = null;
} else if (i === (scopeChain.length - 1))
title = WebInspector.UIString("Global");
else if (scopeObjectProxy.isElement)
title = WebInspector.UIString("Event Target");
else if (scopeObjectProxy.isDocument)
title = WebInspector.UIString("Event Document");
else if (scopeObjectProxy.isWithBlock)
title = WebInspector.UIString("With Block");
switch (scope.type) {
case "local":
foundLocalScope = true;
title = WebInspector.UIString("Local");
emptyPlaceholder = WebInspector.UIString("No Variables");
subtitle = null;
if (scope.this)
extraProperties = [ new WebInspector.RemoteObjectProperty("this", WebInspector.RemoteObject.fromPayload(scope.this)) ];
break;
case "closure":
title = WebInspector.UIString("Closure");
emptyPlaceholder = WebInspector.UIString("No Variables");
subtitle = null;
break;
case "catch":
title = WebInspector.UIString("Catch");
break;
case "with":
title = WebInspector.UIString("With Block");
break;
case "global":
title = WebInspector.UIString("Global");
break;
}

if (!title || title === subtitle)
subtitle = null;

var section = new WebInspector.ObjectPropertiesSection(WebInspector.RemoteObject.fromPayload(scopeObjectProxy), title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVariableTreeElement);
var section = new WebInspector.ObjectPropertiesSection(WebInspector.RemoteObject.fromPayload(scope.object), title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVariableTreeElement);
section.editInSelectedCallFrameWhenPaused = true;
section.pane = this;

if (!foundLocalScope || scopeObjectProxy.isLocal || title in this._expandedSections)
if (!foundLocalScope || scope.type === "local" || title in this._expandedSections)
section.expanded = true;

this._sections.push(section);

0 comments on commit 30b10c8

Please sign in to comment.