Merge branch 'no-timeout' of OAuth3/oauth3.js into v1.2

This commit is contained in:
AJ ONeal 2017-11-24 01:00:06 +00:00 committed by Gogs
commit c59e23d114
1 changed files with 14 additions and 13 deletions

View File

@ -1030,11 +1030,10 @@
}
var timeout = opts.timeout;
if (opts.debug) {
timeout = timeout || 3 * 60 * 1000;
}
else {
timeout = timeout || ('background' === windowType ? 15 * 1000 : 3 * 60 * 1000);
if ('background' === windowType) {
if (!timeout) {
timeout = 7 * 1000;
}
}
return new OAUTH3.PromiseA(function (resolve, reject) {
@ -1056,14 +1055,16 @@
cleanup();
};
tok = setTimeout(function () {
var err = new Error(
"the '" + windowType + "' request did not complete within " + Math.round(timeout / 1000) + "s"
);
err.code = "E_TIMEOUT";
reject(err);
cleanup();
}, timeout);
if (timeout) {
tok = setTimeout(function () {
var err = new Error(
"the '" + windowType + "' request did not complete within " + Math.round(timeout / 1000) + "s"
);
err.code = "E_TIMEOUT";
reject(err);
cleanup();
}, timeout);
}
setTimeout(function () {
if (!OAUTH3._browser._frames[state]) {