Bug 927398 - Missing call to .uninit() in DOMRequestHelper. r=fabrice
authorFernando Jiménez <ferjmoreno@gmail.com>
Fri, 18 Oct 2013 12:58:24 +0200
changeset 166104 c826eb7042874560a7ea2b5c38d7b0c961051c9e
parent 166103 d50df2233e95f4d45b35eddbfbe84bcdda6a11e2
child 166105 4e3059e1d9f9813bc25f62bd244ecdb6ffd24ca9
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs927398
milestone27.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 927398 - Missing call to .uninit() in DOMRequestHelper. r=fabrice
dom/base/DOMRequestHelper.jsm
--- a/dom/base/DOMRequestHelper.jsm
+++ b/dom/base/DOMRequestHelper.jsm
@@ -149,33 +149,46 @@ DOMRequestIpcHelper.prototype = {
     this._window = aWindow;
     if (this._window) {
       // We don't use this.innerWindowID, but other classes rely on it.
       let util = this._window.QueryInterface(Ci.nsIInterfaceRequestor)
                              .getInterface(Ci.nsIDOMWindowUtils);
       this.innerWindowID = util.currentInnerWindowID;
     }
 
+    this._destroyed = false;
+
     Services.obs.addObserver(this, "inner-window-destroyed", false);
   },
 
   destroyDOMRequestHelper: function() {
+    if (this._destroyed) {
+      return;
+    }
+
+    this._destroyed = true;
+
     Services.obs.removeObserver(this, "inner-window-destroyed");
 
     if (this._listeners) {
       Object.keys(this._listeners).forEach((aName) => {
         this._listeners[aName] ? cpmm.removeMessageListener(aName, this)
                                : cpmm.removeWeakMessageListener(aName, this);
         delete this._listeners[aName];
       });
     }
 
     this._listeners = null;
     this._requests = null;
     this._window = null;
+
+    // Objects inheriting from DOMRequestIPCHelper may have an uninit function.
+    if (this.uninit) {
+      this.uninit();
+    }
   },
 
   observe: function(aSubject, aTopic, aData) {
     if (aTopic !== "inner-window-destroyed") {
       return;
     }
 
     let wId = aSubject.QueryInterface(Ci.nsISupportsPRUint64).data;