Bug 1144782 - LoopUI should listen to "TabSelect" rather than the "select" event. r=dao
authorJohn Kang <johnkang.h@gmail.com>
Sat, 21 Mar 2015 20:52:06 +0100
changeset 263750 86f331b93e3022e576fa476b475bda8535ca60e6
parent 263749 86ece202348a0f04cec5bcadab9a281c53e6274d
child 263751 2921b421255b6c35e812aaafad5cbe850830ee30
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1144782
milestone39.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 1144782 - LoopUI should listen to "TabSelect" rather than the "select" event. r=dao
browser/base/content/browser-loop.js
--- a/browser/base/content/browser-loop.js
+++ b/browser/base/content/browser-loop.js
@@ -357,17 +357,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
      * - {Integer} windowId  The new windowId for the browser.
      *
      * @param {Function} listener The listener to receive information on when the
      *                            windowId changes.
      */
     addBrowserSharingListener: function(listener) {
       if (!this._tabChangeListeners) {
         this._tabChangeListeners = new Set();
-        gBrowser.addEventListener("select", this);
+        gBrowser.tabContainer.addEventListener("TabSelect", this);
       }
 
       this._tabChangeListeners.add(listener);
       this._maybeShowBrowserSharingInfoBar();
 
       // Get the first window Id for the listener.
       listener(null, gBrowser.selectedBrowser.outerWindowID);
     },
@@ -383,17 +383,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
       }
 
       if (this._tabChangeListeners.has(listener)) {
         this._tabChangeListeners.delete(listener);
       }
 
       if (!this._tabChangeListeners.size) {
         this._hideBrowserSharingInfoBar();
-        gBrowser.removeEventListener("select", this);
+        gBrowser.tabContainer.removeEventListener("TabSelect", this);
         delete this._tabChangeListeners;
       }
     },
 
     /**
      * Helper function to fetch a localized string via the MozLoopService API.
      * It's currently inconveniently wrapped inside a string of stringified JSON.
      *
@@ -479,24 +479,24 @@ XPCOMUtils.defineLazyModuleGetter(this, 
       return removed;
     },
 
     /**
      * Handles events from gBrowser.
      */
     handleEvent: function(event) {
       // We only should get "select" events.
-      if (event.type != "select") {
+      if (event.type != "TabSelect") {
         return;
       }
 
       let wasVisible = false;
       // Hide the infobar from the previous tab.
-      if (event.fromTab) {
-        wasVisible = this._hideBrowserSharingInfoBar(false, event.fromTab.linkedBrowser);
+      if (event.detail.previousTabfromTab) {
+        wasVisible = this._hideBrowserSharingInfoBar(false, event.detail.previousTab.linkedBrowser);
       }
 
       // We've changed the tab, so get the new window id.
       for (let listener of this._tabChangeListeners) {
         try {
           listener(null, gBrowser.selectedBrowser.outerWindowID);
         } catch (ex) {
           Cu.reportError("Tab switch caused an error: " + ex.message);