Permalink
Browse files

Merge pull request #1576 from mozilla/issue1575

insert a setTimeout between two main phases of assertion generation

closes #1575
  • Loading branch information...
2 parents 31fdd88 + 71a5375 commit 77d24f390e744f2f83b8d4a858d7f875c4a8e6a6 @benadida benadida committed May 10, 2012
Showing with 14 additions and 12 deletions.
  1. +14 −12 resources/static/shared/user.js
@@ -943,18 +943,20 @@ BrowserID.User = (function() {
network.serverTime(function(serverTime) {
var sk = jwcrypto.loadSecretKeyFromObject(idInfo.priv);
- // assertions are valid for 2 minutes
- var expirationMS = serverTime.getTime() + (2 * 60 * 1000);
- var expirationDate = new Date(expirationMS);
-
- jwcrypto.assertion.sign(
- {}, {audience: audience, expiresAt: expirationDate},
- sk,
- function(err, signedAssertion) {
- assertion = jwcrypto.cert.bundle([idInfo.cert], signedAssertion);
- storage.site.set(audience, "email", email);
- complete(assertion);
- });
+ setTimeout(function() {
+ // assertions are valid for 2 minutes
+ var expirationMS = serverTime.getTime() + (2 * 60 * 1000);
+ var expirationDate = new Date(expirationMS);
+
+ jwcrypto.assertion.sign(
+ {}, {audience: audience, expiresAt: expirationDate},
+ sk,
+ function(err, signedAssertion) {
+ assertion = jwcrypto.cert.bundle([idInfo.cert], signedAssertion);
+ storage.site.set(audience, "email", email);
+ complete(assertion);
+ });
+ }, 0);
}, onFailure);
}

0 comments on commit 77d24f3

Please sign in to comment.