Bug 1065128 - Make identity API use dom-window-destroyed for shutdown; r=ferjmoreno
authorKyle Machulis <kyle@nonpolynomial.com>
Mon, 15 Sep 2014 13:39:20 -0700
changeset 228693 938e9a34f204a7cb53eddef3eb45753703796a6a
parent 228692 3d4b867d6bc7270b48c55e05e42152ec05075d6b
child 228694 b72e89edbcc135ff218976190c07c5f719cd1a11
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)
reviewersferjmoreno
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 identity API use dom-window-destroyed for shutdown; r=ferjmoreno
dom/identity/nsDOMIdentity.js
--- a/dom/identity/nsDOMIdentity.js
+++ b/dom/identity/nsDOMIdentity.js
@@ -702,24 +702,24 @@ nsDOMIdentityInternal.prototype = {
     if (msg.id != this._id) {
       return;
     }
     this._identity._receiveMessage(aMessage);
   },
 
   // nsIObserver
   observe: function nsDOMIdentityInternal_observe(aSubject, aTopic, aData) {
-    let wId = aSubject.QueryInterface(Ci.nsISupportsPRUint64).data;
-    if (wId != this._innerWindowID) {
+    let window = aSubject.QueryInterface(Ci.nsIDOMWindow);
+    if (window != this._window) {
       return;
     }
 
     this._identity.uninit();
 
-    Services.obs.removeObserver(this, "inner-window-destroyed");
+    Services.obs.removeObserver(this, "dom-window-destroyed");
     this._identity._initializeState();
     this._identity = null;
 
     // TODO: Also send message to DOMIdentity notifiying window is no longer valid
     // ie. in the case that the user closes the auth. window and we need to know.
 
     try {
       for (let msgName of this._messages) {
@@ -747,17 +747,17 @@ nsDOMIdentityInternal.prototype = {
                       .getInterface(Ci.nsIDOMWindowUtils);
 
     // To avoid cross-process windowId collisions, use a uuid as an
     // almost certainly unique identifier.
     //
     // XXX Bug 869182 - use a combination of child process id and
     // innerwindow id to construct the unique id.
     this._id = uuidgen.generateUUID().toString();
-    this._innerWindowID = util.currentInnerWindowID;
+    this._window = aWindow;
 
     // nsDOMIdentity needs to know our _id, so this goes after
     // its creation.
     this._identity = new nsDOMIdentity(this);
     this._identity._init(aWindow);
 
     this._log("init was called from " + aWindow.document.location);
 
@@ -775,17 +775,17 @@ nsDOMIdentityInternal.prototype = {
       "Identity:IDP:CallGenKeyPairCallback",
       "Identity:IDP:CallBeginAuthenticationCallback"
     ];
     this._messages.forEach(function(msgName) {
       this._mm.addMessageListener(msgName, this);
     }, this);
 
     // Setup observers so we can remove message listeners.
-    Services.obs.addObserver(this, "inner-window-destroyed", false);
+    Services.obs.addObserver(this, "dom-window-destroyed", false);
 
     return this._identity;
   },
 
   // Private.
   _log: function nsDOMIdentityInternal__log(msg) {
     if (!this._debug) {
       return;