[tor-commits] [tor-browser] 14/33: fixup! fixup! Bug 40597: Implement TorSettings module

gitolite role git at cupani.torproject.org
Tue May 3 22:40:22 UTC 2022


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 at 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;
   }
 
   //

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list