Bug 1065128 - Make SettingsManager use dom-window-destroyed for shutdown; r=bent
authorKyle Machulis <kyle@nonpolynomial.com>
Mon, 15 Sep 2014 13:39:20 -0700
changeset 228694 b72e89edbcc135ff218976190c07c5f719cd1a11
parent 228693 938e9a34f204a7cb53eddef3eb45753703796a6a
child 228695 d4b6ecaee33ceae44c190c8baf0b59679fb9e1f4
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs1065128
milestone35.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 1065128 - Make SettingsManager use dom-window-destroyed for shutdown; r=bent
dom/settings/SettingsManager.js
--- a/dom/settings/SettingsManager.js
+++ b/dom/settings/SettingsManager.js
@@ -354,26 +354,25 @@ SettingsManager.prototype = {
   },
 
   init: function(aWindow) {
     if (DEBUG) debug("SettingsManager init");
     mrm.registerStrongReporter(this);
     cpmm.addMessageListener("Settings:Change:Return:OK", this);
     this._window = aWindow;
     this._principal = this._window.document.nodePrincipal;
-    Services.obs.addObserver(this, "inner-window-destroyed", false);
+    Services.obs.addObserver(this, "dom-window-destroyed", false);
     let util = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
     this.innerWindowID = util.currentInnerWindowID;
   },
 
   observe: function(aSubject, aTopic, aData) {
-    if (aTopic == "inner-window-destroyed") {
-      let wId = aSubject.QueryInterface(Ci.nsISupportsPRUint64).data;
-      if (wId == this.innerWindowID) {
-        if (DEBUG) debug("Topic: " + aTopic);
+    if (aTopic == "dom-window-destroyed") {
+      let window = aSubject.QueryInterface(Ci.nsIDOMWindow);
+      if (window == this._window) {
         this.cleanup();
       }
     }
   },
 
   collectReports: function(aCallback, aData, aAnonymize) {
     for (let topic in this._callbacks) {
       let length = this._callbacks[topic].length;
@@ -394,17 +393,17 @@ SettingsManager.prototype = {
                          Ci.nsIMemoryReporter.UNITS_COUNT,
                          this._callbacks[topic].length,
                          "The number of settings observers for this topic.",
                          aData);
     }
   },
 
   cleanup: function() {
-    Services.obs.removeObserver(this, "inner-window-destroyed");
+    Services.obs.removeObserver(this, "dom-window-destroyed");
     cpmm.removeMessageListener("Settings:Change:Return:OK", this);
     mrm.unregisterStrongReporter(this);
     // At this point, the window is dying, so there's nothing left
     // that we could do with our lock. Go ahead and run finalize on
     // it to make sure changes are commited.
     for (let i = 0; i < this._locks.length; ++i) {
       if (DEBUG) debug("Lock alive at destroy, finalizing: " + this._locks[i]);
       cpmm.sendAsyncMessage("Settings:Finalize",