[tbb-commits] [tor-browser/tor-browser-78.11.0esr-10.5-1] fixup! Bug 27476: Implement about:torconnect captive portal within Tor Browser

sysrqb at torproject.org sysrqb at torproject.org
Thu Jul 8 16:48:20 UTC 2021


commit 21083586165d60491d7b4c590ca166415d1f104e
Author: Matthew Finkel <sysrqb at torproject.org>
Date:   Thu Jul 8 16:25:50 2021 +0000

    fixup! Bug 27476: Implement about:torconnect captive portal within Tor Browser
---
 browser/components/sessionstore/SessionStore.jsm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/browser/components/sessionstore/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm
index 6ab86fd5913e..2d66422abf58 100644
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -213,6 +213,10 @@ ChromeUtils.defineModuleGetter(
   "resource://gre/modules/sessionstore/SessionHistory.jsm"
 );
 
+const { TorProtocolService } = ChromeUtils.import(
+    "resource:///modules/TorProtocolService.jsm"
+);
+
 XPCOMUtils.defineLazyServiceGetters(this, {
   gScreenManager: ["@mozilla.org/gfx/screenmanager;1", "nsIScreenManager"],
   Telemetry: ["@mozilla.org/base/telemetry;1", "nsITelemetry"],
@@ -1888,11 +1892,23 @@ var SessionStoreInternal = {
         }, "browser-delayed-startup-finished");
       });
 
+      let bootstrapPromise = new Promise(resolve => {
+        if (TorProtocolService.isBootstrapDone() || !TorProtocolService.ownsTorDaemon) {
+          resolve();
+        } else {
+          Services.obs.addObserver(function obs(subject, topic) {
+            Services.obs.removeObserver(obs, topic);
+            resolve();
+          }, "torconnect:bootstrap-complete");
+        }
+      });
+
       // We are ready for initialization as soon as the session file has been
       // read from disk and the initial window's delayed startup has finished.
       this._promiseReadyForInitialization = Promise.all([
         promise,
         SessionStartup.onceInitialized,
+        bootstrapPromise,
       ]);
     }
 



More information about the tbb-commits mailing list