author | Brian Grinstead <bgrinstead@mozilla.com> |
Tue, 01 Sep 2015 09:36:18 -0700 | |
changeset 260400 | 375ec989b33a7858dd5f271a28ee98baa54e528e |
parent 260399 | 20da43d2f599275b816181d7723f599b2af562fe |
child 260401 | 0fe4f8d8a63b264434d3755c05c9f234c5233097 |
push id | 64495 |
push user | ryanvm@gmail.com |
push date | Wed, 02 Sep 2015 01:16:33 +0000 |
treeherder | mozilla-inbound@e747377d86eb [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jryans |
bugs | 1198404 |
milestone | 43.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
browser/devtools/framework/test/browser_toolbox_options.js | file | annotate | diff | comparison | revisions | |
browser/devtools/framework/toolbox.js | file | annotate | diff | comparison | revisions |
--- a/browser/devtools/framework/test/browser_toolbox_options.js +++ b/browser/devtools/framework/test/browser_toolbox_options.js @@ -49,21 +49,27 @@ function* testSelectTool() { function* testOptionsShortcut() { info ("Selecting another tool, then reselecting options panel with keyboard."); yield toolbox.selectTool("webconsole"); is(toolbox.currentToolId, "webconsole", "webconsole is selected"); synthesizeKeyFromKeyTag("toolbox-options-key", doc); is(toolbox.currentToolId, "options", "Toolbox selected via shortcut key (1)"); + synthesizeKeyFromKeyTag("toolbox-options-key", doc); + is(toolbox.currentToolId, "webconsole", "webconsole is selected (1)"); yield toolbox.selectTool("webconsole"); is(toolbox.currentToolId, "webconsole", "webconsole is selected"); synthesizeKeyFromKeyTag("toolbox-options-key2", doc); is(toolbox.currentToolId, "options", "Toolbox selected via shortcut key (2)"); + synthesizeKeyFromKeyTag("toolbox-options-key", doc); + is(toolbox.currentToolId, "webconsole", "webconsole is reselected (2)"); + synthesizeKeyFromKeyTag("toolbox-options-key2", doc); + is(toolbox.currentToolId, "options", "Toolbox selected via shortcut key (2)"); } function* testOptions() { let tool = toolbox.getPanel("options"); panelWin = tool.panelWin; let prefNodes = tool.panelDoc.querySelectorAll("checkbox[data-pref]"); // Store modified pref names so that they can be cleared on error.
--- a/browser/devtools/framework/toolbox.js +++ b/browser/devtools/framework/toolbox.js @@ -184,16 +184,17 @@ Toolbox.prototype = { _prefs: { LAST_HOST: "devtools.toolbox.host", LAST_TOOL: "devtools.toolbox.selectedTool", SIDE_ENABLED: "devtools.toolbox.sideEnabled", PREVIOUS_HOST: "devtools.toolbox.previousHost" }, currentToolId: null, + lastUsedToolId: null, /** * Returns a *copy* of the _toolPanels collection. * * @return {Map} panels * All the running panels in the toolbox */ getToolPanels: function() { @@ -452,17 +453,26 @@ Toolbox.prototype = { break; case "devtools.serviceWorkers.testing.enabled": this._applyServiceWorkersTestingSettings(); break; } }, _buildOptions: function() { - let selectOptions = () => { this.selectTool("options"); }; + let selectOptions = () => { + // Flip back to the last used panel if we are already + // on the options panel. + if (this.currentToolId === "options" && + gDevTools.getToolDefinition(this.lastUsedToolId)) { + this.selectTool(this.lastUsedToolId); + } else { + this.selectTool("options"); + } + }; let key = this.doc.getElementById("toolbox-options-key"); key.addEventListener("command", selectOptions, true); let key2 = this.doc.getElementById("toolbox-options-key2"); key2.addEventListener("command", selectOptions, true); }, _splitConsoleOnKeypress: function(e) { if (e.keyCode === e.DOM_VK_ESCAPE) { @@ -1278,16 +1288,17 @@ Toolbox.prototype = { // found. tabstrip.selectedItem = tab || tabstrip.childNodes[0]; // and select the right iframe let deck = this.doc.getElementById("toolbox-deck"); let panel = this.doc.getElementById("toolbox-panel-" + id); deck.selectedPanel = panel; + this.lastUsedToolId = this.currentToolId; this.currentToolId = id; this._refreshConsoleDisplay(); if (id != "options") { Services.prefs.setCharPref(this._prefs.LAST_TOOL, id); } return this.loadTool(id).then(panel => { // focus the tool's frame to start receiving key events