Bug 966159 - Fix TypeError when trying to unlink account. r=ckarlof
authorMark Hammond <mhammond@skippinet.com.au>
Thu, 30 Jan 2014 21:05:23 -0800
changeset 182249 3cca5a116a0d9408328b6af182c84630affc45ef
parent 182248 d70e66df236348f66e9b24f234848de040fddf96
child 182250 df246336a9ab8d164d2d7379ef9992ef637ee6ff
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckarlof
bugs966159
milestone29.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 966159 - Fix TypeError when trying to unlink account. r=ckarlof
services/fxaccounts/FxAccounts.jsm
--- a/services/fxaccounts/FxAccounts.jsm
+++ b/services/fxaccounts/FxAccounts.jsm
@@ -138,19 +138,24 @@ InternalMethods.prototype = {
     return this.getUserAccountData().then((data) => {
       if (!data) {
         throw new Error("Can't get keys; User is not signed in");
       }
       if (data.kA && data.kB) {
         return data;
       }
       if (!this.whenKeysReadyPromise) {
-        this.whenKeysReadyPromise = this.fetchAndUnwrapKeys(data.keyFetchToken);
+        this.whenKeysReadyPromise = Promise.defer();
+        this.fetchAndUnwrapKeys(data.keyFetchToken).then(data => {
+          if (this.whenKeysReadyPromise) {
+            this.whenKeysReadyPromise.resolve(data);
+          }
+        });
       }
-      return this.whenKeysReadyPromise;
+      return this.whenKeysReadyPromise.promise;
     });
    },
 
   fetchAndUnwrapKeys: function(keyFetchToken) {
     log.debug("fetchAndUnwrapKeys: token: " + keyFetchToken);
     return Task.spawn(function* task() {
       // Sign out if we don't have a key fetch token.
       if (!keyFetchToken) {