Changeset 83434 in webkit


Ignore:
Timestamp:
Apr 11, 2011 4:45:08 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

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):
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83429 r83434  
     12011-04-11  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: refactor / document call frames in debugger domain.
     6        https://bugs.webkit.org/show_bug.cgi?id=58187
     7
     8        Note that we are not special casing with(element) and with(document) anymore
     9        and do not tell user that it is "Event target" and "Event document". Strictly speaking,
     10        we should not have done it for with(element) not necessarily being related to an event.
     11
     12        * English.lproj/localizedStrings.js:
     13        * inspector/InjectedScriptSource.js:
     14        * inspector/Inspector.json:
     15        * inspector/front-end/ScopeChainSidebarPane.js:
     16        (WebInspector.ScopeChainSidebarPane.prototype.update):
     17
    1182011-04-10  ChangSeok Oh  <shivamidow@gmail.com>
    219
  • trunk/Source/WebCore/inspector/InjectedScriptSource.js

    r83290 r83434  
    300300            return false;
    301301   
    302         injectedScript.releaseObjectGroup("backtrace");
    303302        var result = [];
    304303        var depth = 0;
     
    488487        const CLOSURE_SCOPE = 3;
    489488        const CATCH_SCOPE = 4;
    490    
     489
     490        var scopeTypeNames = {};
     491        scopeTypeNames[GLOBAL_SCOPE] = "global";
     492        scopeTypeNames[LOCAL_SCOPE] = "local";
     493        scopeTypeNames[WITH_SCOPE] = "with";
     494        scopeTypeNames[CLOSURE_SCOPE] = "closure";
     495        scopeTypeNames[CATCH_SCOPE] = "catch";
     496
    491497        var scopeChain = callFrame.scopeChain;
    492498        var scopeChainProxy = [];
    493499        var foundLocalScope = false;
    494500        for (var i = 0; i < scopeChain.length; i++) {
     501            var scope = {};
     502            scope.object = injectedScript._wrapObject(scopeChain[i], "backtrace");
     503
    495504            var scopeType = callFrame.scopeType(i);
    496             var scopeObject = scopeChain[i];
    497             var scopeObjectProxy = injectedScript._wrapObject(scopeObject, "backtrace");
    498 
    499             switch(scopeType) {
    500                 case LOCAL_SCOPE: {
    501                     foundLocalScope = true;
    502                     scopeObjectProxy.isLocal = true;
    503                     scopeObjectProxy.thisObject = injectedScript._wrapObject(callFrame.thisObject, "backtrace");
    504                     break;
    505                 }
    506                 case CLOSURE_SCOPE: {
    507                     scopeObjectProxy.isClosure = true;
    508                     break;
    509                 }
    510                 case WITH_SCOPE:
    511                 case CATCH_SCOPE: {
    512                     if (foundLocalScope && scopeObject instanceof inspectedWindow.Element)
    513                         scopeObjectProxy.isElement = true;
    514                     else if (foundLocalScope && scopeObject instanceof inspectedWindow.Document)
    515                         scopeObjectProxy.isDocument = true;
    516                     else
    517                         scopeObjectProxy.isWithBlock = true;
    518                     break;
    519                 }
    520             }
    521             scopeChainProxy.push(scopeObjectProxy);
     505            scope.type = scopeTypeNames[scopeType];
     506
     507            if (scopeType === LOCAL_SCOPE)
     508                scope.this = injectedScript._wrapObject(callFrame.thisObject, "backtrace");
     509
     510            scopeChainProxy.push(scope);
    522511        }
    523512        return scopeChainProxy;
  • trunk/Source/WebCore/inspector/Inspector.json

    r83290 r83434  
    12411241                "type": "object",
    12421242                "properties": {
    1243                     "id": { "type": "string",  "description": "Call frame identifier" },
     1243                    "id": { "type": "string",  "description": "Call frame identifier." },
    12441244                    "functionName": { "type": "string", "description": "Name of the function called on this frame." },
    12451245                    "location": { "$ref": "Location", "description": "Location in the source code." },
    1246                     "scopeChain": { "type": "array", "items": { "type": "object" }, "description": "Scope chain for given call frame. // FIXME" }
     1246                    "scopeChain": { "type": "array", "items": { "$ref": "Scope" }, "description": "Scope chain for given call frame." }
     1247                },
     1248                "description": "Debugger call frame. Array of call frames form call stack."
     1249            },
     1250            {
     1251                "id": "Scope",
     1252                "type": "object",
     1253                "properties": {
     1254                    "type": { "type": "string",  "enum": ["global", "local", "with", "closure", "catch"], "description": "Scope type." },
     1255                    "object": { "$ref": "RemoteObject", "description": "Object representing the scope." },
     1256                    "this": { "$ref": "RemoteObject", "optional": true, "description": "<code>this</code> object for local scope." },
    12471257                },
    12481258                "description": "Debugger call frame. Array of call frames form call stack."
  • trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp

    r83290 r83434  
    315315void InspectorDebuggerAgent::resume(ErrorString*)
    316316{
     317    m_injectedScriptManager->releaseObjectGroup("backtrace");
    317318    scriptDebugServer().continueProgram();
    318319}
  • trunk/Source/WebCore/inspector/front-end/ScopeChainSidebarPane.js

    r76795 r83434  
    6060        var scopeChain = callFrame.scopeChain;
    6161        for (var i = 0; i < scopeChain.length; ++i) {
    62             var scopeObjectProxy = scopeChain[i];
     62            var scope = scopeChain[i];
    6363            var title = null;
    64             var subtitle = scopeObjectProxy.description;
     64            var subtitle = scope.object.description;
    6565            var emptyPlaceholder = null;
    6666            var extraProperties = null;
    6767
    68             if (scopeObjectProxy.isLocal) {
    69                 foundLocalScope = true;
    70                 title = WebInspector.UIString("Local");
    71                 emptyPlaceholder = WebInspector.UIString("No Variables");
    72                 subtitle = null;
    73                 if (scopeObjectProxy.thisObject)
    74                     extraProperties = [ new WebInspector.RemoteObjectProperty("this", WebInspector.RemoteObject.fromPayload(scopeObjectProxy.thisObject)) ];
    75             } else if (scopeObjectProxy.isClosure) {
    76                 title = WebInspector.UIString("Closure");
    77                 emptyPlaceholder = WebInspector.UIString("No Variables");
    78                 subtitle = null;
    79             } else if (i === (scopeChain.length - 1))
    80                 title = WebInspector.UIString("Global");
    81             else if (scopeObjectProxy.isElement)
    82                 title = WebInspector.UIString("Event Target");
    83             else if (scopeObjectProxy.isDocument)
    84                 title = WebInspector.UIString("Event Document");
    85             else if (scopeObjectProxy.isWithBlock)
    86                 title = WebInspector.UIString("With Block");
     68            switch (scope.type) {
     69                case "local":
     70                    foundLocalScope = true;
     71                    title = WebInspector.UIString("Local");
     72                    emptyPlaceholder = WebInspector.UIString("No Variables");
     73                    subtitle = null;
     74                    if (scope.this)
     75                        extraProperties = [ new WebInspector.RemoteObjectProperty("this", WebInspector.RemoteObject.fromPayload(scope.this)) ];
     76                    break;
     77                case "closure":
     78                    title = WebInspector.UIString("Closure");
     79                    emptyPlaceholder = WebInspector.UIString("No Variables");
     80                    subtitle = null;
     81                    break;
     82                case "catch":
     83                    title = WebInspector.UIString("Catch");
     84                    break;
     85                case "with":
     86                    title = WebInspector.UIString("With Block");
     87                    break;
     88                case "global":
     89                    title = WebInspector.UIString("Global");
     90                    break;
     91            }
    8792
    8893            if (!title || title === subtitle)
    8994                subtitle = null;
    9095
    91             var section = new WebInspector.ObjectPropertiesSection(WebInspector.RemoteObject.fromPayload(scopeObjectProxy), title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVariableTreeElement);
     96            var section = new WebInspector.ObjectPropertiesSection(WebInspector.RemoteObject.fromPayload(scope.object), title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVariableTreeElement);
    9297            section.editInSelectedCallFrameWhenPaused = true;
    9398            section.pane = this;
    9499
    95             if (!foundLocalScope || scopeObjectProxy.isLocal || title in this._expandedSections)
     100            if (!foundLocalScope || scope.type === "local" || title in this._expandedSections)
    96101                section.expanded = true;
    97102
Note: See TracChangeset for help on using the changeset viewer.