Changeset 35814 in webkit


Ignore:
Timestamp:
Aug 17, 2008 8:21:46 PM (16 years ago)
Author:
timothy@apple.com
Message:

Complete in scope variables in the Console when paused.

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

Reviewed by Geoffrey Garen.

  • page/inspector/Console.js: (WebInspector.Console.prototype.completions): If the expressionString is null or empty and the debugger is paused, call variablesInScopeForSelectedCallFrame to get an object that declares all the in scope variables. That way "top level" expressions are completed.
  • page/inspector/ScriptsPanel.js: (WebInspector.ScriptsPanel.prototype.variablesInScopeForSelectedCallFrame): Return an object that has all the variables that are in scope for the selected call frame. The value of each property is just true. The return object is useful for quick lookups or auto completion.
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r35811 r35814  
     12008-08-17  Timothy Hatcher  <timothy@apple.com>
     2
     3        Complete in scope variables in the Console when paused.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=19115
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        * page/inspector/Console.js:
     10        (WebInspector.Console.prototype.completions): If the expressionString
     11        is null or empty and the debugger is paused, call variablesInScopeForSelectedCallFrame
     12        to get an object that declares all the in scope variables. That way
     13        "top level" expressions are completed.
     14        * page/inspector/ScriptsPanel.js:
     15        (WebInspector.ScriptsPanel.prototype.variablesInScopeForSelectedCallFrame):
     16        Return an object that has all the variables that are in scope for the
     17        selected call frame. The value of each property is just true.
     18        The return object is useful for quick lookups or auto completion.
     19
    1202008-08-17  Cameron Zwarich  <cwzwarich@uwaterloo.ca>
    221
  • trunk/WebCore/page/inspector/Console.js

    r35788 r35814  
    201201            return;
    202202
    203         var result = InspectorController.inspectedWindow();
     203        var result;
    204204        if (expressionString) {
    205205            try {
     
    208208                // Do nothing, the prefix will be considered a window property.
    209209            }
     210        } else {
     211            // There is no expressionString, so the completion should happen against global properties.
     212            // Or if the debugger is paused, against properties in scope of the selected call frame.
     213            if (WebInspector.panels.scripts.paused)
     214                result = WebInspector.panels.scripts.variablesInScopeForSelectedCallFrame();
     215            else
     216                result = InspectorController.inspectedWindow();
    210217        }
    211218
  • trunk/WebCore/page/inspector/ScriptsPanel.js

    r34635 r35814  
    294294    },
    295295
     296    variablesInScopeForSelectedCallFrame: function()
     297    {
     298        var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame;
     299        if (!this._paused || !selectedCallFrame)
     300            return {};
     301
     302        var result = {};
     303        var scopeChain = selectedCallFrame.scopeChain;
     304        for (var i = 0; i < scopeChain.length; ++i) {
     305            var scopeObject = scopeChain[i];
     306            for (var property in scopeObject)
     307                result[property] = true;
     308        }
     309
     310        return result;
     311    },
     312
    296313    debuggerPaused: function()
    297314    {
Note: See TracChangeset for help on using the changeset viewer.