Bug 817539 - [toolbox] close the responsive mode on ESC, even if toolbox is up, r=vporof
authorPaul Rouget <paul@mozilla.com>
Sun, 16 Dec 2012 11:14:15 +0200
changeset 116649 d055a17c13246bcfbc8d646e537eccefed77918f
parent 116648 77d729ffd925cc76d62c2ca83ca704824b9791d7
child 116650 0248cb0ceeb6885e0b2b391a72199bdba32a0f7a
push idunknown
push userunknown
push dateunknown
reviewersvporof
bugs817539
milestone20.0a1
Bug 817539 - [toolbox] close the responsive mode on ESC, even if toolbox is up, r=vporof
browser/devtools/responsivedesign/responsivedesign.jsm
--- a/browser/devtools/responsivedesign/responsivedesign.jsm
+++ b/browser/devtools/responsivedesign/responsivedesign.jsm
@@ -153,19 +153,16 @@ function ResponsiveUI(aWindow, aTab)
   // Events
   this.tab.addEventListener("TabClose", this);
   this.tabContainer.addEventListener("TabSelect", this);
   this.mainWindow.document.addEventListener("keypress", this.bound_onKeypress, false);
 
   this.buildUI();
   this.checkMenus();
 
-  let target = TargetFactory.forTab(this.tab);
-  this.toolboxWasOpen = !!gDevTools.getToolbox(target);
-
   try {
     if (Services.prefs.getBoolPref("devtools.responsiveUI.rotate")) {
       this.rotate();
     }
   } catch(e) {}
 
   if (this._floatingScrollbars)
     switchToFloatingScrollbars(this.tab);
@@ -234,27 +231,19 @@ ResponsiveUI.prototype = {
    * Handle keypressed.
    *
    * @param aEvent
    */
   onKeypress: function RUI_onKeypress(aEvent) {
     if (aEvent.keyCode == this.mainWindow.KeyEvent.DOM_VK_ESCAPE &&
         this.mainWindow.gBrowser.selectedBrowser == this.browser) {
 
-      // If the toolbox wasn't open at first but is open now,
-      // we don't want to close the Responsive Mode on Escape.
-      // We let the toolbox close first.
-
-      let target = TargetFactory.forTab(this.tab);
-      let isToolboxOpen =  !!gDevTools.getToolbox(target);
-      if (this.toolboxWasOpen || !isToolboxOpen) {
-        aEvent.preventDefault();
-        aEvent.stopPropagation();
-        this.close();
-      }
+      aEvent.preventDefault();
+      aEvent.stopPropagation();
+      this.close();
     }
   },
 
   /**
    * Handle events
    */
   handleEvent: function (aEvent) {
     switch (aEvent.type) {