Web Inspector: [Regression] Execution line is not revealed when debugger is stopped...
authorvsevik@chromium.org <vsevik@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Mar 2012 12:28:57 +0000 (12:28 +0000)
committervsevik@chromium.org <vsevik@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Mar 2012 12:28:57 +0000 (12:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=80306

Reviewed by Pavel Feldman.

Source/WebCore:

Test: inspector/debugger/reveal-execution-line.html

* inspector/front-end/ConsoleView.js:
* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.DebuggerPresentationModel.prototype._debuggerPaused):
* inspector/front-end/JavaScriptSourceFrame.js:
(WebInspector.JavaScriptSourceFrame.prototype.afterTextChanged):
(WebInspector.JavaScriptSourceFrame.prototype.setExecutionLine):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._executionLineChanged):
(WebInspector.ScriptsPanel.prototype._revealExecutionLine):
(WebInspector.ScriptsPanel.prototype._callFrameSelected):
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame.prototype.willHide):
(WebInspector.SourceFrame.prototype.highlightLine):
(WebInspector.SourceFrame.prototype.revealLine):
(WebInspector.SourceFrame.prototype._clearLineToReveal):
(WebInspector.SourceFrame.prototype.setContent):

LayoutTests:

* inspector/debugger/callstack-placards-discarded-expected.txt:
* inspector/debugger/reveal-execution-line-expected.txt: Added.
* inspector/debugger/reveal-execution-line.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@109903 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/debugger/callstack-placards-discarded-expected.txt
LayoutTests/inspector/debugger/reveal-execution-line-expected.txt [new file with mode: 0644]
LayoutTests/inspector/debugger/reveal-execution-line.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/ConsoleView.js
Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js
Source/WebCore/inspector/front-end/ScriptsPanel.js
Source/WebCore/inspector/front-end/SourceFrame.js

index bd37422..01d8b1e 100644 (file)
@@ -1,3 +1,14 @@
+2012-03-06  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Web Inspector: [Regression] Execution line is not revealed when debugger is stopped if scripts panel was not yet shown.
+        https://bugs.webkit.org/show_bug.cgi?id=80306
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/debugger/callstack-placards-discarded-expected.txt:
+        * inspector/debugger/reveal-execution-line-expected.txt: Added.
+        * inspector/debugger/reveal-execution-line.html: Added.
+
 2012-03-06  Pavel Podivilov  <podivilov@chromium.org>
 
         Web Inspector: remove reference to RawSourceCode from UISourceCode.
index f5bc45c..e166400 100644 (file)
@@ -7,13 +7,13 @@ Script source was shown.
 Set timer for test function.
 Received DebuggerPaused event.
 Function name: testFunction
-Listeners length: 3
+Listeners length: 2
 Script execution paused.
 Script execution resumed.
 Set timer for test function.
 Received DebuggerPaused event.
 Function name: testFunction
-Listeners length: 3
+Listeners length: 2
 Script execution paused.
 Script execution resumed.
 Debugger was disabled.
diff --git a/LayoutTests/inspector/debugger/reveal-execution-line-expected.txt b/LayoutTests/inspector/debugger/reveal-execution-line-expected.txt
new file mode 100644 (file)
index 0000000..386ffb2
--- /dev/null
@@ -0,0 +1,10 @@
+Tests that execution line is revealed and highlighted when debugger is paused.
+
+Bug 80306
+Debugger was enabled.
+
+Running: testRevealAndHighlightExecutionLine
+Set timer for test function.
+Execution line revealed and highlighted.
+Debugger was disabled.
+
diff --git a/LayoutTests/inspector/debugger/reveal-execution-line.html b/LayoutTests/inspector/debugger/reveal-execution-line.html
new file mode 100644 (file)
index 0000000..bfb44c8
--- /dev/null
@@ -0,0 +1,61 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/debugger-test.js"></script>
+<script>
+function testFunction()
+{
+    debugger;
+}
+
+var test = function()
+{
+    InspectorTest.setQuiet(true);
+    InspectorTest.runDebuggerTestSuite([
+        function testRevealAndHighlightExecutionLine(next)
+        {
+            var executionLineSet = false;
+            var executionLineRevealed = false;
+            InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "revealLine", didRevealLine);
+            InspectorTest.addSniffer(WebInspector.JavaScriptSourceFrame.prototype, "setExecutionLine", didSetExecutionLine);
+            InspectorTest.runTestFunctionAndWaitUntilPaused(didPaused);
+
+            function didPaused(callFrames)
+            {
+            }
+
+            function didSetExecutionLine(line)
+            {
+                if (executionLineSet)
+                    return;
+                executionLineSet = true;
+                maybeNext();
+            }
+
+            function didRevealLine(line)
+            {
+                if (executionLineRevealed)
+                    return;
+                if (this.isShowing()) {
+                    executionLineRevealed = true;
+                    maybeNext();
+                }
+            }
+
+            function maybeNext()
+            {
+                if (executionLineRevealed && executionLineSet) {
+                    InspectorTest.addResult("Execution line revealed and highlighted.");
+                    InspectorTest.resumeExecution(next);
+                }
+            }
+        }
+    ]);
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests that execution line is revealed and highlighted when debugger is paused.</p>
+<a href="https://bugs.webkit.org/show_bug.cgi?id=80306">Bug 80306</a>
+</body>
+</html>
index 2eb7a5e..530558d 100644 (file)
@@ -1,3 +1,29 @@
+2012-03-06  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Web Inspector: [Regression] Execution line is not revealed when debugger is stopped if scripts panel was not yet shown.
+        https://bugs.webkit.org/show_bug.cgi?id=80306
+
+        Reviewed by Pavel Feldman.
+
+        Test: inspector/debugger/reveal-execution-line.html
+
+        * inspector/front-end/ConsoleView.js:
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.DebuggerPresentationModel.prototype._debuggerPaused):
+        * inspector/front-end/JavaScriptSourceFrame.js:
+        (WebInspector.JavaScriptSourceFrame.prototype.afterTextChanged):
+        (WebInspector.JavaScriptSourceFrame.prototype.setExecutionLine):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._executionLineChanged):
+        (WebInspector.ScriptsPanel.prototype._revealExecutionLine):
+        (WebInspector.ScriptsPanel.prototype._callFrameSelected):
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame.prototype.willHide):
+        (WebInspector.SourceFrame.prototype.highlightLine):
+        (WebInspector.SourceFrame.prototype.revealLine):
+        (WebInspector.SourceFrame.prototype._clearLineToReveal):
+        (WebInspector.SourceFrame.prototype.setContent):
+
 2012-03-06  Pavel Podivilov  <podivilov@chromium.org>
 
         Web Inspector: remove reference to RawSourceCode from UISourceCode.
index b777ade..c346052 100644 (file)
@@ -372,7 +372,7 @@ WebInspector.ConsoleView.prototype = {
             return;
         }
 
-        if (!expressionString && WebInspector.debuggerPresentationModel.paused)
+        if (!expressionString && WebInspector.debuggerPresentationModel.selectedCallFrame)
             WebInspector.debuggerPresentationModel.getSelectedCallFrameVariables(receivedPropertyNames.bind(this));
         else
             this.evalInInspectedWindow(expressionString, "completion", true, true, false, evaluated.bind(this));
@@ -592,7 +592,7 @@ WebInspector.ConsoleView.prototype = {
      */
     evalInInspectedWindow: function(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptions, returnByValue, callback)
     {
-        if (WebInspector.debuggerPresentationModel.paused) {
+        if (WebInspector.debuggerPresentationModel.selectedCallFrame) {
             WebInspector.debuggerPresentationModel.evaluateInSelectedCallFrame(expression, objectGroup, includeCommandLineAPI, returnByValue, callback);
             return;
         }
index a024b31..b19fa24 100644 (file)
@@ -556,8 +556,8 @@ WebInspector.DebuggerPresentationModel.prototype = {
             this._presentationCallFrames.push(new WebInspector.PresentationCallFrame(callFrame, i, this, rawSourceCode));
         }
         var details = WebInspector.debuggerModel.debuggerPausedDetails;
-        this.selectedCallFrame = this._presentationCallFrames[0];
         this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.DebuggerPaused, { callFrames: this._presentationCallFrames, details: details });
+        this.selectedCallFrame = this._presentationCallFrames[0];
     },
 
     _debuggerResumed: function()
index c8b9528..0b6fc18 100644 (file)
@@ -169,7 +169,7 @@ WebInspector.JavaScriptSourceFrame.prototype = {
         if (typeof this._executionLineNumber === "number") {
             var newExecutionLineNumber = this._lineNumberAfterEditing(this._executionLineNumber, oldRange, newRange);
             this.clearExecutionLine();
-            this.setExecutionLine(newExecutionLineNumber, true);
+            this.setExecutionLine(newExecutionLineNumber);
         }
 
         // Adjust breakpoints.
@@ -460,16 +460,13 @@ WebInspector.JavaScriptSourceFrame.prototype = {
     },
 
     /**
-     * @param {boolean=} skipRevealLine
+     * @param {number} lineNumber
      */
-    setExecutionLine: function(lineNumber, skipRevealLine)
+    setExecutionLine: function(lineNumber)
     {
         this._executionLineNumber = lineNumber;
-        if (this.loaded) {
+        if (this.loaded)
             this.textViewer.addDecoration(lineNumber, "webkit-execution-line");
-            if (!skipRevealLine)
-                this.textViewer.revealLine(lineNumber);
-        }
     },
 
     clearExecutionLine: function()
index 97dbd5a..881ca3d 100644 (file)
@@ -347,9 +347,7 @@ WebInspector.ScriptsPanel.prototype = {
         this._updateDebuggerButtons();
 
         WebInspector.inspectorView.setCurrentPanel(this);
-
         this.sidebarPanes.callstack.update(callFrames);
-        this._updateCallFrame(this._presentationModel.selectedCallFrame);
 
         if (details.reason === WebInspector.DebuggerModel.BreakReason.DOM) {
             this.sidebarPanes.domBreakpoints.highlightBreakpoint(details.auxData);
@@ -606,21 +604,20 @@ WebInspector.ScriptsPanel.prototype = {
     {
         var uiLocation = event.data;
 
-        this._updateExecutionLine(uiLocation);
-    },
-
-    _updateExecutionLine: function(uiLocation)
-    {
         this._clearCurrentExecutionLine();
         if (!uiLocation)
             return;
+        var sourceFrame = this._getOrCreateSourceFrame(uiLocation.uiSourceCode);
+        sourceFrame.setExecutionLine(uiLocation.lineNumber);
+        this._executionSourceFrame = sourceFrame;
+    },
 
+    _revealExecutionLine: function(uiLocation)
+    {
         // Anonymous scripts are not added to files select by default.
         this._addUISourceCode(uiLocation.uiSourceCode);
-
         var sourceFrame = this._showFile(uiLocation.uiSourceCode);
-        sourceFrame.setExecutionLine(uiLocation.lineNumber);
-        this._executionSourceFrame = sourceFrame;
+        sourceFrame.revealLine(uiLocation.lineNumber);
     },
 
     _callFrameSelected: function(event)
@@ -630,14 +627,10 @@ WebInspector.ScriptsPanel.prototype = {
         if (!callFrame)
             return;
 
-        this._updateCallFrame(callFrame);
-    },
-
-    _updateCallFrame: function(callFrame)
-    {
         this.sidebarPanes.scopechain.update(callFrame);
         this.sidebarPanes.watchExpressions.refreshExpressions();
         this.sidebarPanes.callstack.selectedCallFrame = callFrame;
+        callFrame.uiLocation(this._revealExecutionLine.bind(this));
     },
 
     _editorClosed: function(event)
index f66f67b..9e225ae 100644 (file)
@@ -97,6 +97,8 @@ WebInspector.SourceFrame.prototype = {
             this._textViewer.freeCachedElements();
 
         this._clearLineHighlight();
+        this._clearLineToReveal();
+        
         if (!this._textViewer.readOnly)
             this._wasHiddenWhileEditing = true;
         this.setReadOnly(true);
@@ -185,6 +187,7 @@ WebInspector.SourceFrame.prototype = {
 
     highlightLine: function(line)
     {
+        this._clearLineToReveal();
         if (this.loaded)
             this._textViewer.highlightLine(line);
         else
@@ -199,6 +202,20 @@ WebInspector.SourceFrame.prototype = {
             delete this._lineToHighlight;
     },
 
+    revealLine: function(line)
+    {
+        this._clearLineHighlight();
+        if (this.loaded)
+            this._textViewer.revealLine(line);
+        else
+            this._lineToReveal = line;
+    },
+
+    _clearLineToReveal: function()
+    {
+        delete this._lineToReveal;
+    },
+
     _saveViewerState: function()
     {
         this._viewerState = {
@@ -250,6 +267,11 @@ WebInspector.SourceFrame.prototype = {
             delete this._lineToHighlight;
         }
 
+        if (typeof this._lineToReveal === "number") {
+            this.revealLine(this._lineToReveal);
+            delete this._lineToReveal;
+        }
+
         if (this._delayedFindSearchMatches) {
             this._delayedFindSearchMatches();
             delete this._delayedFindSearchMatches;