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

sysrqb at torproject.org sysrqb at torproject.org
Wed Aug 4 17:13:34 UTC 2021


commit e81a03a26ee2142b4f498902dde7332444ac6145
Author: Richard Pospesel <richard at torproject.org>
Date:   Fri Jul 9 12:10:31 2021 +0200

    fixup! Bug 27476: Implement about:torconnect captive portal within Tor Browser
---
 browser/components/BrowserGlue.jsm | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/browser/components/BrowserGlue.jsm b/browser/components/BrowserGlue.jsm
index 914b782afdb1..8735783cee2b 100644
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -17,11 +17,28 @@ const { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 
-const { TorProtocolService } = ChromeUtils.import(
+// TorProtocolService and TorConnect modules need to be lazily-loaded
+// here because they will trigger generation of the random password used
+// to talk to the tor daemon in tor-launcher. Generating the random
+// password will initialize the cryptographic service ( nsNSSComponent )
+//
+// If this service is init'd before the profile has been setup, it will
+// use the fallback init path which behaves as if security.nocertdb=true
+//
+// We make these module getters so init happens when they are needed
+// (when init'ing the OnionAliasStore). With theze getters, the password
+// generation is triggered in torbutton after the 'profile-after-change'
+// topic (so after the profile is initialized)
+
+ChromeUtils.defineModuleGetter(
+  this,
+  "TorProtocolService",
   "resource:///modules/TorProtocolService.jsm"
 );
 
-const { TorConnect } = ChromeUtils.import(
+ChromeUtils.defineModuleGetter(
+  this,
+  "TorConnect",
   "resource:///modules/TorConnect.jsm"
 );
 





More information about the tor-commits mailing list