From 2c0b757c136d7f2c4b9e981508ce06da01192011 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 24 Nov 2017 00:49:35 +0000 Subject: [PATCH] no timeout --- oauth3.core.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/oauth3.core.js b/oauth3.core.js index fdd707b..4d3d7d9 100644 --- a/oauth3.core.js +++ b/oauth3.core.js @@ -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]) {