From f40512756b00d3524e8d25ca21676568ff22bb64 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Fri, 30 Sep 2011 17:25:29 -0700 Subject: [PATCH] Bug 690973 - Opening a new tab in portrait does not open the awesomescreen [r=wesj] --- mobile/chrome/content/TabsPopup.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mobile/chrome/content/TabsPopup.js b/mobile/chrome/content/TabsPopup.js index e7187bef926c..769d87228473 100644 --- a/mobile/chrome/content/TabsPopup.js +++ b/mobile/chrome/content/TabsPopup.js @@ -41,6 +41,9 @@ var TabsPopup = { Elements.tabs.addEventListener("TabRemove", this, true); this._updateTabsCount(); + + // Bind resizeHandler so we can pass it to addEventListener/removeEventListener. + this.resizeHandler = this.resizeHandler.bind(this); }, get box() { @@ -117,12 +120,7 @@ var TabsPopup = { this.box.anchorTo(this.button, "after_end"); BrowserUI.pushPopup(this, [this.box, this.button]); - window.addEventListener("resize", function resizeHandler(aEvent) { - if (aEvent.target != window) - return; - if (!Util.isPortrait()) - TabsPopup._hidePortraitMenu(); - }, false); + window.addEventListener("resize", this.resizeHandler, false); }, toggle: function toggle() { @@ -140,7 +138,7 @@ var TabsPopup = { if (!this.box.hidden) { this.box.hidden = true; BrowserUI.popPopup(this); - window.removeEventListener("resize", resizeHandler, false); + window.removeEventListener("resize", this.resizeHandler, false); } }, @@ -172,6 +170,13 @@ var TabsPopup = { cmd.setAttribute("label", Browser.tabs.length); }, + resizeHandler: function resizeHandler(aEvent) { + if (aEvent.target != window) + return; + if (!Util.isPortrait()) + this._hidePortraitMenu(); + }, + handleEvent: function handleEvent(aEvent) { this._updateTabsCount(); }