Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Commit

Permalink
insert a setTimeout between two main phases of assertion generation t…
Browse files Browse the repository at this point in the history
…o prevent unresponsive script warnings in IE8 - issue #1575
  • Loading branch information
lloyd committed May 10, 2012
1 parent 31fdd88 commit 71a5375
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions resources/static/shared/user.js
Expand Up @@ -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);
}

Expand Down

0 comments on commit 71a5375

Please sign in to comment.