| Index: chrome/tools/test/reference_build/chrome_linux/resources/inspector/ScriptsPanel.js
|
| diff --git a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/ScriptsPanel.js b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/ScriptsPanel.js
|
| index c738d9e4ea631bbce946c120b1b0e2da320f28cb..d17fd0c1db7142f6b5fe3496a13e1e8df1dfd609 100644
|
| --- a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/ScriptsPanel.js
|
| +++ b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/ScriptsPanel.js
|
| @@ -56,6 +56,7 @@ WebInspector.ScriptsPanel = function()
|
| this.filesSelectElement.className = "status-bar-item";
|
| this.filesSelectElement.id = "scripts-files";
|
| this.filesSelectElement.addEventListener("change", this._changeVisibleFile.bind(this), false);
|
| + this.filesSelectElement.handleKeyEvent = this.handleKeyEvent.bind(this);
|
| this.topStatusBar.appendChild(this.filesSelectElement);
|
|
|
| this.functionsSelectElement = document.createElement("select");
|
| @@ -132,13 +133,11 @@ WebInspector.ScriptsPanel = function()
|
| for (var pane in this.sidebarPanes)
|
| this.sidebarElement.appendChild(this.sidebarPanes[pane].element);
|
|
|
| - // FIXME: remove the following line of code when the Breakpoints pane has content.
|
| - this.sidebarElement.removeChild(this.sidebarPanes.breakpoints.element);
|
| -
|
| this.sidebarPanes.callstack.expanded = true;
|
| this.sidebarPanes.callstack.addEventListener("call frame selected", this._callFrameSelected, this);
|
|
|
| this.sidebarPanes.scopechain.expanded = true;
|
| + this.sidebarPanes.breakpoints.expanded = true;
|
|
|
| var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel.");
|
| var panelEnablerDisclaimer = WebInspector.UIString("Enabling debugging will make scripts run slower.");
|
| @@ -152,17 +151,47 @@ WebInspector.ScriptsPanel = function()
|
| this.element.appendChild(this.sidebarElement);
|
| this.element.appendChild(this.sidebarResizeElement);
|
|
|
| - this.enableToggleButton = document.createElement("button");
|
| - this.enableToggleButton.className = "enable-toggle-status-bar-item status-bar-item";
|
| + this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
|
| this.enableToggleButton.addEventListener("click", this._toggleDebugging.bind(this), false);
|
|
|
| - this.pauseOnExceptionButton = document.createElement("button");
|
| - this.pauseOnExceptionButton.id = "scripts-pause-on-exceptions-status-bar-item";
|
| - this.pauseOnExceptionButton.className = "status-bar-item";
|
| + this.pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item");
|
| this.pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions.bind(this), false);
|
|
|
| this._breakpointsURLMap = {};
|
|
|
| + this._shortcuts = {};
|
| +
|
| + var isMac = InspectorController.platform().indexOf("mac-") === 0;
|
| + var platformSpecificModifier = isMac ? WebInspector.KeyboardShortcut.Modifiers.Meta : WebInspector.KeyboardShortcut.Modifiers.Ctrl;
|
| +
|
| + // Continue.
|
| + var handler = this.pauseButton.click.bind(this.pauseButton);
|
| + var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.F8);
|
| + this._shortcuts[shortcut] = handler;
|
| + var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Slash, platformSpecificModifier);
|
| + this._shortcuts[shortcut] = handler;
|
| +
|
| + // Step over.
|
| + var handler = this.stepOverButton.click.bind(this.stepOverButton);
|
| + var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.F10);
|
| + this._shortcuts[shortcut] = handler;
|
| + var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.SingleQuote, platformSpecificModifier);
|
| + this._shortcuts[shortcut] = handler;
|
| +
|
| + // Step into.
|
| + var handler = this.stepIntoButton.click.bind(this.stepIntoButton);
|
| + var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.F11);
|
| + this._shortcuts[shortcut] = handler;
|
| + var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Semicolon, platformSpecificModifier);
|
| + this._shortcuts[shortcut] = handler;
|
| +
|
| + // Step out.
|
| + var handler = this.stepOutButton.click.bind(this.stepOutButton);
|
| + var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.F11, WebInspector.KeyboardShortcut.Modifiers.Shift);
|
| + this._shortcuts[shortcut] = handler;
|
| + var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Semicolon, WebInspector.KeyboardShortcut.Modifiers.Shift, platformSpecificModifier);
|
| + this._shortcuts[shortcut] = handler;
|
| +
|
| this.reset();
|
| }
|
|
|
| @@ -176,7 +205,7 @@ WebInspector.ScriptsPanel.prototype = {
|
|
|
| get statusBarItems()
|
| {
|
| - return [this.enableToggleButton, this.pauseOnExceptionButton];
|
| + return [this.enableToggleButton.element, this.pauseOnExceptionButton.element];
|
| },
|
|
|
| get paused()
|
| @@ -205,6 +234,10 @@ WebInspector.ScriptsPanel.prototype = {
|
| continue;
|
| view.visible = false;
|
| }
|
| + if (this._attachDebuggerWhenShown) {
|
| + InspectorController.enableDebugger(false);
|
| + delete this._attachDebuggerWhenShown;
|
| + }
|
| },
|
|
|
| get searchableViews()
|
| @@ -261,6 +294,11 @@ WebInspector.ScriptsPanel.prototype = {
|
| this._addScriptToFilesMenu(script);
|
| },
|
|
|
| + scriptOrResourceForID: function(id)
|
| + {
|
| + return this._sourceIDMap[id];
|
| + },
|
| +
|
| addBreakpoint: function(breakpoint)
|
| {
|
| this.sidebarPanes.breakpoints.addBreakpoint(breakpoint);
|
| @@ -312,20 +350,36 @@ WebInspector.ScriptsPanel.prototype = {
|
| sourceFrame.removeBreakpoint(breakpoint);
|
| },
|
|
|
| - evaluateInSelectedCallFrame: function(code, updateInterface)
|
| + evaluateInSelectedCallFrame: function(code, updateInterface, callback)
|
| {
|
| var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame;
|
| if (!this._paused || !selectedCallFrame)
|
| return;
|
| +
|
| if (typeof updateInterface === "undefined")
|
| updateInterface = true;
|
| - var result = selectedCallFrame.evaluate(code);
|
| - if (updateInterface)
|
| - this.sidebarPanes.scopechain.update(selectedCallFrame);
|
| - return result;
|
| +
|
| + var self = this;
|
| + function updatingCallbackWrapper(result, exception)
|
| + {
|
| + callback(result, exception);
|
| + if (updateInterface)
|
| + self.sidebarPanes.scopechain.update(selectedCallFrame);
|
| + }
|
| + this.doEvalInCallFrame(selectedCallFrame, code, updatingCallbackWrapper);
|
| },
|
|
|
| - variablesInScopeForSelectedCallFrame: function()
|
| + doEvalInCallFrame: function(callFrame, code, callback)
|
| + {
|
| + function evalCallback(result)
|
| + {
|
| + if (result)
|
| + callback(result.value, result.isException);
|
| + }
|
| + InspectorController.evaluateInCallFrame(callFrame.id, code, evalCallback);
|
| + },
|
| +
|
| + variablesInSelectedCallFrame: function()
|
| {
|
| var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame;
|
| if (!this._paused || !selectedCallFrame)
|
| @@ -334,11 +388,10 @@ WebInspector.ScriptsPanel.prototype = {
|
| var result = {};
|
| var scopeChain = selectedCallFrame.scopeChain;
|
| for (var i = 0; i < scopeChain.length; ++i) {
|
| - var scopeObject = scopeChain[i];
|
| - for (var property in scopeObject)
|
| - result[property] = true;
|
| + var scopeObjectProperties = scopeChain[i].properties;
|
| + for (var j = 0; j < scopeObjectProperties.length; ++j)
|
| + result[scopeObjectProperties[j]] = true;
|
| }
|
| -
|
| return result;
|
| },
|
|
|
| @@ -350,13 +403,17 @@ WebInspector.ScriptsPanel.prototype = {
|
|
|
| this._updateDebuggerButtons();
|
|
|
| + var self = this;
|
| var callStackPane = this.sidebarPanes.callstack;
|
| - var currentFrame = InspectorController.currentCallFrame();
|
| - callStackPane.update(currentFrame, this._sourceIDMap);
|
| - callStackPane.selectedCallFrame = currentFrame;
|
| + function callback(callFrames)
|
| + {
|
| + callStackPane.update(callFrames, self._sourceIDMap);
|
| + callStackPane.selectedCallFrame = callFrames[0];
|
|
|
| - WebInspector.currentPanel = this;
|
| - window.focus();
|
| + WebInspector.currentPanel = self;
|
| + window.focus();
|
| + }
|
| + InspectorController.getCallFrames(callback);
|
| },
|
|
|
| debuggerResumed: function()
|
| @@ -368,6 +425,15 @@ WebInspector.ScriptsPanel.prototype = {
|
| this._clearInterface();
|
| },
|
|
|
| + attachDebuggerWhenShown: function()
|
| + {
|
| + if (this.element.parentElement) {
|
| + InspectorController.enableDebugger(false);
|
| + } else {
|
| + this._attachDebuggerWhenShown = true;
|
| + }
|
| + },
|
| +
|
| debuggerWasEnabled: function()
|
| {
|
| this.reset();
|
| @@ -454,6 +520,19 @@ WebInspector.ScriptsPanel.prototype = {
|
| this._showScriptOrResource((view.resource || view.script));
|
| },
|
|
|
| + handleKeyEvent: function(event)
|
| + {
|
| + var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
|
| + var handler = this._shortcuts[shortcut];
|
| + if (handler) {
|
| + handler(event);
|
| + event.preventDefault();
|
| + event.handled = true;
|
| + } else {
|
| + this.sidebarPanes.callstack.handleKeyEvent(event);
|
| + }
|
| + },
|
| +
|
| scriptViewForScript: function(script)
|
| {
|
| if (!script)
|
| @@ -681,10 +760,10 @@ WebInspector.ScriptsPanel.prototype = {
|
| {
|
| if (InspectorController.pauseOnExceptions()) {
|
| this.pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.");
|
| - this.pauseOnExceptionButton.addStyleClass("toggled-on");
|
| + this.pauseOnExceptionButton.toggled = true;
|
| } else {
|
| this.pauseOnExceptionButton.title = WebInspector.UIString("Pause on exceptions.");
|
| - this.pauseOnExceptionButton.removeStyleClass("toggled-on");
|
| + this.pauseOnExceptionButton.toggled = false;
|
| }
|
| },
|
|
|
| @@ -692,13 +771,13 @@ WebInspector.ScriptsPanel.prototype = {
|
| {
|
| if (InspectorController.debuggerEnabled()) {
|
| this.enableToggleButton.title = WebInspector.UIString("Debugging enabled. Click to disable.");
|
| - this.enableToggleButton.addStyleClass("toggled-on");
|
| - this.pauseOnExceptionButton.removeStyleClass("hidden");
|
| + this.enableToggleButton.toggled = true;
|
| + this.pauseOnExceptionButton.visible = true;
|
| this.panelEnablerView.visible = false;
|
| } else {
|
| this.enableToggleButton.title = WebInspector.UIString("Debugging disabled. Click to enable.");
|
| - this.enableToggleButton.removeStyleClass("toggled-on");
|
| - this.pauseOnExceptionButton.addStyleClass("hidden");
|
| + this.enableToggleButton.toggled = false;
|
| + this.pauseOnExceptionButton.visible = false;
|
| this.panelEnablerView.visible = true;
|
| }
|
|
|
| @@ -771,19 +850,19 @@ WebInspector.ScriptsPanel.prototype = {
|
| {
|
| if (InspectorController.debuggerEnabled())
|
| return;
|
| - this._toggleDebugging();
|
| + this._toggleDebugging(this.panelEnablerView.alwaysEnabled);
|
| },
|
|
|
| - _toggleDebugging: function()
|
| + _toggleDebugging: function(optionalAlways)
|
| {
|
| this._paused = false;
|
| this._waitingToPause = false;
|
| this._stepping = false;
|
|
|
| if (InspectorController.debuggerEnabled())
|
| - InspectorController.disableDebugger();
|
| + InspectorController.disableDebugger(true);
|
| else
|
| - InspectorController.enableDebugger();
|
| + InspectorController.enableDebugger(!!optionalAlways);
|
| },
|
|
|
| _togglePauseOnExceptions: function()
|
|
|