Merge branch 'no-timeout' into v1.2-next

This commit is contained in:
AJ ONeal 2017-11-24 01:00:20 +00:00
commit e27af15485
1 changed files with 14 additions and 13 deletions

View File

@ -1054,11 +1054,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) {
@ -1080,14 +1079,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]) {