Loading browser/components/BrowserComponents.manifest +2 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ category browser-first-window-ready moz-src:///browser/modules/ClipboardPrivacy. category browser-first-window-ready moz-src:///browser/modules/SecurityLevelNotification.sys.mjs SecurityLevelNotification.ready category browser-first-window-ready moz-src:///toolkit/modules/DragDropFilter.sys.mjs DragDropFilter.init category browser-first-window-ready moz-src:///browser/modules/TorSettingsNotification.sys.mjs TorSettingsNotification.ready category browser-first-window-ready moz-src:///browser/components/onionservices/OnionAliasStore.sys.mjs OnionAliasStore.init category browser-idle-startup moz-src:///browser/components/places/PlacesUIUtils.sys.mjs PlacesUIUtils.unblockToolbars category browser-idle-startup resource:///modules/BuiltInThemes.sys.mjs BuiltInThemes.ensureBuiltInThemes Loading Loading @@ -101,5 +102,6 @@ category browser-quit-application-granted resource://gre/modules/UpdateListener. #endif category browser-quit-application-granted resource:///modules/UrlbarSearchTermsPersistence.sys.mjs UrlbarSearchTermsPersistence.uninit category browser-quit-application-granted resource:///modules/ipprotection/IPProtectionService.sys.mjs IPProtectionService.uninit category browser-quit-application-granted moz-src:///browser/components/onionservices/OnionAliasStore.sys.mjs OnionAliasStore.uninit category search-service-notification moz-src:///browser/components/search/SearchUIUtils.sys.mjs SearchUIUtils.showSearchServiceNotification browser/components/BrowserGlue.sys.mjs +0 −28 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ ChromeUtils.defineESModuleGetters(lazy, { LoginHelper: "resource://gre/modules/LoginHelper.sys.mjs", MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs", NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs", OnionAliasStore: "resource:///modules/OnionAliasStore.sys.mjs", OnboardingMessageProvider: "resource:///modules/asrouter/OnboardingMessageProvider.sys.mjs", PageDataService: Loading Loading @@ -66,8 +65,6 @@ ChromeUtils.defineESModuleGetters(lazy, { TelemetryReportingPolicy: "resource://gre/modules/TelemetryReportingPolicy.sys.mjs", TRRRacer: "resource:///modules/TRRPerformance.sys.mjs", TorConnect: "resource://gre/modules/TorConnect.sys.mjs", TorConnectTopics: "resource://gre/modules/TorConnect.sys.mjs", WebChannel: "resource://gre/modules/WebChannel.sys.mjs", WebProtocolHandlerRegistrar: "resource:///modules/WebProtocolHandlerRegistrar.sys.mjs", Loading Loading @@ -869,7 +866,6 @@ BrowserGlue.prototype = { // can perform at-shutdown tasks later in shutdown. Services.fog; }, () => lazy.OnionAliasStore.uninit(), ]; for (let task of tasks) { Loading Loading @@ -1140,30 +1136,6 @@ BrowserGlue.prototype = { }, }, { task: () => { if (!lazy.TorConnect.shouldShowTorConnect) { // we will take this path when the user is using the legacy tor launcher or // when Tor Browser didn't launch its own tor. lazy.OnionAliasStore.init(); } else { // this path is taken when using about:torconnect, we wait to init // after we are bootstrapped and connected to tor const topic = lazy.TorConnectTopics.BootstrapComplete; let bootstrapObserver = { observe(aSubject, aTopic) { if (aTopic === topic) { lazy.OnionAliasStore.init(); // we only need to init once, so remove ourselves as an obvserver Services.obs.removeObserver(this, topic); } }, }; Services.obs.addObserver(bootstrapObserver, topic); } }, }, // Run TRR performance measurements for DoH. { name: "doh-rollout.trrRacer.run", Loading browser/components/onionservices/OnionAliasStore.sys.mjs +18 −3 Original line number Diff line number Diff line // Copyright (c) 2022, The Tor Project, Inc. /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import { setTimeout, clearTimeout } from "resource://gre/modules/Timer.sys.mjs"; Loading @@ -6,7 +8,10 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { JSONFile: "resource://gre/modules/JSONFile.sys.mjs", TorRequestWatch: "resource:///modules/TorRequestWatch.sys.mjs", TorConnect: "resource://gre/modules/TorConnect.sys.mjs", TorConnectTopics: "resource://gre/modules/TorConnect.sys.mjs", TorRequestWatch: "moz-src:///browser/components/onionservices/TorRequestWatch.sys.mjs", }); /* OnionAliasStore observer topics */ Loading Loading @@ -287,8 +292,10 @@ class _OnionAliasStore { async init() { lazy.TorRequestWatch.start(); await this.#loadSettings(); if (this.enabled) { if (this.enabled && !lazy.TorConnect.shouldShowTorConnect) { await this.#startUpdates(); } else { Services.obs.addObserver(this, lazy.TorConnectTopics.BootstrapComplete); } Services.prefs.addObserver(kPrefOnionAliasEnabled, this); } Loading @@ -299,7 +306,10 @@ class _OnionAliasStore { clearTimeout(this.#rulesetTimeout); } this.#rulesetTimeout = null; Services.obs.removeObserver(this, lazy.TorConnectTopics.BootstrapComplete); Services.prefs.removeObserver(kPrefOnionAliasEnabled, this); lazy.TorRequestWatch.stop(); } Loading Loading @@ -543,6 +553,11 @@ class _OnionAliasStore { clearTimeout(this.#rulesetTimeout); this.#rulesetTimeout = null; } } else if ( aTopic === lazy.TorConnectTopics.BootstrapComplete && this.enabled ) { this.#startUpdates(); } } } Loading browser/components/onionservices/moz.build +4 −1 Original line number Diff line number Diff line JAR_MANIFESTS += ["jar.mn"] EXTRA_JS_MODULES += [ "OnionAliasStore.sys.mjs", "OnionLocationChild.sys.mjs", "OnionLocationParent.sys.mjs", ] MOZ_SRC_FILES += [ "OnionAliasStore.sys.mjs", "TorRequestWatch.sys.mjs", ] browser/components/rulesets/RulesetsParent.sys.mjs +6 −3 Original line number Diff line number Diff line // Copyright (c) 2022, The Tor Project, Inc. /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import { OnionAliasStore, OnionAliasStoreTopics, } from "resource:///modules/OnionAliasStore.sys.mjs"; } from "moz-src:///browser/components/onionservices/OnionAliasStore.sys.mjs"; const kShowWarningPref = "torbrowser.rulesets.show_warning"; Loading Loading @@ -56,9 +58,10 @@ export class RulesetsParent extends JSWindowActorParent { return { showWarning: Services.prefs.getBoolPref(kShowWarningPref, true), }; case "rulesets:set-channel": case "rulesets:set-channel": { const ch = await OnionAliasStore.setChannel(message.data); return ch; } case "rulesets:update-channel": // We need to catch any error in this way, because in case of an // exception, RPMSendQuery does not return on the other side Loading Loading
browser/components/BrowserComponents.manifest +2 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ category browser-first-window-ready moz-src:///browser/modules/ClipboardPrivacy. category browser-first-window-ready moz-src:///browser/modules/SecurityLevelNotification.sys.mjs SecurityLevelNotification.ready category browser-first-window-ready moz-src:///toolkit/modules/DragDropFilter.sys.mjs DragDropFilter.init category browser-first-window-ready moz-src:///browser/modules/TorSettingsNotification.sys.mjs TorSettingsNotification.ready category browser-first-window-ready moz-src:///browser/components/onionservices/OnionAliasStore.sys.mjs OnionAliasStore.init category browser-idle-startup moz-src:///browser/components/places/PlacesUIUtils.sys.mjs PlacesUIUtils.unblockToolbars category browser-idle-startup resource:///modules/BuiltInThemes.sys.mjs BuiltInThemes.ensureBuiltInThemes Loading Loading @@ -101,5 +102,6 @@ category browser-quit-application-granted resource://gre/modules/UpdateListener. #endif category browser-quit-application-granted resource:///modules/UrlbarSearchTermsPersistence.sys.mjs UrlbarSearchTermsPersistence.uninit category browser-quit-application-granted resource:///modules/ipprotection/IPProtectionService.sys.mjs IPProtectionService.uninit category browser-quit-application-granted moz-src:///browser/components/onionservices/OnionAliasStore.sys.mjs OnionAliasStore.uninit category search-service-notification moz-src:///browser/components/search/SearchUIUtils.sys.mjs SearchUIUtils.showSearchServiceNotification
browser/components/BrowserGlue.sys.mjs +0 −28 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ ChromeUtils.defineESModuleGetters(lazy, { LoginHelper: "resource://gre/modules/LoginHelper.sys.mjs", MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs", NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs", OnionAliasStore: "resource:///modules/OnionAliasStore.sys.mjs", OnboardingMessageProvider: "resource:///modules/asrouter/OnboardingMessageProvider.sys.mjs", PageDataService: Loading Loading @@ -66,8 +65,6 @@ ChromeUtils.defineESModuleGetters(lazy, { TelemetryReportingPolicy: "resource://gre/modules/TelemetryReportingPolicy.sys.mjs", TRRRacer: "resource:///modules/TRRPerformance.sys.mjs", TorConnect: "resource://gre/modules/TorConnect.sys.mjs", TorConnectTopics: "resource://gre/modules/TorConnect.sys.mjs", WebChannel: "resource://gre/modules/WebChannel.sys.mjs", WebProtocolHandlerRegistrar: "resource:///modules/WebProtocolHandlerRegistrar.sys.mjs", Loading Loading @@ -869,7 +866,6 @@ BrowserGlue.prototype = { // can perform at-shutdown tasks later in shutdown. Services.fog; }, () => lazy.OnionAliasStore.uninit(), ]; for (let task of tasks) { Loading Loading @@ -1140,30 +1136,6 @@ BrowserGlue.prototype = { }, }, { task: () => { if (!lazy.TorConnect.shouldShowTorConnect) { // we will take this path when the user is using the legacy tor launcher or // when Tor Browser didn't launch its own tor. lazy.OnionAliasStore.init(); } else { // this path is taken when using about:torconnect, we wait to init // after we are bootstrapped and connected to tor const topic = lazy.TorConnectTopics.BootstrapComplete; let bootstrapObserver = { observe(aSubject, aTopic) { if (aTopic === topic) { lazy.OnionAliasStore.init(); // we only need to init once, so remove ourselves as an obvserver Services.obs.removeObserver(this, topic); } }, }; Services.obs.addObserver(bootstrapObserver, topic); } }, }, // Run TRR performance measurements for DoH. { name: "doh-rollout.trrRacer.run", Loading
browser/components/onionservices/OnionAliasStore.sys.mjs +18 −3 Original line number Diff line number Diff line // Copyright (c) 2022, The Tor Project, Inc. /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import { setTimeout, clearTimeout } from "resource://gre/modules/Timer.sys.mjs"; Loading @@ -6,7 +8,10 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { JSONFile: "resource://gre/modules/JSONFile.sys.mjs", TorRequestWatch: "resource:///modules/TorRequestWatch.sys.mjs", TorConnect: "resource://gre/modules/TorConnect.sys.mjs", TorConnectTopics: "resource://gre/modules/TorConnect.sys.mjs", TorRequestWatch: "moz-src:///browser/components/onionservices/TorRequestWatch.sys.mjs", }); /* OnionAliasStore observer topics */ Loading Loading @@ -287,8 +292,10 @@ class _OnionAliasStore { async init() { lazy.TorRequestWatch.start(); await this.#loadSettings(); if (this.enabled) { if (this.enabled && !lazy.TorConnect.shouldShowTorConnect) { await this.#startUpdates(); } else { Services.obs.addObserver(this, lazy.TorConnectTopics.BootstrapComplete); } Services.prefs.addObserver(kPrefOnionAliasEnabled, this); } Loading @@ -299,7 +306,10 @@ class _OnionAliasStore { clearTimeout(this.#rulesetTimeout); } this.#rulesetTimeout = null; Services.obs.removeObserver(this, lazy.TorConnectTopics.BootstrapComplete); Services.prefs.removeObserver(kPrefOnionAliasEnabled, this); lazy.TorRequestWatch.stop(); } Loading Loading @@ -543,6 +553,11 @@ class _OnionAliasStore { clearTimeout(this.#rulesetTimeout); this.#rulesetTimeout = null; } } else if ( aTopic === lazy.TorConnectTopics.BootstrapComplete && this.enabled ) { this.#startUpdates(); } } } Loading
browser/components/onionservices/moz.build +4 −1 Original line number Diff line number Diff line JAR_MANIFESTS += ["jar.mn"] EXTRA_JS_MODULES += [ "OnionAliasStore.sys.mjs", "OnionLocationChild.sys.mjs", "OnionLocationParent.sys.mjs", ] MOZ_SRC_FILES += [ "OnionAliasStore.sys.mjs", "TorRequestWatch.sys.mjs", ]
browser/components/rulesets/RulesetsParent.sys.mjs +6 −3 Original line number Diff line number Diff line // Copyright (c) 2022, The Tor Project, Inc. /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import { OnionAliasStore, OnionAliasStoreTopics, } from "resource:///modules/OnionAliasStore.sys.mjs"; } from "moz-src:///browser/components/onionservices/OnionAliasStore.sys.mjs"; const kShowWarningPref = "torbrowser.rulesets.show_warning"; Loading Loading @@ -56,9 +58,10 @@ export class RulesetsParent extends JSWindowActorParent { return { showWarning: Services.prefs.getBoolPref(kShowWarningPref, true), }; case "rulesets:set-channel": case "rulesets:set-channel": { const ch = await OnionAliasStore.setChannel(message.data); return ch; } case "rulesets:update-channel": // We need to catch any error in this way, because in case of an // exception, RPMSendQuery does not return on the other side Loading