Bug 1439371 - Close the top window (browserconsole.xul) when the close key shortcut is used in the Browser Console;r=jdescottes draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Mon, 19 Feb 2018 13:52:56 -0800
changeset 757099 dc1b444b22a2c8214e4dbf21a3a4972be2249fc5
parent 757085 3d23b4bd60d9d4d950bce01931610818dc72b313
push id99655
push userbgrinstead@mozilla.com
push dateMon, 19 Feb 2018 21:53:13 +0000
reviewersjdescottes
bugs1439371
milestone60.0a1
Bug 1439371 - Close the top window (browserconsole.xul) when the close key shortcut is used in the Browser Console;r=jdescottes In the old frontend `this.window.close` worked since webconsole.xul was used for both the web console and browser console. The new frontend is implemented in HTML (webconsole.html) but for the browser console we wrap that in a XUL document (browserconsole.xul) to support window management and other XUL features. So when the HTML frontend receieves cmd/ctrl+w, we now call the `close` function for the XUL window instead. MozReview-Commit-ID: 5j9rimTC2f8
devtools/client/webconsole/new-webconsole.js
--- a/devtools/client/webconsole/new-webconsole.js
+++ b/devtools/client/webconsole/new-webconsole.js
@@ -245,17 +245,17 @@ NewWebConsoleFrame.prototype = {
     } else {
       clearShortcut = l10n.getStr("webconsole.clear.key");
     }
 
     shortcuts.on(clearShortcut, () => this.jsterm.clearOutput(true));
 
     if (this.isBrowserConsole) {
       shortcuts.on(l10n.getStr("webconsole.close.key"),
-                   this.window.close.bind(this.window));
+                   this.window.top.close.bind(this.window.top));
 
       ZoomKeys.register(this.window);
     } else if (Services.prefs.getBoolPref(PREF_SIDEBAR_ENABLED)) {
       shortcuts.on("Esc", (name, event) => {
         if (!this.jsterm.autocompletePopup || !this.jsterm.autocompletePopup.isOpen) {
           this.newConsoleOutput.dispatchSidebarClose();
         }
       });