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
+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.
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.
--- /dev/null
+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.
+
--- /dev/null
+<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>
+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.
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));
*/
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;
}
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()
if (typeof this._executionLineNumber === "number") {
var newExecutionLineNumber = this._lineNumberAfterEditing(this._executionLineNumber, oldRange, newRange);
this.clearExecutionLine();
- this.setExecutionLine(newExecutionLineNumber, true);
+ this.setExecutionLine(newExecutionLineNumber);
}
// Adjust breakpoints.
},
/**
- * @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()
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);
{
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)
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)
this._textViewer.freeCachedElements();
this._clearLineHighlight();
+ this._clearLineToReveal();
+
if (!this._textViewer.readOnly)
this._wasHiddenWhileEditing = true;
this.setReadOnly(true);
highlightLine: function(line)
{
+ this._clearLineToReveal();
if (this.loaded)
this._textViewer.highlightLine(line);
else
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 = {
delete this._lineToHighlight;
}
+ if (typeof this._lineToReveal === "number") {
+ this.revealLine(this._lineToReveal);
+ delete this._lineToReveal;
+ }
+
if (this._delayedFindSearchMatches) {
this._delayedFindSearchMatches();
delete this._delayedFindSearchMatches;