From 6c7f97b95e3debd3dd46d18fec4192befd97f233 Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Wed, 13 Jun 2012 13:58:33 +0200 Subject: [PATCH] Bug 764318 - [responsive mode] use this.tab.selected; r=dao --- .../devtools/responsivedesign/responsivedesign.jsm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/browser/devtools/responsivedesign/responsivedesign.jsm b/browser/devtools/responsivedesign/responsivedesign.jsm index 766f326e179..497c578e89b 100644 --- a/browser/devtools/responsivedesign/responsivedesign.jsm +++ b/browser/devtools/responsivedesign/responsivedesign.jsm @@ -57,6 +57,7 @@ function ResponsiveUI(aWindow, aTab) { this.mainWindow = aWindow; this.tab = aTab; + this.tabContainer = aWindow.gBrowser.tabContainer; this.browser = aTab.linkedBrowser; this.chromeDoc = aWindow.document; this.container = aWindow.gBrowser.getBrowserContainer(this.browser); @@ -110,7 +111,7 @@ function ResponsiveUI(aWindow, aTab) // Events this.tab.addEventListener("TabClose", this); - this.tab.addEventListener("TabAttrModified", this); + this.tabContainer.addEventListener("TabSelect", this); this.mainWindow.addEventListener("keypress", this.bound_onKeypress, true); this.buildUI(); @@ -156,7 +157,7 @@ ResponsiveUI.prototype = { this.mainWindow.removeEventListener("keypress", this.bound_onKeypress, true); this.menulist.removeEventListener("select", this.bound_presetSelected, true); this.tab.removeEventListener("TabClose", this); - this.tab.removeEventListener("TabAttrModified", this); + this.tabContainer.removeEventListener("TabSelect", this); this.rotatebutton.removeEventListener("command", this.bound_rotate, true); // Removed elements. @@ -208,10 +209,10 @@ ResponsiveUI.prototype = { case "TabClose": this.close(); break; - case "TabAttrModified": - if (this.mainWindow.gBrowser.selectedBrowser == this.browser) { + case "TabSelect": + if (this.tab.selected) { this.checkMenus(); - } else { + } else if (!this.mainWindow.gBrowser.selectedTab.responsiveUI) { this.unCheckMenus(); } break;