Bug 876968 - Remove HiddenBrowsers observers only if they have been added before; r=jaws
authorTim Taubert <ttaubert@mozilla.com>
Wed, 29 May 2013 16:40:44 +0200
changeset 133276 008e4e53a4ff4de2e6c23dd13731ca77b9163fba
parent 133275 b6f1f43be5047afbaa8f3c8c8af3d09a89d6f4f8
child 133277 bcd65c77dc23a649dd0fbb2eb8108aee91f6dd92
push id24749
push userttaubert@mozilla.com
push dateThu, 30 May 2013 11:12:36 +0000
treeherderautoland@d0e2d9035232 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs876968
milestone24.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 876968 - Remove HiddenBrowsers observers only if they have been added before; r=jaws
browser/modules/BrowserNewTabPreloader.jsm
--- a/browser/modules/BrowserNewTabPreloader.jsm
+++ b/browser/modules/BrowserNewTabPreloader.jsm
@@ -164,20 +164,20 @@ let HiddenBrowsers = {
 
   init: function () {
     this._browsers = new Map();
     this._updateBrowserSizes();
     this._topics.forEach(t => Services.obs.addObserver(this, t, false));
   },
 
   uninit: function () {
-    this._topics.forEach(t => Services.obs.removeObserver(this, t, false));
-    this._updateTimer = clearTimer(this._updateTimer);
+    if (this._browsers) {
+      this._topics.forEach(t => Services.obs.removeObserver(this, t, false));
+      this._updateTimer = clearTimer(this._updateTimer);
 
-    if (this._browsers) {
       for (let [key, browser] of this._browsers) {
         browser.destroy();
       }
       this._browsers = null;
     }
   },
 
   get: function (width, height) {