Bug 1298812 Don't hold windows alive unnecessarily in window-utils.js. r=gabor
authorBen Kelly <ben@wanderview.com>
Wed, 31 Aug 2016 06:48:01 -0700
changeset 353362 9e20e6e53428e544810f60b8222b60d3c2f52459
parent 353361 53648698037586ee855b16ba6187d904cc6817cd
child 353363 1a4c20fec8312d7bc6972973e01456fd8cfdb887
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor
bugs1298812
milestone51.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 1298812 Don't hold windows alive unnecessarily in window-utils.js. r=gabor
addon-sdk/source/lib/sdk/deprecated/window-utils.js
--- a/addon-sdk/source/lib/sdk/deprecated/window-utils.js
+++ b/addon-sdk/source/lib/sdk/deprecated/window-utils.js
@@ -57,17 +57,16 @@ function browserWindowIterator() {
 exports.browserWindowIterator = browserWindowIterator;
 
 function WindowTracker(delegate) {
    if (!(this instanceof WindowTracker)) {
      return new WindowTracker(delegate);
    }
 
   this._delegate = delegate;
-  this._loadingWindows = [];
 
   for (let window of getWindows())
     this._regWindow(window);
   windowWatcher.registerNotification(this);
   this._onToplevelWindowReady = this._onToplevelWindowReady.bind(this);
   events.on('toplevel-window-ready', this._onToplevelWindowReady);
 
   require('../system/unload').ensure(this);
@@ -76,27 +75,22 @@ function WindowTracker(delegate) {
 };
 
 WindowTracker.prototype = {
   _regLoadingWindow: function _regLoadingWindow(window) {
     // Bug 834961: ignore private windows when they are not supported
     if (ignoreWindow(window))
       return;
 
-    this._loadingWindows.push(window);
     window.addEventListener('load', this, true);
   },
 
   _unregLoadingWindow: function _unregLoadingWindow(window) {
-    var index = this._loadingWindows.indexOf(window);
-
-    if (index != -1) {
-      this._loadingWindows.splice(index, 1);
-      window.removeEventListener('load', this, true);
-    }
+    // This may have no effect if we ignored the window in _regLoadingWindow().
+    window.removeEventListener('load', this, true);
   },
 
   _regWindow: function _regWindow(window) {
     // Bug 834961: ignore private windows when they are not supported
     if (ignoreWindow(window))
       return;
 
     if (window.document.readyState == 'complete') {