Bug 1544692 - Fix splitconsole shortcut for about:devtools-toolbox r=Ola
authorJulian Descottes <jdescottes@mozilla.com>
Tue, 30 Apr 2019 11:30:12 +0000
changeset 530743 35ea1cc26cd5b5ef3d0e50f5d0319b41b96d37fd
parent 530742 9b011be3928562d0ae27acd5680dd215bc9ab2f3
child 530744 4efcb809a6d0db1362222041f0b92b4c506e8559
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersOla
bugs1544692
milestone68.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
Bug 1544692 - Fix splitconsole shortcut for about:devtools-toolbox r=Ola Fixes a small issue with the splitconsole shortcut in about:devtools-toolbox Differential Revision: https://phabricator.services.mozilla.com/D29028
devtools/client/aboutdebugging-new/test/browser/browser.ini
devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_splitconsole_key.js
devtools/client/framework/toolbox.js
--- a/devtools/client/aboutdebugging-new/test/browser/browser.ini
+++ b/devtools/client/aboutdebugging-new/test/browser/browser.ini
@@ -60,16 +60,17 @@ skip-if = (os == 'linux' && bits == 32) 
 [browser_aboutdebugging_devtoolstoolbox_focus.js]
 [browser_aboutdebugging_devtoolstoolbox_menubar.js]
 [browser_aboutdebugging_devtoolstoolbox_performance.js]
 skip-if = os == 'linux' && e10s && (asan || debug) # Same skip-if as old perf panel test suite. Bug 1254821
 [browser_aboutdebugging_devtoolstoolbox_reload.js]
 skip-if = verify || ccov # test loads the toolbox 2 times for each panel, might timeout or OOM
 [browser_aboutdebugging_devtoolstoolbox_shortcuts.js]
 skip-if = (os == "win" && ccov) # Bug 1521349
+[browser_aboutdebugging_devtoolstoolbox_splitconsole_key.js]
 [browser_aboutdebugging_devtoolstoolbox_target_destroyed.js]
 skip-if = debug || asan # This test leaks. See bug 1529005
 [browser_aboutdebugging_devtoolstoolbox_tooltip_markupview.js]
 [browser_aboutdebugging_message_close.js]
 [browser_aboutdebugging_navigate.js]
 [browser_aboutdebugging_persist_connection.js]
 [browser_aboutdebugging_process_category.js]
 [browser_aboutdebugging_process_main.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_devtoolstoolbox_splitconsole_key.js
@@ -0,0 +1,38 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/* import-globals-from helper-collapsibilities.js */
+Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-collapsibilities.js", this);
+
+/**
+ * Test that the split console key shortcut works on about:devtools-toolbox.
+ */
+add_task(async function() {
+  info("Force all debug target panes to be expanded");
+  prepareCollapsibilitiesTest();
+
+  const { document, tab, window } = await openAboutDebugging();
+  await selectThisFirefoxPage(document, window.AboutDebugging.store);
+  const { devtoolsTab, devtoolsWindow } =
+    await openAboutDevtoolsToolbox(document, tab, window);
+
+  // Select any tool that is not the Webconsole, since we will assert the split-console.
+  info("Select inspector tool");
+  const toolbox = getToolbox(devtoolsWindow);
+  await toolbox.selectTool("inspector");
+
+  info("Press Escape and wait for the split console to be opened");
+  EventUtils.synthesizeKey("VK_ESCAPE", {}, devtoolsWindow);
+  await waitUntil(() => toolbox.isSplitConsoleFocused());
+  ok(true, "Split console is opened and focused");
+
+  info("Press Escape again and wait for the split console to be closed");
+  EventUtils.synthesizeKey("VK_ESCAPE", {}, devtoolsWindow);
+  await waitUntil(() => !toolbox.isSplitConsoleFocused());
+  ok(true, "Split console is closed and no longer focused");
+
+  await closeAboutDevtoolsToolbox(document, devtoolsTab, window);
+  await removeTab(tab);
+});
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -1096,19 +1096,20 @@ Toolbox.prototype = {
     EventEmitter.decorate(button);
 
     return button;
   },
 
   _splitConsoleOnKeypress: function(e) {
     if (e.keyCode === KeyCodes.DOM_VK_ESCAPE) {
       this.toggleSplitConsole();
-      // If the debugger is paused, don't let the ESC key stop any pending
-      // navigation.
-      if (this._threadClient.state == "paused") {
+      // If the debugger is paused, don't let the ESC key stop any pending navigation.
+      // If the host is page, don't let the ESC stop the load of the webconsole frame.
+      if (this._threadClient.state == "paused" ||
+          this.hostType === Toolbox.HostType.PAGE) {
         e.preventDefault();
       }
     }
   },
 
   /**
    * Add a shortcut key that should work when a split console
    * has focus to the toolbox.