This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1 in repository tor-browser.
commit 4a98eaf61f7173d39d32d215912ce078ee9cbb5a Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Fri Apr 8 17:54:03 2022 +0200
fixup! fixup! Bug 40597: Implement TorSettings module
Improved the Internet status test. Probably it always failed when offline, because getting responseStatus would throw an exception. Also, it returns the server's date when successful. --- browser/modules/Moat.jsm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/browser/modules/Moat.jsm b/browser/modules/Moat.jsm index 2995a9148f0a3..bdcf6cb631561 100644 --- a/browser/modules/Moat.jsm +++ b/browser/modules/Moat.jsm @@ -393,7 +393,7 @@ class InternetTestResponseListener { }
// callers wait on this for final response - status() { + get status() { return this._promise; }
@@ -406,8 +406,18 @@ class InternetTestResponseListener { statuses = { components: status, successful: Components.isSuccessCode(status), - http: request.responseStatus, }; + try { + if (statuses.successful) { + statuses.http = request.responseStatus; + statuses.date = request.getResponseHeader("Date"); + } + } catch (err) { + console.warn( + "Successful request, but could not get the HTTP status or date", + err + ); + } } catch (err) { this._reject(err); } @@ -549,7 +559,7 @@ class MoatRPC {
const listener = new InternetTestResponseListener(); await ch.asyncOpen(listener, ch); - return listener.status(); + return listener.status; }
//