This is an automated email from the git hooks/post-receive script.
pierov pushed a change to branch tor-browser-102.3.0esr-12.0-2 in repository tor-browser.
from 7be57d563a83 fixup! Bug 30237: Add v3 onion services client authentication prompt new 63c477f9c5b8 fixup! Add TorStrings module for localization new af6e4a55210f fixup! Firefox preference overrides.
The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: browser/app/profile/001-base-profile.js | 3 + browser/modules/TorStrings.jsm | 116 +++++++++++++++++++++----------- 2 files changed, 81 insertions(+), 38 deletions(-)
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch tor-browser-102.3.0esr-12.0-2 in repository tor-browser.
commit 63c477f9c5b80221fcc06db52136997d57beea99 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Fri Oct 7 17:54:54 2022 +0200
fixup! Add TorStrings module for localization
Bug 17400: Allow to create multi-lingual packages.
Load strings only the first time they're actually required. Also, cleaned TorStrings.jsm a little bit and improved consistency. --- browser/modules/TorStrings.jsm | 116 +++++++++++++++++++++++++++-------------- 1 file changed, 78 insertions(+), 38 deletions(-)
diff --git a/browser/modules/TorStrings.jsm b/browser/modules/TorStrings.jsm index 997af3b30503..43e22e080060 100644 --- a/browser/modules/TorStrings.jsm +++ b/browser/modules/TorStrings.jsm @@ -24,23 +24,25 @@ XPCOMUtils.defineLazyGetter(this, "domParser", () => { */ class TorDTDStringBundle { constructor(aBundleURLs, aPrefix) { - let locations = []; + const locations = []; for (const [index, url] of aBundleURLs.entries()) { locations.push(`<!ENTITY % dtd_${index} SYSTEM "${url}">%dtd_${index};`); } this._locations = locations; this._prefix = aPrefix; + const idx = aBundleURLs.lastIndexOf("/"); + this._filename = idx === -1 ? aBundleURLs : aBundleURLs.substring(idx); }
// copied from testing/marionette/l10n.js localizeEntity(urls, id) { // Use the DOM parser to resolve the entity and extract its real value - let header = `<?xml version="1.0"?><!DOCTYPE elem [${this._locations.join( + const header = `<?xml version="1.0"?><!DOCTYPE elem [${this._locations.join( "" )}]>`; - let elem = `<elem id="elementID">&${id};</elem>`; - let doc = domParser.parseFromString(header + elem, "text/xml"); - let element = doc.querySelector("elem[id='elementID']"); + const elem = `<elem id="elementID">&${id};</elem>`; + const doc = domParser.parseFromString(header + elem, "text/xml"); + const element = doc.querySelector("elem[id='elementID']");
if (element === null) { throw new Error(`Entity with id='${id}' hasn't been found`); @@ -53,7 +55,9 @@ class TorDTDStringBundle { if (key) { try { return this.localizeEntity(this._bundleURLs, `${this._prefix}${key}`); - } catch (e) {} + } catch (e) { + console.warn(`[TorStrings] Cannot get ${key} on ${this._filename}`, e); + } }
// on failure, assign the fallback if it exists @@ -95,20 +99,18 @@ class TorPropertyStringBundle { } }
-var TorStrings = { +const Loader = { /* CryptoSafetyPrompt Strings */ - cryptoSafetyPrompt: (function() { - let tsb = new TorPropertyStringBundle( + cryptoSafetyPrompt() { + const tsb = new TorPropertyStringBundle( "chrome://torbutton/locale/torbutton.properties", "cryptoSafetyPrompt." ); - let getString = function(key, fallback) { - return tsb.getString(key, fallback); - }; + const getString = tsb.getString.bind(tsb);
- let retval = { + const retval = { cryptoWarning: getString( "cryptoWarning", "A cryptocurrency address (%S) has been copied from an insecure website. It could have been modified." @@ -130,21 +132,19 @@ var TorStrings = { };
return retval; - })() /* CryptoSafetyPrompt Strings */, + } /* CryptoSafetyPrompt Strings */,
/* Tor about:preferences#connection Strings */ - settings: (function() { - let tsb = new TorDTDStringBundle( + settings() { + const tsb = new TorDTDStringBundle( ["chrome://torbutton/locale/network-settings.dtd"], "" ); - let getString = function(key, fallback) { - return tsb.getString(key, fallback); - }; + const getString = tsb.getString.bind(tsb);
- let retval = { + const retval = { categoryTitle: getString("torPreferences.categoryTitle", "Connection"), // Message box torPreferencesDescription: getString( @@ -431,9 +431,9 @@ var TorStrings = { };
return retval; - })() /* Tor Network Settings Strings */, + } /* Tor Network Settings Strings */,
- torConnect: (() => { + torConnect() { const tsbNetwork = new TorDTDStringBundle( ["chrome://torbutton/locale/network-settings.dtd"], "" @@ -631,24 +631,22 @@ var TorStrings = { "No settings available for your location" ), }; - })(), + },
/* Tor Onion Services Strings, e.g., for the authentication prompt. */ - onionServices: (function() { - let tsb = new TorPropertyStringBundle( + onionServices() { + const tsb = new TorPropertyStringBundle( "chrome://torbutton/locale/torbutton.properties", "onionServices." ); - let getString = function(key, fallback) { - return tsb.getString(key, fallback); - }; + const getString = tsb.getString.bind(tsb);
const kProblemLoadingSiteFallback = "Problem Loading Onionsite"; const kLongDescFallback = "Details: %S";
- let retval = { + const retval = { learnMore: getString("learnMore", "Learn more"), learnMoreURL: `https://support.torproject.org/$%7BgetLocale()%7D/onionservices/client-auth/..., errorPage: { @@ -815,19 +813,17 @@ var TorStrings = { };
return retval; - })() /* Tor Onion Services Strings */, + } /* Tor Onion Services Strings */,
/* OnionLocation */ - onionLocation: (function() { + onionLocation() { const tsb = new TorPropertyStringBundle( ["chrome://torbutton/locale/torbutton.properties"], "onionLocation." ); - const getString = function(key, fallback) { - return tsb.getString(key, fallback); - }; + const getString = tsb.getString.bind(tsb);
const retval = { alwaysPrioritize: getString( @@ -857,17 +853,17 @@ var TorStrings = { };
return retval; - })() /* OnionLocation */, + } /* OnionLocation */,
/* Rulesets */ - rulesets: (() => { + rulesets() { const tsb = new TorPropertyStringBundle( ["chrome://torbutton/locale/torbutton.properties"], "rulesets." ); - const getString /*(key, fallback)*/ = tsb.getString; + const getString = tsb.getString.bind(tsb);
const retval = { // Initial warning @@ -933,5 +929,49 @@ var TorStrings = { };
return retval; - })() /* Rulesets */, + } /* Rulesets */, +}; + +const TorStrings = { + get cryptoSafetyPrompt() { + if (!this._cryptoSafetyPrompt) { + this._cryptoSafetyPrompt = Loader.cryptoSafetyPrompt(); + } + return this._cryptoSafetyPrompt; + }, + + get settings() { + if (!this._settings) { + this._settings = Loader.settings(); + } + return this._settings; + }, + + get torConnect() { + if (!this._torConnect) { + this._torConnect = Loader.torConnect(); + } + return this._torConnect; + }, + + get onionServices() { + if (!this._onionServices) { + this._onionServices = Loader.onionServices(); + } + return this._onionServices; + }, + + get onionLocation() { + if (!this._onionLocation) { + this._onionLocation = Loader.onionLocation(); + } + return this._onionLocation; + }, + + get rulesets() { + if (!this._rulesets) { + this._rulesets = Loader.rulesets(); + } + return this._rulesets; + }, };
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch tor-browser-102.3.0esr-12.0-2 in repository tor-browser.
commit af6e4a55210fd109087d65ce72c94a2abe7c5a40 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Fri Oct 7 17:59:25 2022 +0200
fixup! Firefox preference overrides.
Bug 17400: Use the OS locale --- browser/app/profile/001-base-profile.js | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/browser/app/profile/001-base-profile.js b/browser/app/profile/001-base-profile.js index 48de619508db..6489ac3c5076 100644 --- a/browser/app/profile/001-base-profile.js +++ b/browser/app/profile/001-base-profile.js @@ -1,6 +1,9 @@ // Preferences to harden Firefox's security and privacy // Do not edit this file.
+// Use the OS locale by default +pref("intl.locale.requested", ""); + // Disable initial homepage notifications pref("browser.search.update", false); pref("browser.rights.3.shown", true);
tbb-commits@lists.torproject.org