Title: [86768] trunk
Revision
86768
Author
[email protected]
Date
2011-05-18 08:52:57 -0700 (Wed, 18 May 2011)

Log Message

2011-05-18  Pavel Feldman  <[email protected]>

        Reviewed by Yury Semikhatsky.

        Web Inspector: [REGRESSION] Completion while on a breakpoint is not working.
        https://bugs.webkit.org/show_bug.cgi?id=60811

        * inspector/debugger/debugger-completions-on-call-frame-expected.txt: Added.
        * inspector/debugger/debugger-completions-on-call-frame.html: Added.
2011-05-18  Pavel Feldman  <[email protected]>

        Reviewed by Yury Semikhatsky.

        Web Inspector: [REGRESSION] Completion while on a breakpoint is not working.
        https://bugs.webkit.org/show_bug.cgi?id=60811

        Test: inspector/debugger/debugger-completions-on-call-frame.html

        * inspector/InjectedScriptSource.js:
        * inspector/front-end/ConsoleView.js:
        (WebInspector.ConsoleView.prototype.completions.else.evaluated):
        * inspector/front-end/DebuggerPresentationModel.js:
        (WebInspector.PresenationCallFrame.prototype.get variables):
        * inspector/front-end/ScriptsPanel.js:
        (WebInspector.ScriptsPanel.prototype.selectedCallFrameVariables):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (86767 => 86768)


--- trunk/LayoutTests/ChangeLog	2011-05-18 15:47:33 UTC (rev 86767)
+++ trunk/LayoutTests/ChangeLog	2011-05-18 15:52:57 UTC (rev 86768)
@@ -1,3 +1,13 @@
+2011-05-18  Pavel Feldman  <[email protected]>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: [REGRESSION] Completion while on a breakpoint is not working.
+        https://bugs.webkit.org/show_bug.cgi?id=60811
+
+        * inspector/debugger/debugger-completions-on-call-frame-expected.txt: Added.
+        * inspector/debugger/debugger-completions-on-call-frame.html: Added.
+
 2011-05-18  Nikolas Zimmermann  <[email protected]>
 
         Reviewed by Rob Buis.

Added: trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame-expected.txt (0 => 86768)


--- trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame-expected.txt	2011-05-18 15:52:57 UTC (rev 86768)
@@ -0,0 +1,14 @@
+Test that completions in the context of the call frame will result in names of its scope variables.
+
+Debugger was enabled.
+Set timer for test function.
+Script execution paused.
+var1
+var2
+dir
+dirxml
+window
+this
+Script execution resumed.
+Debugger was disabled.
+
Property changes on: trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame.html (0 => 86768)


--- trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame.html	2011-05-18 15:52:57 UTC (rev 86768)
@@ -0,0 +1,71 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+var a = 1;
+function testFunction()
+{
+    var var1 = 2;
+    var var2 = 3;
+    debugger;
+}
+
+var test = function()
+{
+    InspectorTest.startDebuggerTest(step1);
+
+    function step1()
+    {
+        InspectorTest.runTestFunctionAndWaitUntilPaused(step2);
+    }
+
+    function step2()
+    {
+        WebInspector.console._completions("", "var", false, checkAgainstGolden.bind(this, [ "var1", "var2" ], step3));
+    }
+
+    function step3()
+    {
+        WebInspector.console._completions("", "di", false, checkAgainstGolden.bind(this, [ "dir", "dirxml" ], step4));
+    }
+
+    function step4()
+    {
+        WebInspector.console._completions("", "win", false, checkAgainstGolden.bind(this, [ "window" ], step5));
+    }
+
+    function step5()
+    {
+        WebInspector.console._completions("", "t", false, checkAgainstGolden.bind(this, [ "this" ], step6));
+    }
+
+    function step6()
+    {
+        InspectorTest.completeDebuggerTest();
+    }
+
+    function checkAgainstGolden(golden, continuation, completions)
+    {
+        for (var i = 0; i < golden.length; ++i) {
+            if (completions.indexOf(golden[i]) !== -1)
+                InspectorTest.addResult(golden[i]);
+            else
+                InspectorTest.addResult("NOT FOUND: " + golden[i]);
+        }
+        continuation();
+    }
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Test that completions in the context of the call frame will result in names
+of its scope variables.
+</p>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/debugger/debugger-completions-on-call-frame.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (86767 => 86768)


--- trunk/Source/WebCore/ChangeLog	2011-05-18 15:47:33 UTC (rev 86767)
+++ trunk/Source/WebCore/ChangeLog	2011-05-18 15:52:57 UTC (rev 86768)
@@ -1,3 +1,20 @@
+2011-05-18  Pavel Feldman  <[email protected]>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: [REGRESSION] Completion while on a breakpoint is not working.
+        https://bugs.webkit.org/show_bug.cgi?id=60811
+
+        Test: inspector/debugger/debugger-completions-on-call-frame.html
+
+        * inspector/InjectedScriptSource.js:
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype.completions.else.evaluated):
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.PresenationCallFrame.prototype.get variables):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype.selectedCallFrameVariables):
+
 2011-05-18  Nikolas Zimmermann  <[email protected]>
 
         Reviewed by Rob Buis.

Modified: trunk/Source/WebCore/inspector/front-end/ConsoleView.js (86767 => 86768)


--- trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2011-05-18 15:47:33 UTC (rev 86767)
+++ trunk/Source/WebCore/inspector/front-end/ConsoleView.js	2011-05-18 15:52:57 UTC (rev 86768)
@@ -350,6 +350,12 @@
         // Pass less stop characters to rangeOfWord so the range will be a more complete _expression_.
         var expressionRange = wordRange.startContainer.rangeOfWord(wordRange.startOffset, ExpressionStopCharacters, this.promptElement, "backward");
         var expressionString = expressionRange.toString();
+        var prefix = wordRange.toString();
+        this._completions(expressionString, prefix, bestMatchOnly, completionsReadyCallback);
+    },
+
+    _completions: function(expressionString, prefix, bestMatchOnly, completionsReadyCallback)
+    {
         var lastIndex = expressionString.length - 1;
 
         var dotNotation = (expressionString[lastIndex] === ".");
@@ -358,11 +364,13 @@
         if (dotNotation || bracketNotation)
             expressionString = expressionString.substr(0, lastIndex);
 
-        var prefix = wordRange.toString();
         if (!expressionString && !prefix)
             return;
 
-        this.evalInInspectedWindow(expressionString, "completion", true, evaluated.bind(this));
+        if (!expressionString && WebInspector.panels.scripts.paused)
+            WebInspector.panels.scripts.getSelectedCallFrameVariables(reportCompletions.bind(this));
+        else
+            this.evalInInspectedWindow(expressionString, "completion", true, evaluated.bind(this));
 
         function evaluated(result, wasThrown)
         {
@@ -374,14 +382,22 @@
         function evaluatedProperties(properties)
         {
             RuntimeAgent.releaseObjectGroup("completion");
-            var propertyNames = [];
+            var propertyNames = {};
             for (var i = 0; properties && i < properties.length; ++i)
-                propertyNames.push(properties[i].name);
+                propertyNames[properties[i].name] = true;
+            reportCompletions.call(this, propertyNames);
+        }
 
+        function reportCompletions(propertyNames)
+        {
             var includeCommandLineAPI = (!dotNotation && !bracketNotation);
-            if (includeCommandLineAPI)
-                propertyNames.splice(0, 0, "dir", "dirxml", "keys", "values", "profile", "profileEnd", "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear");
-            this._reportCompletions(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, propertyNames);
+            if (includeCommandLineAPI) {
+                const commandLineAPI = ["dir", "dirxml", "keys", "values", "profile", "profileEnd", "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear"];
+                for (var i = 0; i < commandLineAPI.length; ++i)
+                    propertyNames[commandLineAPI[i]] = true;
+            }
+            
+            this._reportCompletions(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, Object.keys(propertyNames));
         }
     },
 

Modified: trunk/Source/WebCore/inspector/front-end/RemoteObject.js (86767 => 86768)


--- trunk/Source/WebCore/inspector/front-end/RemoteObject.js	2011-05-18 15:47:33 UTC (rev 86767)
+++ trunk/Source/WebCore/inspector/front-end/RemoteObject.js	2011-05-18 15:52:57 UTC (rev 86768)
@@ -125,8 +125,10 @@
         }
         function remoteObjectBinder(error, properties)
         {
-            if (error)
+            if (error) {
+                callback(null);
                 return;
+            }
             for (var i = 0; properties && i < properties.length; ++i)
                 properties[i].value = WebInspector.RemoteObject.fromPayload(properties[i].value);
             callback(properties);

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (86767 => 86768)


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-05-18 15:47:33 UTC (rev 86767)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-05-18 15:52:57 UTC (rev 86768)
@@ -376,6 +376,32 @@
         selectedCallFrame.evaluate(code, objectGroup, includeCommandLineAPI, callback);
     },
 
+    getSelectedCallFrameVariables: function(callback)
+    {
+        var result = { this: true };
+
+        var selectedCallFrame = this._presentationModel.selectedCallFrame;
+        if (!selectedCallFrame)
+            callback(result);
+
+        var pendingRequests = 0;
+
+        function propertiesCollected(properties)
+        {
+            for (var i = 0; properties && i < properties.length; ++i)
+                result[properties[i].name] = true;
+            if (--pendingRequests == 0)
+                callback(result);
+        }
+
+        for (var i = 0; i < selectedCallFrame.scopeChain.length; ++i) {
+            var scope = selectedCallFrame.scopeChain[i];
+            var object = WebInspector.RemoteObject.fromPayload(scope.object);
+            pendingRequests++;
+            object.getAllProperties(propertiesCollected);
+        }
+    },
+
     _debuggerPaused: function(event)
     {
         var callFrames = event.data.callFrames;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to