Commit c88c2032 authored by pfeldman's avatar pfeldman Committed by Commit bot

DevTools: migrate sources panel sidebar to views.

BUG=634145

Review-Url: https://codereview.chromium.org/2238003002
Cr-Commit-Position: refs/heads/master@{#412236}
parent 79331e5a
......@@ -174,18 +174,15 @@ InspectorTest.resumeExecution = function(callback)
InspectorTest.waitUntilPausedAndDumpStackAndResume = function(callback, options)
{
InspectorTest.waitUntilPaused(paused);
InspectorTest.addSniffer(WebInspector.CallStackSidebarPane.prototype, "setStatus", setStatus);
InspectorTest.addSniffer(WebInspector.CallStackSidebarPane.prototype, "_updateStatusMessage", setStatus);
var caption;
var callFrames;
var asyncStackTrace;
function setStatus(status)
function setStatus()
{
if (typeof status === "string")
caption = status;
else
caption = status.deepTextContent();
caption = this.contentElement.lastChild.deepTextContent();
if (callFrames)
step1();
}
......@@ -355,7 +352,7 @@ InspectorTest._pausedScript = function(callFrames, reason, auxData, breakpointId
if (InspectorTest._waitUntilPausedCallback) {
var callback = InspectorTest._waitUntilPausedCallback;
delete InspectorTest._waitUntilPausedCallback;
callback.apply(callback, InspectorTest._pausedScriptArguments);
setTimeout(() => callback.apply(callback, InspectorTest._pausedScriptArguments));
}
};
......@@ -421,7 +418,7 @@ InspectorTest.removeBreakpoint = function(sourceFrame, lineNumber)
InspectorTest.dumpBreakpointSidebarPane = function(title)
{
var paneElement = WebInspector.panels.sources.sidebarPanes.jsBreakpoints.listElement;
var paneElement = self.runtime.sharedInstance(WebInspector.JavaScriptBreakpointsSidebarPane).element;
InspectorTest.addResult("Breakpoint sidebar pane " + (title || ""));
InspectorTest.addResult(InspectorTest.textContentWithLineBreaks(paneElement));
};
......@@ -442,7 +439,7 @@ InspectorTest.dumpScopeVariablesSidebarPane = function()
InspectorTest.scopeChainSections = function()
{
var children = WebInspector.panels.sources.sidebarPanes.scopechain.contentElement.children;
var children = self.runtime.sharedInstance(WebInspector.ScopeChainSidebarPane).contentElement.children;
var sections = [];
for (var i = 0; i < children.length; ++i)
sections.push(children[i]._section);
......@@ -586,7 +583,7 @@ InspectorTest.waitForExecutionContextInTarget = function(target, callback)
InspectorTest.selectThread = function(target)
{
var threadsPane = WebInspector.panels.sources.sidebarPanes.threads;
var threadsPane = self.runtime.sharedInstance(WebInspector.ThreadsSidebarPane);
var listItem = threadsPane._debuggerModelToListItems.get(WebInspector.DebuggerModel.fromTarget(target));
threadsPane._onListItemClick(listItem);
}
......
......@@ -7,14 +7,14 @@ Running: testBreakpointsInOriginalAndFormattedSource
Script execution paused.
Breakpoint sidebar pane while paused in raw
script-formatter-breakpoints-1.html:12 var f=0;
script-formatter-breakpoints-1.html:12 var f=0;
Script execution resumed.
Script execution paused.
Breakpoint sidebar pane while paused in pretty printed
script-formatter-breakpoints-1.html:formatted:13 var f = 0;
script-formatter-breakpoints-1.html:formatted:13 var f = 0;
Breakpoint sidebar pane while paused in raw
script-formatter-breakpoints-1.html:12 var f=0;
script-formatter-breakpoints-1.html:12 var f=0;
Script execution resumed.
......@@ -3,11 +3,11 @@ Tests "reload" from within inspector window while on pause.
Breakpoint sidebar pane Breakpoints before reload:
source1.js:15 var handler = new ClickHandler();
source1.js:17}
source1.js:15 var handler = new ClickHandler();
source1.js:17}
Page reloaded.
Breakpoint sidebar pane Breakpoints after reload:
source1.js:15 var handler = new ClickHandler();
source1.js:17}
source1.js:15 var handler = new ClickHandler();
source1.js:17}
......@@ -42,7 +42,7 @@ var test = function()
function waitForBreakpoints()
{
var breakpointAddCounter = 4; // Before source map loaded and after.
var jsBreakpoints = WebInspector.panels.sources.sidebarPanes.jsBreakpoints;
var jsBreakpoints = self.runtime.sharedInstance(WebInspector.JavaScriptBreakpointsSidebarPane);
jsBreakpoints.didReceiveBreakpointLineForTest = function(uiSourceCode)
{
if (WebInspector.CompilerScriptMapping.StubProjectID === uiSourceCode.project().id())
......
......@@ -9,9 +9,9 @@ Call stack:
0) testFunction (set-breakpoint.html:17)
Breakpoint sidebar pane
set-breakpoint.html:17 var x = Math.sqrt(10);
set-breakpoint.html:17 var x = Math.sqrt(10);
Breakpoint sidebar pane
No Breakpoints
Script execution resumed.
Running: testSetBreakpointOnTheLastLine
......
......@@ -11,9 +11,9 @@ Call stack:
0) testFunction (set-conditional-breakpoint.html:17)
Breakpoint sidebar pane
set-conditional-breakpoint.html:17 var x = Math.sqrt(10);
set-conditional-breakpoint.html:17 var x = Math.sqrt(10);
Breakpoint sidebar pane
No Breakpoints
Script execution resumed.
Running: testSetConditionalBreakpointThatDoesNotBreak
......@@ -22,8 +22,8 @@ Set timer for test function.
Test function finished.
Breakpoint sidebar pane
set-conditional-breakpoint.html:17 var x = Math.sqrt(10);
set-conditional-breakpoint.html:17 var x = Math.sqrt(10);
Breakpoints removed.
Breakpoint sidebar pane
No Breakpoints
......@@ -44,7 +44,7 @@ var test = function()
function step2(callFrames)
{
var pane = WebInspector.panels.sources.sidebarPanes.callstack;
var pane = self.runtime.sharedInstance(WebInspector.CallStackSidebarPane);
pane._callFrameSelected(pane.callFrames[1]);
InspectorTest.deprecatedRunAfterPendingDispatches(step3);
}
......
......@@ -76,7 +76,7 @@ function test()
function step3()
{
var pane = WebInspector.panels.sources.sidebarPanes.callstack;
var pane = self.runtime.sharedInstance(WebInspector.CallStackSidebarPane);
pane._callFrameSelected(pane.callFrames[1]);
InspectorTest.deprecatedRunAfterPendingDispatches(step4);
}
......
......@@ -36,7 +36,7 @@ var test = function()
function step3(callFrames, result)
{
InspectorTest.addResult("Evaluated script on the top frame: " + result);
var pane = WebInspector.panels.sources.sidebarPanes.callstack;
var pane = self.runtime.sharedInstance(WebInspector.CallStackSidebarPane);
pane._callFrameSelected(pane.callFrames[1]);
InspectorTest.deprecatedRunAfterPendingDispatches(step4);
}
......
......@@ -30,7 +30,7 @@ var test = function()
function step3()
{
var callFrameList = WebInspector.panels.sources.sidebarPanes.callstack.callFrameList;
var callFrameList = self.runtime.sharedInstance(WebInspector.CallStackSidebarPane).callFrameList;
for (var item of callFrameList._items)
InspectorTest.addResult(item.element.textContent.replace(/VM\d+/g, "VM"));
InspectorTest.completeDebuggerTest();
......
......@@ -21,7 +21,7 @@ var test = function()
function step1()
{
WebInspector.panels.sources.sidebarPanes.eventListenerBreakpoints._setBreakpoint("instrumentation:timerFired");
self.runtime.sharedInstance(WebInspector.EventListenerBreakpointsSidebarPane)._setBreakpoint("instrumentation:timerFired");
InspectorTest.evaluateInPage("runSetTimeoutWithSyntaxError()", InspectorTest.waitUntilMessageReceived.bind(this, step2));
}
......@@ -34,7 +34,7 @@ var test = function()
function step3()
{
WebInspector.panels.sources.sidebarPanes.eventListenerBreakpoints._removeBreakpoint("instrumentation:timerFired");
self.runtime.sharedInstance(WebInspector.EventListenerBreakpointsSidebarPane)._removeBreakpoint("instrumentation:timerFired");
InspectorTest.completeDebuggerTest();
}
}
......
......@@ -31,7 +31,7 @@ var test = function()
function step2()
{
InspectorFrontendHost.copyText = InspectorTest.addResult.bind(InspectorTest);
WebInspector.panels.sources.sidebarPanes.callstack._copyStackTrace();
self.runtime.sharedInstance(WebInspector.CallStackSidebarPane)._copyStackTrace();
InspectorTest.completeDebuggerTest();
}
}
......
......@@ -33,13 +33,9 @@ function test()
InspectorTest.startDebuggerTest(onTestStarted);
function onTestStarted()
{
InspectorTest.runTestFunctionAndWaitUntilPaused(onDebuggerPaused);
}
function onDebuggerPaused()
{
InspectorTest.addSniffer(WebInspector.ScopeChainSidebarPane.prototype, "_sidebarPaneUpdatedForTest", onSidebarRendered, true);
InspectorTest.runTestFunctionAndWaitUntilPaused(() => {});
}
function onSidebarRendered()
......
......@@ -7,11 +7,14 @@ var foo = 123
var test = function()
{
var watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExpressions;
watchExpressionsPane.revealView();
watchExpressionsPane.addExpression("#$%");
var watchExpressionsPane = self.runtime.sharedInstance(WebInspector.WatchExpressionsSidebarPane);
WebInspector.panels.sources._sidebarPaneStack.showView(WebInspector.panels.sources._watchSidebarPane).then(() => {
watchExpressionsPane.doUpdate();
watchExpressionsPane._createWatchExpression("#$%");
watchExpressionsPane._saveExpressions();
InspectorTest.deprecatedRunAfterPendingDispatches(step1);
});
InspectorTest.deprecatedRunAfterPendingDispatches(step1);
function step1()
{
......
......@@ -7,19 +7,19 @@ Running: testRevealAfterPausedOnException
Showing script1 source...
Script source was shown for 'script1.js'.
Throwing exception...
Script execution paused.
Script source was shown for 'reveal-not-skipped.html'.
Reloading page...
Script execution paused.
Script execution resumed.
Page reloaded.
Showing script1 source...
Script source was shown for 'script1.js'.
Throwing exception...
Script execution paused.
Script source was shown for 'reveal-not-skipped.html'.
Running: testRevealAfterPrettyPrintWhenPaused
Throwing exception...
Script execution paused.
Showing script1 source...
Script source was shown for 'script1.js'.
Formatting...
......
......@@ -7,8 +7,8 @@ Running: testBreakpointsSetAndRemoveInFormattedSource
Script execution paused.
Breakpoint sidebar pane while paused in pretty printed
unformatted2.js:formatted:4 var c = 3;
unformatted2.js:formatted:4 var c = 3;
Breakpoint sidebar pane while paused in raw
No Breakpoints
Script execution resumed.
......@@ -7,8 +7,8 @@ Running: testBreakpointsSetInFormattedAndRemoveInOriginalSource
Script execution paused.
Breakpoint sidebar pane while paused in pretty printed
unformatted3.js:formatted:4 var c = 3;
unformatted3.js:formatted:4 var c = 3;
Breakpoint sidebar pane while paused in raw
No Breakpoints
Script execution resumed.
......@@ -44,7 +44,7 @@ var test = function()
function step4()
{
InspectorTest.assertEquals("testFunction", InspectorTest.debuggerModel.selectedCallFrame().functionName);
InspectorTest.assertEquals("testFunction", WebInspector.context.flavor(WebInspector.DebuggerModel.CallFrame).functionName);
sourceFrame._toggleFormatSource(step5);
}
......
Tests debugger does not fail when stopped while a panel other than scripts was opened. Both valid and invalid expressions are added to watch expressions.
Bug 70718
Script source was shown.
Set timer for test function.
Watch expressions updated.
'window.document' => 'document'
'windowa.document' => '<not available>'
x: <not available>
y.foo: <not available>
x: <not available>
y.foo: <not available>
x: <not available>
y.foo: <not available>
x: 4
y.foo: <not available>
......@@ -5,66 +5,36 @@
<script src="../../../http/tests/inspector/network-test.js"></script>
<script src="../../../http/tests/inspector/debugger-test.js"></script>
<script>
function testFunction()
{
var x = Math.sqrt(10);
var x = Math.sqrt(16);
debugger;
return x;
}
var test = function()
function test()
{
InspectorTest.setQuiet(true);
InspectorTest.startDebuggerTest(step1);
var updateCount = 8;
var currentSourceFrame;
var watchExpressionsPane;
//callback per each watchExpression called twice: in constructor and when actual evaluation result is available
var updateCount = 4;
WebInspector.settings.createLocalSetting("watchExpressions", []).set(["x", "y.foo"]);
function step1()
{
watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExpressions;
watchExpressionsPane.revealView().then(() => {
watchExpressionsPane.addExpression("window.document");
watchExpressionsPane.addExpression("windowa.document");
var testName = InspectorTest.mainTarget.inspectedURL();
testName = testName.substring(testName.lastIndexOf('/') + 1);
InspectorTest.showScriptSource(testName, didShowScriptSource);
watchExpressionsPane = self.runtime.sharedInstance(WebInspector.WatchExpressionsSidebarPane);
WebInspector.panels.sources._sidebarPaneStack.showView(WebInspector.panels.sources._watchSidebarPane).then(() => {
InspectorTest.addSniffer(WebInspector.WatchExpression.prototype, "_createWatchExpression", watchExpressionsUpdated, true);
InspectorTest.evaluateInPage("testFunction()");
});
}
function didShowScriptSource(sourceFrame)
{
currentSourceFrame = sourceFrame;
InspectorTest.addResult("Script source was shown.");
InspectorTest.setBreakpoint(currentSourceFrame, 9, "", true);
InspectorTest.addSniffer(WebInspector.WatchExpression.prototype, "_createWatchExpression", watchExpressionsUpdated, true);
// Switch to another panel to test how watch expressions evaluation together with panel switching.
WebInspector.NetworkPanel.show();
InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
}
function didPause(callFrames)
{
}
function watchExpressionsUpdated()
function watchExpressionsUpdated(result, wasThrown)
{
updateCount--;
if (updateCount)
return;
InspectorTest.addResult("Watch expressions updated.");
for (var i = 0; i < watchExpressionsPane._watchExpressions.length; i++) {
var watch = watchExpressionsPane._watchExpressions[i];
var nameElement = watch._objectPresentationElement.querySelector(".name");
var valueElement = watch._objectPresentationElement.querySelector(".value");
InspectorTest.addResult("'" + nameElement.textContent + "'" + " => " + "'" + valueElement.textContent + "'");
}
watchExpressionsPane._deleteAllButtonClicked();
InspectorTest.completeDebuggerTest();
InspectorTest.addResult(this._element.deepTextContent());
if (--updateCount === 0)
InspectorTest.completeDebuggerTest();
}
}
......
......@@ -26,13 +26,16 @@ for (var i = 0; i < 300; ++i)
var test = function()
{
var watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExpressions;
watchExpressionsPane.revealView();
watchExpressionsPane.addExpression("globalObject");
watchExpressionsPane.addExpression("windowAlias");
watchExpressionsPane.addExpression("array");
watchExpressionsPane.addExpression("func");
InspectorTest.deprecatedRunAfterPendingDispatches(step2);
var watchExpressionsPane = self.runtime.sharedInstance(WebInspector.WatchExpressionsSidebarPane);
WebInspector.panels.sources._sidebarPaneStack.showView(WebInspector.panels.sources._watchSidebarPane).then(() => {
watchExpressionsPane.doUpdate();
watchExpressionsPane._createWatchExpression("globalObject");
watchExpressionsPane._createWatchExpression("windowAlias");
watchExpressionsPane._createWatchExpression("array");
watchExpressionsPane._createWatchExpression("func");
watchExpressionsPane._saveExpressions();
InspectorTest.deprecatedRunAfterPendingDispatches(step2);
});
function step2()
{
......@@ -58,7 +61,7 @@ var test = function()
function dumpWatchExpressions()
{
var pane = WebInspector.panels.sources.sidebarPanes.watchExpressions;
var pane = self.runtime.sharedInstance(WebInspector.WatchExpressionsSidebarPane);
for (var i = 0; i < pane._watchExpressions.length; i++) {
var watch = pane._watchExpressions[i];
......@@ -105,7 +108,7 @@ var test = function()
function expandWatchExpression(path, callback)
{
var pane = WebInspector.panels.sources.sidebarPanes.watchExpressions;
var pane = self.runtime.sharedInstance(WebInspector.WatchExpressionsSidebarPane);
var expression = path.shift();
for (var i = 0; i < pane._watchExpressions.length; i++) {
var watch = pane._watchExpressions[i];
......
......@@ -32,7 +32,8 @@ var test = function()
function callstackStatus()
{
var statusElement = panel.sidebarPanes.callstack._statusMessageElement;
var pane = self.runtime.sharedInstance(WebInspector.CallStackSidebarPane);
var statusElement = pane.contentElement;
return statusElement ? statusElement.textContent : "";
}
......@@ -133,7 +134,8 @@ var test = function()
function callstackStatus()
{
var statusElement = panel.sidebarPanes.callstack._statusMessageElement;
var pane = self.runtime.sharedInstance(WebInspector.CallStackSidebarPane);
var statusElement = pane.contentElement;
return statusElement ? statusElement.textContent : "";
}
......
......@@ -24,7 +24,8 @@ var test = function()
function callstackStatus()
{
var statusElement = panel.sidebarPanes.callstack._statusMessageElement;
var pane = self.runtime.sharedInstance(WebInspector.CallStackSidebarPane);
var statusElement = pane.contentElement;
return statusElement ? statusElement.textContent : "";
}
......
......@@ -50,13 +50,9 @@ function test()
InspectorTest.startDebuggerTest(onTestStarted);
function onTestStarted()
{
InspectorTest.runTestFunctionAndWaitUntilPaused(onDebuggerPaused);
}
function onDebuggerPaused()
{
InspectorTest.addSniffer(WebInspector.ScopeChainSidebarPane.prototype, "_sidebarPaneUpdatedForTest", onSidebarRendered, true);
InspectorTest.runTestFunctionAndWaitUntilPaused(() => {});
}
function onSidebarRendered()
......
......@@ -44,7 +44,7 @@ function test()
function testAtPosition(uiSourceCode, position)
{
return WebInspector.SourceMapNamesResolver.resolveExpression(InspectorTest.debuggerModel.selectedCallFrame(), position.originText, uiSourceCode, position.line, position.startColumn, position.endColumn)
return WebInspector.SourceMapNamesResolver.resolveExpression(WebInspector.context.flavor(WebInspector.DebuggerModel.CallFrame), position.originText, uiSourceCode, position.line, position.startColumn, position.endColumn)
.then(InspectorTest.evaluateOnCurrentCallFrame)
.then(remoteObject => InspectorTest.addResult(remoteObject.description));
}
......
......@@ -24,13 +24,9 @@ function test()
InspectorTest.startDebuggerTest(step1);
function step1()
{
InspectorTest.runTestFunctionAndWaitUntilPaused(step2);
}
function step2(callFrames)
{
InspectorTest.addSniffer(WebInspector.ScopeChainSidebarPane.prototype, "_sidebarPaneUpdatedForTest", onSidebarRendered, true);
InspectorTest.runTestFunctionAndWaitUntilPaused(() => {});
}
function onSidebarRendered()
......
......@@ -9,8 +9,8 @@ Call stack:
0) testFunction (js-with-inline-stylesheets.html:10)
Breakpoint sidebar pane
js-with-inline-stylesheets.html:10 var x = Math.sqrt(10);
js-with-inline-stylesheets.html:10 var x = Math.sqrt(10);
Breakpoint sidebar pane
No Breakpoints
Script execution resumed.
......@@ -45,9 +45,6 @@ WebInspector.BreakpointsSidebarPaneBase = function()
this.emptyElement.textContent = WebInspector.UIString("No Breakpoints");
this.element.appendChild(this.emptyElement);
WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.DebuggerPaused, this._update, this);
WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.DebuggerResumed, this._update, this);
WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._update, this);
}
WebInspector.BreakpointsSidebarPaneBase.prototype = {
......@@ -94,19 +91,5 @@ WebInspector.BreakpointsSidebarPaneBase.prototype = {
}
},
_update: function()
{
var target = WebInspector.context.flavor(WebInspector.Target);
var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
var details = debuggerModel ? debuggerModel.debuggerPausedDetails() : null;
this.highlightDetails(details);
},
/**
* @param {?WebInspector.DebuggerPausedDetails} details
* @protected
*/
highlightDetails: function(details) { },
__proto__: WebInspector.VBox.prototype
}
......@@ -31,6 +31,7 @@
/**
* @constructor
* @extends {WebInspector.BreakpointsSidebarPaneBase}
* @implements {WebInspector.ContextFlavorListener}
*/
WebInspector.DOMBreakpointsSidebarPane = function()
{
......@@ -55,21 +56,20 @@ WebInspector.DOMBreakpointsSidebarPane = function()
this._contextMenuLabels[this._breakpointTypes.AttributeModified] = WebInspector.UIString.capitalize("Attributes ^modifications");
this._contextMenuLabels[this._breakpointTypes.NodeRemoved] = WebInspector.UIString.capitalize("Node ^removal");
WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.InspectedURLChanged, this._inspectedURLChanged, this);
WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspector.DOMModel.Events.NodeRemoved, this._nodeRemoved, this);
WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.InspectedURLChanged, this._inspectedURLChanged, this);
this._inspectedURL = WebInspector.targetManager.inspectedURL();
this._update();
}
WebInspector.DOMBreakpointsSidebarPane.Marker = "breakpoint-marker";
WebInspector.DOMBreakpointsSidebarPane.prototype = {
_inspectedURLChanged: function(event)