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

sysrqb at torproject.org sysrqb at torproject.org
Fri Jul 9 17:37:07 UTC 2021


commit f5dbe466cd7e3a37318fd4e68e93599b5bd35b23
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 tbb-commits mailing list