lists.torproject.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

tbb-commits

Thread Start a new thread
Threads by month
  • ----- 2026 -----
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
tbb-commits@lists.torproject.org

  • 1 participants
  • 21056 discussions
[Git][tpo/applications/firefox-android][firefox-android-115.2.1-13.0-1] fixup! Disable features and functionality
by Pier Angelo Vendrame (@pierov) 11 Mar '24

11 Mar '24
Pier Angelo Vendrame pushed to branch firefox-android-115.2.1-13.0-1 at The Tor Project / Applications / firefox-android Commits: 56f2b71c by Dan Ballard at 2024-03-11T17:43:00+01:00 fixup! Disable features and functionality bug 42407: lock task affinity of HomeActivity to block potential on app phishing - - - - - 1 changed file: - fenix/app/src/main/AndroidManifest.xml Changes: ===================================== fenix/app/src/main/AndroidManifest.xml ===================================== @@ -96,6 +96,7 @@ android:exported="true" android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize|layoutDirection|smallestScreenSize|screenLayout" android:launchMode="singleTask" + android:taskAffinity="" android:resizeableActivity="true" android:supportsPictureInPicture="true" android:windowSoftInputMode="adjustResize"> View it on GitLab: https://gitlab.torproject.org/tpo/applications/firefox-android/-/commit/56f… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/firefox-android/-/commit/56f… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.8.0esr-13.5-1] 5 commits: fixup! Bug 40933: Add tor-launcher functionality
by Pier Angelo Vendrame (@pierov) 11 Mar '24

11 Mar '24
Pier Angelo Vendrame pushed to branch tor-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: 9cecc61f by Pier Angelo Vendrame at 2024-03-11T09:33:51+01:00 fixup! Bug 40933: Add tor-launcher functionality Bug 42336: Rework the relationship between TorSettings and TorProvider. - - - - - 138e8d6b by Pier Angelo Vendrame at 2024-03-11T16:19:47+01:00 fixup! Bug 40597: Implement TorSettings module Bug 42336: Rework the relationship between TorSettings and TorProvider. - - - - - 6265cc34 by Pier Angelo Vendrame at 2024-03-11T16:19:52+01:00 fixup! Bug 42247: Android helpers for the TorProvider Bug 42336: Rework the relationship between TorSettings and TorProvider. - - - - - e409c32a by Pier Angelo Vendrame at 2024-03-11T16:19:52+01:00 fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection Bug 42336: Rework the relationship between TorSettings and TorProvider. - - - - - f8451ae0 by Pier Angelo Vendrame at 2024-03-11T16:19:53+01:00 fixup! Bug 40597: Implement TorSettings module Use a logger instead of console in TorConnect. - - - - - 10 changed files: - browser/components/torpreferences/content/connectionPane.js - browser/components/torpreferences/content/connectionSettingsDialog.js - toolkit/components/tor-launcher/TorControlPort.sys.mjs - toolkit/components/tor-launcher/TorProvider.sys.mjs - toolkit/components/tor-launcher/TorProviderBuilder.sys.mjs - toolkit/components/tor-launcher/TorStartupService.sys.mjs - toolkit/modules/Moat.sys.mjs - toolkit/modules/TorAndroidIntegration.sys.mjs - toolkit/modules/TorConnect.sys.mjs - toolkit/modules/TorSettings.sys.mjs Changes: ===================================== browser/components/torpreferences/content/connectionPane.js ===================================== @@ -114,10 +114,9 @@ async function setTorSettings(changes) { // This will trigger TorSettings.#cleanupSettings() TorSettings.saveToPrefs(); try { - // May throw. await TorSettings.applySettings(); } catch (e) { - console.error("Failed to save Tor settings", e); + console.error("Failed to apply Tor settings", e); } } finally { TorSettings.thawNotifications(); ===================================== browser/components/torpreferences/content/connectionSettingsDialog.js ===================================== @@ -362,6 +362,8 @@ const gConnectionSettingsDialog = { } TorSettings.saveToPrefs(); + // FIXME: What if this fails? Should we prevent the dialog to close and show + // an error? TorSettings.applySettings(); }, }; ===================================== toolkit/components/tor-launcher/TorControlPort.sys.mjs ===================================== @@ -838,10 +838,12 @@ export class TorController { /** * Send multiple configuration values to tor. * - * @param {object} values The values to set + * @param {Array} values The values to set. It should be an array of + * [key, value] pairs to pass to SETCONF. Keys can be repeated, and array + * values will be automatically unrolled. */ async setConf(values) { - const args = Object.entries(values) + const args = values .flatMap(([key, value]) => { if (value === undefined || value === null) { return [key]; @@ -871,7 +873,7 @@ export class TorController { * @param {boolean} enabled Tell whether the network should be enabled */ async setNetworkEnabled(enabled) { - return this.setConf({ DisableNetwork: !enabled }); + return this.setConf([["DisableNetwork", !enabled]]); } /** ===================================== toolkit/components/tor-launcher/TorProvider.sys.mjs ===================================== @@ -15,6 +15,8 @@ ChromeUtils.defineESModuleGetters(lazy, { TorController: "resource://gre/modules/TorControlPort.sys.mjs", TorProcess: "resource://gre/modules/TorProcess.sys.mjs", TorProcessAndroid: "resource://gre/modules/TorProcessAndroid.sys.mjs", + TorProxyType: "resource://gre/modules/TorSettings.sys.mjs", + TorSettings: "resource://gre/modules/TorSettings.sys.mjs", }); const logger = new ConsoleAPI({ @@ -73,6 +75,20 @@ const Preferences = Object.freeze({ PromptAtStartup: "extensions.torlauncher.prompt_at_startup", }); +/* Config Keys used to configure tor daemon */ +const TorConfigKeys = Object.freeze({ + useBridges: "UseBridges", + bridgeList: "Bridge", + socks4Proxy: "Socks4Proxy", + socks5Proxy: "Socks5Proxy", + socks5ProxyUsername: "Socks5ProxyUsername", + socks5ProxyPassword: "Socks5ProxyPassword", + httpsProxy: "HTTPSProxy", + httpsProxyAuthenticator: "HTTPSProxyAuthenticator", + reachableAddresses: "ReachableAddresses", + clientTransportPlugin: "ClientTransportPlugin", +}); + /** * This is a Tor provider for the C Tor daemon. * @@ -166,15 +182,6 @@ export class TorProvider { */ #currentBridge = null; - /** - * Maintain a map of tor settings set by Tor Browser so that we don't - * repeatedly set the same key/values over and over. - * This map contains string keys to primitives or array values. - * - * @type {Map<string, any>} - */ - #settingsCache = new Map(); - /** * Starts a new tor process and connect to its control port, or connect to the * control port of an existing tor daemon. @@ -219,13 +226,22 @@ export class TorProvider { throw e; } + try { + await lazy.TorSettings.initializedPromise; + await this.writeSettings(lazy.TorSettings.getSettings()); + } catch (e) { + logger.warn( + "Failed to initialize TorSettings or to write our settings, so uninitializing.", + e + ); + this.uninit(); + throw e; + } + TorLauncherUtil.setProxyConfiguration(this.#socksSettings); logger.info("The Tor provider is ready."); - logger.debug(`Notifying ${TorProviderTopics.ProcessIsReady}`); - Services.obs.notifyObservers(null, TorProviderTopics.ProcessIsReady); - // If we are using an external Tor daemon, we might need to fetch circuits // already, in case streams use them. Do not await because we do not want to // block the intialization on this (it should not fail anyway...). @@ -252,42 +268,74 @@ export class TorProvider { // Provider API - async writeSettings(settingsObj) { - // TODO: Move the translation from settings object to settings understood by - // tor here. - const entries = - settingsObj instanceof Map - ? Array.from(settingsObj.entries()) - : Object.entries(settingsObj); - // only write settings that have changed - const newSettings = entries.filter(([setting, value]) => { - if (!this.#settingsCache.has(setting)) { - // no cached setting, so write - return true; - } + /** + * Send settings to the tor daemon. + * + * @param {object} settings A settings object, as returned by + * TorSettings.getSettings(). This allow to try settings without passing + * through TorSettings. + */ + async writeSettings(settings) { + logger.debug("TorProvider.writeSettings", settings); + const torSettings = new Map(); + + // Bridges + const haveBridges = + settings.bridges?.enabled && !!settings.bridges.bridge_strings.length; + torSettings.set(TorConfigKeys.useBridges, haveBridges); + if (haveBridges) { + torSettings.set( + TorConfigKeys.bridgeList, + settings.bridges.bridge_strings + ); + } else { + torSettings.set(TorConfigKeys.bridgeList, null); + } - const cachedValue = this.#settingsCache.get(setting); - // Arrays are the only special case for which === could fail. - // The other values we accept (strings, booleans, numbers, null and - // undefined) work correctly with ===. - if (Array.isArray(value) && Array.isArray(cachedValue)) { - return ( - value.length !== cachedValue.length || - value.some((val, idx) => val !== cachedValue[idx]) + // Proxy + torSettings.set(TorConfigKeys.socks4Proxy, null); + torSettings.set(TorConfigKeys.socks5Proxy, null); + torSettings.set(TorConfigKeys.socks5ProxyUsername, null); + torSettings.set(TorConfigKeys.socks5ProxyPassword, null); + torSettings.set(TorConfigKeys.httpsProxy, null); + torSettings.set(TorConfigKeys.httpsProxyAuthenticator, null); + if (settings.proxy && !settings.proxy.enabled) { + settings.proxy.type = null; + } + const address = settings.proxy?.address; + const port = settings.proxy?.port; + const username = settings.proxy?.username; + const password = settings.proxy?.password; + switch (settings.proxy?.type) { + case lazy.TorProxyType.Socks4: + torSettings.set(TorConfigKeys.socks4Proxy, `${address}:${port}`); + break; + case lazy.TorProxyType.Socks5: + torSettings.set(TorConfigKeys.socks5Proxy, `${address}:${port}`); + torSettings.set(TorConfigKeys.socks5ProxyUsername, username); + torSettings.set(TorConfigKeys.socks5ProxyPassword, password); + break; + case lazy.TorProxyType.HTTPS: + torSettings.set(TorConfigKeys.httpsProxy, `${address}:${port}`); + torSettings.set( + TorConfigKeys.httpsProxyAuthenticator, + `${username}:${password}` ); - } - return value !== cachedValue; - }); - - // only write if new setting to save - if (newSettings.length) { - await this.#controller.setConf(Object.fromEntries(newSettings)); + break; + } - // save settings to cache after successfully writing to Tor - for (const [setting, value] of newSettings) { - this.#settingsCache.set(setting, value); - } + // Firewall + if (settings.firewall?.enabled) { + const reachableAddresses = settings.firewall.allowed_ports + .map(port => `*:${port}`) + .join(","); + torSettings.set(TorConfigKeys.reachableAddresses, reachableAddresses); + } else { + torSettings.set(TorConfigKeys.reachableAddresses, null); } + + logger.debug("Mapped settings object", settings, torSettings); + await this.#controller.setConf(Array.from(torSettings)); } async flushSettings() { ===================================== toolkit/components/tor-launcher/TorProviderBuilder.sys.mjs ===================================== @@ -9,7 +9,6 @@ ChromeUtils.defineESModuleGetters(lazy, { }); export const TorProviderTopics = Object.freeze({ - ProcessIsReady: "TorProcessIsReady", ProcessExited: "TorProcessExited", BootstrapStatus: "TorBootstrapStatus", BootstrapError: "TorBootstrapError", ===================================== toolkit/components/tor-launcher/TorStartupService.sys.mjs ===================================== @@ -31,15 +31,16 @@ export class TorStartupService { } } - async #init() { + #init() { Services.obs.addObserver(this, BrowserTopics.QuitApplicationGranted); - // Do not await on this init. build() is expected to await the - // initialization, so anything that should need the Tor Provider should - // block there, instead. + lazy.TorSettings.init(); + + // Theoretically, build() is expected to await the initialization of the + // provider, and anything needing the Tor Provider should be able to just + // await on TorProviderBuilder.build(). lazy.TorProviderBuilder.init(); - await lazy.TorSettings.init(); lazy.TorConnect.init(); lazy.TorDomainIsolator.init(); ===================================== toolkit/modules/Moat.sys.mjs ===================================== @@ -2,13 +2,13 @@ * 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 { TorBridgeSource } from "resource://gre/modules/TorSettings.sys.mjs"; - const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { DomainFrontRequestBuilder: "resource://gre/modules/DomainFrontedRequests.sys.mjs", + TorBridgeSource: "resource://gre/modules/TorSettings.sys.mjs", + TorSettings: "resource://gre/modules/TorSettings.sys.mjs", }); const TorLauncherPrefs = Object.freeze({ @@ -211,13 +211,23 @@ export class MoatRPC { }; switch (settings.bridges.source) { case "builtin": - retval.bridges.source = TorBridgeSource.BuiltIn; + retval.bridges.source = lazy.TorBridgeSource.BuiltIn; retval.bridges.builtin_type = settings.bridges.type; // TorSettings will ignore strings for built-in bridges, and use the - // ones it already knows, instead. + // ones it already knows, instead. However, when we try these settings + // in the connect assist, we skip TorSettings. Therefore, we set the + // lines also here (the ones we already known, not the ones we receive + // from Moat). This needs TorSettings to be initialized, which by now + // should have already happened (this method is used only by TorConnect, + // that needs TorSettings to be initialized). + // In any case, getBuiltinBridges will throw if the data is not ready, + // yet. + retval.bridges.bridge_strings = lazy.TorSettings.getBuiltinBridges( + settings.bridges.type + ); break; case "bridgedb": - retval.bridges.source = TorBridgeSource.BridgeDB; + retval.bridges.source = lazy.TorBridgeSource.BridgeDB; if (settings.bridges.bridge_strings) { retval.bridges.bridge_strings = settings.bridges.bridge_strings; } else { ===================================== toolkit/modules/TorAndroidIntegration.sys.mjs ===================================== @@ -150,7 +150,7 @@ class TorAndroidIntegrationImpl { lazy.TorSettings.saveToPrefs(); } if (data.apply) { - lazy.TorSettings.applySettings(); + await lazy.TorSettings.applySettings(); } break; case ListenedEvents.settingsApply: ===================================== toolkit/modules/TorConnect.sys.mjs ===================================== @@ -2,14 +2,17 @@ * 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 { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; import { setTimeout, clearTimeout } from "resource://gre/modules/Timer.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { + ConsoleAPI: "resource://gre/modules/Console.sys.mjs", EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", MoatRPC: "resource://gre/modules/Moat.sys.mjs", TorBootstrapRequest: "resource://gre/modules/TorBootstrapRequest.sys.mjs", + TorProviderBuilder: "resource://gre/modules/TorProviderBuilder.sys.mjs", }); // TODO: Should we move this to the about:torconnect actor? @@ -20,10 +23,7 @@ ChromeUtils.defineModuleGetter( ); import { TorLauncherUtil } from "resource://gre/modules/TorLauncherUtil.sys.mjs"; -import { - TorSettings, - TorSettingsTopics, -} from "resource://gre/modules/TorSettings.sys.mjs"; +import { TorSettings } from "resource://gre/modules/TorSettings.sys.mjs"; import { TorStrings } from "resource://gre/modules/TorStrings.sys.mjs"; @@ -40,6 +40,7 @@ const TorLauncherPrefs = Object.freeze({ const TorConnectPrefs = Object.freeze({ censorship_level: "torbrowser.debug.censorship_level", allow_internet_test: "torbrowser.bootstrap.allow_internet_test", + log_level: "torbrowser.bootstrap.log_level", }); export const TorConnectState = Object.freeze({ @@ -59,6 +60,17 @@ export const TorConnectState = Object.freeze({ Disabled: "Disabled", }); +XPCOMUtils.defineLazyGetter( + lazy, + "logger", + () => + new lazy.ConsoleAPI({ + maxLogLevel: "info", + maxLogLevelPref: TorConnectPrefs.log_level, + prefix: "TorConnect", + }) +); + /* TorConnect State Transitions @@ -194,12 +206,12 @@ class StateCallback { } async begin(...args) { - console.log(`TorConnect: Entering ${this._state} state`); + lazy.logger.trace(`Entering ${this._state} state`); this._init(); try { // this Promise will block until this StateCallback has completed its work await Promise.resolve(this._callback.call(this._context, ...args)); - console.log(`TorConnect: Exited ${this._state} state`); + lazy.logger.info(`Exited ${this._state} state`); // handled state transition Services.obs.notifyObservers( @@ -267,16 +279,14 @@ class InternetTest { this.cancel(); this._pending = true; - console.log("TorConnect: starting the Internet test"); + lazy.logger.info("Starting the Internet test"); this._testAsync() .then(status => { this._pending = false; this._status = status.successful ? InternetStatus.Online : InternetStatus.Offline; - console.log( - `TorConnect: performed Internet test, outcome ${this._status}` - ); + lazy.logger.info(`Performed Internet test, outcome ${this._status}`); this.onResult(this.status, status.date); }) .catch(error => { @@ -305,7 +315,7 @@ class InternetTest { await mrpc.init(); status = await mrpc.testInternetConnection(); } catch (err) { - console.error("Error while checking the Internet connection", err); + lazy.logger.error("Error while checking the Internet connection", err); error = err; } finally { mrpc.uninit(); @@ -523,8 +533,8 @@ export const TorConnect = (() => { // get "Building circuits: Establishing a Tor circuit failed". // TODO: Maybe move this logic deeper in the process to know // when to filter out such errors triggered by cancelling. - console.log( - `TorConnect: Post-cancel error => ${message}; ${details}` + lazy.logger.warn( + `Post-cancel error => ${message}; ${details}` ); return; } @@ -628,7 +638,7 @@ export const TorConnect = (() => { "vanilla", ]); } catch (err) { - console.error( + lazy.logger.error( "We did not get localized settings, and default settings failed as well", err ); @@ -651,10 +661,19 @@ export const TorConnect = (() => { } } + const restoreOriginalSettings = async () => { + try { + await TorSettings.applySettings(); + } catch (e) { + // We cannot do much if the original settings were bad or + // if the connection closed, so just report it in the + // console. + lazy.logger.warn("Failed to restore original settings.", e); + } + }; + // apply each of our settings and try to bootstrap with each try { - this.originalSettings = TorSettings.getSettings(); - for (const [ index, currentSetting, @@ -664,14 +683,32 @@ export const TorConnect = (() => { break; } - console.log( - `TorConnect: Attempting Bootstrap with configuration ${ - index + 1 - }/${this.settings.length}` + lazy.logger.info( + `Attempting Bootstrap with configuration ${index + 1}/${ + this.settings.length + }` ); - TorSettings.setSettings(currentSetting); - await TorSettings.applySettings(); + // Send the new settings directly to the provider. We will + // save them only if the bootstrap succeeds. + // FIXME: We should somehow signal TorSettings users that we + // have set custom settings, and they should not apply + // theirs until we are done with trying ours. + // Otherwise, the new settings provided by the user while we + // were bootstrapping could be the ones that cause the + // bootstrap to succeed, but we overwrite them (unless we + // backup the original settings, and then save our new + // settings only if they have not changed). + // Another idea (maybe easier to implement) is to disable + // the settings UI while *any* bootstrap is going on. + // This is also documented in tor-browser#41921. + const provider = await lazy.TorProviderBuilder.build(); + // We need to merge with old settings, in case the user is + // using a proxy or is behind a firewall. + await provider.writeSettings({ + ...TorSettings.getSettings(), + ...currentSetting, + }); // build out our bootstrap request const tbr = new lazy.TorBootstrapRequest(); @@ -679,8 +716,8 @@ export const TorConnect = (() => { TorConnect._updateBootstrapStatus(progress, status); }; tbr.onbootstraperror = (message, details) => { - console.log( - `TorConnect: Auto-Bootstrap error => ${message}; ${details}` + lazy.logger.error( + `Auto-Bootstrap error => ${message}; ${details}` ); }; @@ -688,6 +725,7 @@ export const TorConnect = (() => { this.on_transition = async nextState => { if (nextState === TorConnectState.Configuring) { await tbr.cancel(); + await restoreOriginalSettings(); } resolve(); }; @@ -695,23 +733,20 @@ export const TorConnect = (() => { // begin bootstrap if (await tbr.bootstrap()) { // persist the current settings to preferences + TorSettings.setSettings(currentSetting); TorSettings.saveToPrefs(); + await TorSettings.applySettings(); TorConnect._changeState(TorConnectState.Bootstrapped); return; } } - // bootstrapped failed for all potential settings, so reset daemon to use original - TorSettings.setSettings(this.originalSettings); - // The original settings should be good, so we save them to - // preferences before trying to apply them, as it might fail - // if the actual problem is with the connection to the control - // port. - // FIXME: We should handle this case in a better way. - TorSettings.saveToPrefs(); - await TorSettings.applySettings(); - - // only explicitly change state here if something else has not transitioned us + // Bootstrap failed for all potential settings, so restore the + // original settings the provider. + await restoreOriginalSettings(); + + // Only explicitly change state here if something else has not + // transitioned us. if (!this.transitioning) { throw_error( TorStrings.torConnect.autoBootstrappingFailed, @@ -720,18 +755,8 @@ export const TorConnect = (() => { } return; } catch (err) { - // restore original settings in case of error - try { - TorSettings.setSettings(this.originalSettings); - // As above - TorSettings.saveToPrefs(); - await TorSettings.applySettings(); - } catch (errRestore) { - console.log( - `TorConnect: Failed to restore original settings => ${errRestore}` - ); - } - // throw to outer catch to transition us + await restoreOriginalSettings(); + // throw to outer catch to transition us. throw err; } } catch (err) { @@ -748,8 +773,8 @@ export const TorConnect = (() => { true ); } else { - console.error( - "TorConnect: Received AutoBootstrapping error after transitioning", + lazy.logger.error( + "Received AutoBootstrapping error after transitioning", err ); } @@ -793,8 +818,8 @@ export const TorConnect = (() => { TorConnect._errorMessage = errorMessage; TorConnect._errorDetails = errorDetails; - console.error( - `[TorConnect] Entering error state (${errorMessage}, ${errorDetails})` + lazy.logger.error( + `Entering error state (${errorMessage}, ${errorDetails})` ); Services.obs.notifyObservers( @@ -835,9 +860,7 @@ export const TorConnect = (() => { ); } - console.log( - `TorConnect: Try transitioning from ${prevState} to ${newState}` - ); + lazy.logger.trace(`Try transitioning from ${prevState} to ${newState}`); // set our new state first so that state transitions can themselves trigger // a state transition @@ -851,8 +874,8 @@ export const TorConnect = (() => { this._bootstrapProgress = progress; this._bootstrapStatus = status; - console.log( - `TorConnect: Bootstrapping ${this._bootstrapProgress}% complete (${this._bootstrapStatus})` + lazy.logger.info( + `Bootstrapping ${this._bootstrapProgress}% complete (${this._bootstrapStatus})` ); Services.obs.notifyObservers( { @@ -866,7 +889,7 @@ export const TorConnect = (() => { // init should be called by TorStartupService init() { - console.log("TorConnect: init()"); + lazy.logger.debug("TorConnect.init()"); this._callback(TorConnectState.Initial).begin(); if (!this.enabled) { @@ -875,9 +898,17 @@ export const TorConnect = (() => { } else { let observeTopic = addTopic => { Services.obs.addObserver(this, addTopic); - console.log(`TorConnect: Observing topic '${addTopic}'`); + lazy.logger.debug(`Observing topic '${addTopic}'`); }; + // Wait for TorSettings, as we will need it. + // We will wait for a TorProvider only after TorSettings is ready, + // because the TorProviderBuilder initialization might not have finished + // at this point, and TorSettings initialization is a prerequisite for + // having a provider. + // So, we prefer initializing TorConnect as soon as possible, so that + // the UI will be able to detect it is in the Initializing state and act + // consequently. TorSettings.initializedPromise.then(() => this._settingsInitialized()); // register the Tor topics we always care about @@ -887,7 +918,7 @@ export const TorConnect = (() => { }, async observe(subject, topic, data) { - console.log(`TorConnect: Observed ${topic}`); + lazy.logger.debug(`Observed ${topic}`); switch (topic) { case TorTopics.LogHasWarnOrErr: { @@ -919,19 +950,25 @@ export const TorConnect = (() => { } }, - _settingsInitialized() { + async _settingsInitialized() { + // TODO: Handle failures here, instead of the prompt to restart the + // daemon when it exits (tor-browser#21053, tor-browser#41921). + await lazy.TorProviderBuilder.build(); + // tor-browser#41907: This is only a workaround to avoid users being // bounced back to the initial panel without any explanation. // Longer term we should disable the clickable elements, or find a UX // to prevent this from happening (e.g., allow buttons to be clicked, // but show an intermediate starting state, or a message that tor is // starting while the butons are disabled, etc...). + // See also tor-browser#41921. if (this.state !== TorConnectState.Initial) { - console.warn( - "TorConnect: Seen the torsettings:ready after the state has already changed, ignoring the notification." + lazy.logger.warn( + "The TorProvider was built after the state had already changed." ); return; } + lazy.logger.debug("The TorProvider is ready, changing state."); if (this.shouldQuickStart) { // Quickstart this._changeState(TorConnectState.Bootstrapping); @@ -1074,17 +1111,17 @@ export const TorConnect = (() => { */ beginBootstrap() { - console.log("TorConnect: beginBootstrap()"); + lazy.logger.debug("TorConnect.beginBootstrap()"); this._changeState(TorConnectState.Bootstrapping); }, cancelBootstrap() { - console.log("TorConnect: cancelBootstrap()"); + lazy.logger.debug("TorConnect.cancelBootstrap()"); this._changeState(TorConnectState.Configuring); }, beginAutoBootstrap(countryCode) { - console.log("TorConnect: beginAutoBootstrap()"); + lazy.logger.debug("TorConnect.beginAutoBootstrap()"); this._changeState(TorConnectState.AutoBootstrapping, countryCode); }, @@ -1154,7 +1191,10 @@ export const TorConnect = (() => { await mrpc.init(); this._countryCodes = await mrpc.circumvention_countries(); } catch (err) { - console.log("An error occurred while fetching country codes", err); + lazy.logger.error( + "An error occurred while fetching country codes", + err + ); } finally { mrpc.uninit(); } @@ -1187,8 +1227,8 @@ export const TorConnect = (() => { uriArray = uriVariant; } else { // about:tor as safe fallback - console.error( - `TorConnect: received unknown variant '${JSON.stringify(uriVariant)}'` + lazy.logger.error( + `Received unknown variant '${JSON.stringify(uriVariant)}'` ); uriArray = ["about:tor"]; } @@ -1209,9 +1249,7 @@ export const TorConnect = (() => { // which redirect after bootstrapping getURIsToLoad(uriVariant) { const uris = this.fixupURIs(uriVariant); - console.log( - `TorConnect: Will load after bootstrap => [${uris.join(", ")}]` - ); + lazy.logger.debug(`Will load after bootstrap => [${uris.join(", ")}]`); return uris.map(uri => this.getRedirectURL(uri)); }, }; ===================================== toolkit/modules/TorSettings.sys.mjs ===================================== @@ -6,10 +6,9 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { TorLauncherUtil: "resource://gre/modules/TorLauncherUtil.sys.mjs", - TorProviderBuilder: "resource://gre/modules/TorProviderBuilder.sys.mjs", - TorProviderTopics: "resource://gre/modules/TorProviderBuilder.sys.mjs", Lox: "resource://gre/modules/Lox.sys.mjs", TorParsers: "resource://gre/modules/TorParsers.sys.mjs", + TorProviderBuilder: "resource://gre/modules/TorProviderBuilder.sys.mjs", }); ChromeUtils.defineLazyGetter(lazy, "logger", () => { @@ -71,20 +70,6 @@ const TorSettingsPrefs = Object.freeze({ }, }); -/* Config Keys used to configure tor daemon */ -const TorConfigKeys = Object.freeze({ - useBridges: "UseBridges", - bridgeList: "Bridge", - socks4Proxy: "Socks4Proxy", - socks5Proxy: "Socks5Proxy", - socks5ProxyUsername: "Socks5ProxyUsername", - socks5ProxyPassword: "Socks5ProxyPassword", - httpsProxy: "HTTPSProxy", - httpsProxyAuthenticator: "HTTPSProxyAuthenticator", - reachableAddresses: "ReachableAddresses", - clientTransportPlugin: "ClientTransportPlugin", -}); - export const TorBridgeSource = Object.freeze({ Invalid: -1, BuiltIn: 0, @@ -322,7 +307,7 @@ class TorSettingsImpl { if (!val) { return; } - const bridgeStrings = this.#getBuiltinBridges(val); + const bridgeStrings = this.getBuiltinBridges(val); if (bridgeStrings.length) { this.bridges.bridge_strings = bridgeStrings; return; @@ -659,14 +644,17 @@ class TorSettingsImpl { * @param {string} pt The pluggable transport to return the lines for * @returns {string[]} The bridge lines in random order */ - #getBuiltinBridges(pt) { + getBuiltinBridges(pt) { + if (!this.#allowUninitialized) { + this.#checkIfInitialized(); + } // Shuffle so that Tor Browser users do not all try the built-in bridges in // the same order. return arrayShuffle(this.#builtinBridges[pt] ?? []); } /** - * Load or init our settings, and register observers. + * Load or init our settings. */ async init() { if (this.#initialized) { @@ -677,6 +665,7 @@ class TorSettingsImpl { await this.#initInternal(); this.#initialized = true; this.#initComplete(); + Services.obs.notifyObservers(null, TorSettingsTopics.Ready); } catch (e) { this.#initFailed(e); throw e; @@ -698,45 +687,35 @@ class TorSettingsImpl { lazy.logger.error("Could not load the built-in PT config.", e); } - // Initialize this before loading from prefs because we need Lox initialized before - // any calls to Lox.getBridges() + // Initialize this before loading from prefs because we need Lox initialized + // before any calls to Lox.getBridges(). try { await lazy.Lox.init(); } catch (e) { lazy.logger.error("Could not initialize Lox.", e.type); } - // TODO: We could use a shared promise, and wait for it to be fullfilled - // instead of Service.obs. - if (lazy.TorLauncherUtil.shouldStartAndOwnTor) { - // if the settings branch exists, load settings from prefs - if (Services.prefs.getBoolPref(TorSettingsPrefs.enabled, false)) { - // Do not want notifications for initially loaded prefs. - this.freezeNotifications(); - try { - this.#allowUninitialized = true; - this.#loadFromPrefs(); - } finally { - this.#allowUninitialized = false; - this.#notificationQueue.clear(); - this.thawNotifications(); - } - } + if ( + lazy.TorLauncherUtil.shouldStartAndOwnTor && + Services.prefs.getBoolPref(TorSettingsPrefs.enabled, false) + ) { + // Do not want notifications for initially loaded prefs. + this.freezeNotifications(); try { - const provider = await lazy.TorProviderBuilder.build(); - if (provider.isRunning) { - this.#handleProcessReady(); - // No need to add an observer to call this again. - return; - } - } catch {} - - Services.obs.addObserver(this, lazy.TorProviderTopics.ProcessIsReady); + this.#allowUninitialized = true; + this.#loadFromPrefs(); + } finally { + this.#allowUninitialized = false; + this.#notificationQueue.clear(); + this.thawNotifications(); + } } + + lazy.logger.info("Ready"); } /** - * Unload or uninit our settings, and unregister observers. + * Unload or uninit our settings. */ async uninit() { await lazy.Lox.uninit(); @@ -764,34 +743,6 @@ class TorSettingsImpl { return this.#initialized; } - /** - * Wait for relevant life-cycle events to apply saved settings. - */ - async observe(subject, topic, data) { - lazy.logger.debug(`Observed ${topic}`); - - switch (topic) { - case lazy.TorProviderTopics.ProcessIsReady: - Services.obs.removeObserver( - this, - lazy.TorProviderTopics.ProcessIsReady - ); - await this.#handleProcessReady(); - break; - } - } - - /** - * Apply the settings once the tor provider is ready and notify any observer - * that the settings can be used. - */ - async #handleProcessReady() { - // push down settings to tor - await this.#applySettings(true); - lazy.logger.info("Ready"); - Services.obs.notifyObservers(null, TorSettingsTopics.Ready); - } - /** * Load our settings from prefs. */ @@ -972,85 +923,14 @@ class TorSettingsImpl { /** * Push our settings down to the tor provider. + * + * Even though this introduces a circular depdency, it makes the API nicer for + * frontend consumers. */ async applySettings() { this.#checkIfInitialized(); - return this.#applySettings(false); - } - - /** - * Internal implementation of applySettings that does not check if we are - * initialized. - */ - async #applySettings(allowUninitialized) { - lazy.logger.debug("#applySettings()"); - - this.#cleanupSettings(); - - const settingsMap = new Map(); - - // #applySettings can be called only when #allowUninitialized is false - this.#allowUninitialized = allowUninitialized; - - try { - /* Bridges */ - const haveBridges = - this.bridges.enabled && !!this.bridges.bridge_strings.length; - settingsMap.set(TorConfigKeys.useBridges, haveBridges); - if (haveBridges) { - settingsMap.set(TorConfigKeys.bridgeList, this.bridges.bridge_strings); - } else { - settingsMap.set(TorConfigKeys.bridgeList, null); - } - - /* Proxy */ - settingsMap.set(TorConfigKeys.socks4Proxy, null); - settingsMap.set(TorConfigKeys.socks5Proxy, null); - settingsMap.set(TorConfigKeys.socks5ProxyUsername, null); - settingsMap.set(TorConfigKeys.socks5ProxyPassword, null); - settingsMap.set(TorConfigKeys.httpsProxy, null); - settingsMap.set(TorConfigKeys.httpsProxyAuthenticator, null); - if (this.proxy.enabled) { - const address = this.proxy.address; - const port = this.proxy.port; - const username = this.proxy.username; - const password = this.proxy.password; - - switch (this.proxy.type) { - case TorProxyType.Socks4: - settingsMap.set(TorConfigKeys.socks4Proxy, `${address}:${port}`); - break; - case TorProxyType.Socks5: - settingsMap.set(TorConfigKeys.socks5Proxy, `${address}:${port}`); - settingsMap.set(TorConfigKeys.socks5ProxyUsername, username); - settingsMap.set(TorConfigKeys.socks5ProxyPassword, password); - break; - case TorProxyType.HTTPS: - settingsMap.set(TorConfigKeys.httpsProxy, `${address}:${port}`); - settingsMap.set( - TorConfigKeys.httpsProxyAuthenticator, - `${username}:${password}` - ); - break; - } - } - - /* Firewall */ - if (this.firewall.enabled) { - const reachableAddresses = this.firewall.allowed_ports - .map(port => `*:${port}`) - .join(","); - settingsMap.set(TorConfigKeys.reachableAddresses, reachableAddresses); - } else { - settingsMap.set(TorConfigKeys.reachableAddresses, null); - } - } finally { - this.#allowUninitialized = false; - } - - /* Push to Tor */ const provider = await lazy.TorProviderBuilder.build(); - await provider.writeSettings(settingsMap); + await provider.writeSettings(this.getSettings()); } /** View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/f6c7b7… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/f6c7b7… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/mullvad-browser][mullvad-browser-115.8.0esr-13.0-1] 2 commits: fixup! Firefox preference overrides.
by Pier Angelo Vendrame (@pierov) 11 Mar '24

11 Mar '24
Pier Angelo Vendrame pushed to branch mullvad-browser-115.8.0esr-13.0-1 at The Tor Project / Applications / Mullvad Browser Commits: eaa8c377 by Pier Angelo Vendrame at 2024-03-11T15:53:55+01:00 fixup! Firefox preference overrides. Bug 42377: Hidden fonts should obey the allow list. Remove .Helvetica Neue DeskInterface from the allow list. This font might not be actually available, and in any case fonts starting with period will not be displayed by the browser. - - - - - 63219c0c by Pier Angelo Vendrame at 2024-03-11T15:53:56+01:00 Bug 42377: Hidden fonts should obey the allow list. Hidden font families were automatically added to the `font.system.whitelist`, which is a behavior that conflicts with our font picking. - - - - - 2 changed files: - browser/app/profile/001-base-profile.js - gfx/thebes/gfxPlatformFontList.cpp Changes: ===================================== browser/app/profile/001-base-profile.js ===================================== @@ -641,7 +641,7 @@ pref("toolkit.winRegisterApplicationRestart", false); pref("gfx.bundled-fonts.activate", 1); #ifdef XP_MACOSX -pref("font.system.whitelist", "AppleGothic, Apple Color Emoji, Arial, Courier, Courier New, Geneva, Georgia, Heiti TC, Helvetica, Helvetica Neue, .Helvetica Neue DeskInterface, Hiragino Kaku Gothic ProN, Kailasa, Lucida Grande, Menlo, Monaco, PingFang HK, PingFang SC, PingFang TC, Songti SC, Songti TC, Tahoma, Thonburi, Times, Times New Roman, Verdana, STIX Two Math, Noto Sans Adlam, Noto Sans Armenian, Noto Sans Balinese, Noto Sans Bamum, Noto Sans Bassa Vah, Noto Sans Batak, Noto Sans Bengali, Noto Sans Buginese, Noto Sans Buhid, Noto Sans Canadian Aboriginal, Noto Sans Chakma, Noto Sans Cham, Noto Sans Cherokee, Noto Sans Coptic, Noto Sans Deseret, Noto Sans Devanagari, Noto Sans Elbasan, Noto Sans Ethiopic, Noto Sans Georgian, Noto Sans Grantha, Noto Sans Gujarati, Noto Sans Gunjala Gondi, Noto Sans Gurmukhi, Noto Sans Hanifi Rohingya, Noto Sans Hanunoo, Noto Sans Hebrew, Noto Sans Kannada, Noto Sans Khmer, Noto Sans Javanese, Noto Sans Kayah Li, Noto Sans Khojki, Noto Sans Khudawadi, Noto Sans Lao, Noto Sans Lepcha, Noto Sans Limbu, Noto Sans Lisu, Noto Sans Mahajani, Noto Sans Malayalam, Noto Sans Mandaic, Noto Sans Masaram Gondi, Noto Sans Medefaidrin, Noto Sans Meetei Mayek, Noto Sans Mende Kikakui, Noto Sans Miao, Noto Sans Modi, Noto Sans Mongolian, Noto Sans Mro, Noto Sans Myanmar, Noto Sans Multani, Noto Sans Newa, Noto Sans New Tai Lue, Noto Sans NKo, Noto Sans Ol Chiki, Noto Sans Oriya, Noto Sans Osage, Noto Sans Osmanya, Noto Sans Pahawh Hmong, Noto Sans Pau Cin Hau, Noto Sans Rejang, Noto Sans Runic, Noto Sans Samaritan, Noto Sans Saurashtra, Noto Sans Sharada, Noto Sans Shavian, Noto Sans Sinhala, Noto Sans Sora Sompeng, Noto Sans Soyombo, Noto Sans Sundanese, Noto Sans Syloti Nagri, Noto Sans Symbols 2, Noto Sans Symbols, Noto Sans Syriac, Noto Sans Tagalog, Noto Sans Tagbanwa, Noto Sans Tai Le, Noto Sans Tai Tham, Noto Sans Tai Viet, Noto Sans Takri, Noto Sans Tamil, Noto Sans Telugu, Noto Sans Thaana, Noto Sans Tifinagh Adrar, Noto Sans Tifinagh Agraw Imazighen, Noto Sans Tifinagh Ahaggar, Noto Sans Tifinagh Air, Noto Sans Tifinagh APT, Noto Sans Tifinagh Azawagh, Noto Sans Tifinagh Ghat, Noto Sans Tifinagh Hawad, Noto Sans Tifinagh, Noto Sans Tifinagh Rhissa Ixa, Noto Sans Tifinagh SIL, Noto Sans Tifinagh Tawellemmet, Noto Sans Tirhuta, Noto Sans Vai, Noto Sans Wancho, Noto Sans Warang Citi, Noto Sans Yi, Noto Sans Zanabazar Square, Noto Serif Armenian, Noto Serif Balinese, Noto Serif Bengali, Noto Serif Devanagari, Noto Serif Dogra, Noto Serif Ethiopic, Noto Serif Georgian, Noto Serif Grantha, Noto Serif Gujarati, Noto Serif Gurmukhi, Noto Serif Hebrew, Noto Serif Kannada, Noto Serif Khmer, Noto Serif Khojki, Noto Serif Lao, Noto Serif Malayalam, Noto Serif Myanmar, Noto Serif NP Hmong, Noto Serif Sinhala, Noto Serif Tamil, Noto Serif Telugu, Noto Serif Tibetan, Noto Serif Yezidi"); +pref("font.system.whitelist", "AppleGothic, Apple Color Emoji, Arial, Courier, Courier New, Geneva, Georgia, Heiti TC, Helvetica, Helvetica Neue, Hiragino Kaku Gothic ProN, Kailasa, Lucida Grande, Menlo, Monaco, PingFang HK, PingFang SC, PingFang TC, Songti SC, Songti TC, Tahoma, Thonburi, Times, Times New Roman, Verdana, STIX Two Math, Noto Sans Adlam, Noto Sans Armenian, Noto Sans Balinese, Noto Sans Bamum, Noto Sans Bassa Vah, Noto Sans Batak, Noto Sans Bengali, Noto Sans Buginese, Noto Sans Buhid, Noto Sans Canadian Aboriginal, Noto Sans Chakma, Noto Sans Cham, Noto Sans Cherokee, Noto Sans Coptic, Noto Sans Deseret, Noto Sans Devanagari, Noto Sans Elbasan, Noto Sans Ethiopic, Noto Sans Georgian, Noto Sans Grantha, Noto Sans Gujarati, Noto Sans Gunjala Gondi, Noto Sans Gurmukhi, Noto Sans Hanifi Rohingya, Noto Sans Hanunoo, Noto Sans Hebrew, Noto Sans Kannada, Noto Sans Khmer, Noto Sans Javanese, Noto Sans Kayah Li, Noto Sans Khojki, Noto Sans Khudawadi, Noto Sans Lao, Noto Sans Lepcha, Noto Sans Limbu, Noto Sans Lisu, Noto Sans Mahajani, Noto Sans Malayalam, Noto Sans Mandaic, Noto Sans Masaram Gondi, Noto Sans Medefaidrin, Noto Sans Meetei Mayek, Noto Sans Mende Kikakui, Noto Sans Miao, Noto Sans Modi, Noto Sans Mongolian, Noto Sans Mro, Noto Sans Myanmar, Noto Sans Multani, Noto Sans Newa, Noto Sans New Tai Lue, Noto Sans NKo, Noto Sans Ol Chiki, Noto Sans Oriya, Noto Sans Osage, Noto Sans Osmanya, Noto Sans Pahawh Hmong, Noto Sans Pau Cin Hau, Noto Sans Rejang, Noto Sans Runic, Noto Sans Samaritan, Noto Sans Saurashtra, Noto Sans Sharada, Noto Sans Shavian, Noto Sans Sinhala, Noto Sans Sora Sompeng, Noto Sans Soyombo, Noto Sans Sundanese, Noto Sans Syloti Nagri, Noto Sans Symbols 2, Noto Sans Symbols, Noto Sans Syriac, Noto Sans Tagalog, Noto Sans Tagbanwa, Noto Sans Tai Le, Noto Sans Tai Tham, Noto Sans Tai Viet, Noto Sans Takri, Noto Sans Tamil, Noto Sans Telugu, Noto Sans Thaana, Noto Sans Tifinagh Adrar, Noto Sans Tifinagh Agraw Imazighen, Noto Sans Tifinagh Ahaggar, Noto Sans Tifinagh Air, Noto Sans Tifinagh APT, Noto Sans Tifinagh Azawagh, Noto Sans Tifinagh Ghat, Noto Sans Tifinagh Hawad, Noto Sans Tifinagh, Noto Sans Tifinagh Rhissa Ixa, Noto Sans Tifinagh SIL, Noto Sans Tifinagh Tawellemmet, Noto Sans Tirhuta, Noto Sans Vai, Noto Sans Wancho, Noto Sans Warang Citi, Noto Sans Yi, Noto Sans Zanabazar Square, Noto Serif Armenian, Noto Serif Balinese, Noto Serif Bengali, Noto Serif Devanagari, Noto Serif Dogra, Noto Serif Ethiopic, Noto Serif Georgian, Noto Serif Grantha, Noto Serif Gujarati, Noto Serif Gurmukhi, Noto Serif Hebrew, Noto Serif Kannada, Noto Serif Khmer, Noto Serif Khojki, Noto Serif Lao, Noto Serif Malayalam, Noto Serif Myanmar, Noto Serif NP Hmong, Noto Serif Sinhala, Noto Serif Tamil, Noto Serif Telugu, Noto Serif Tibetan, Noto Serif Yezidi"); // Armenian pref("font.name-list.serif.x-armn", "Noto Serif Armenian, Times, Times New Roman"); ===================================== gfx/thebes/gfxPlatformFontList.cpp ===================================== @@ -401,12 +401,6 @@ void gfxPlatformFontList::ApplyWhitelist() { AutoTArray<RefPtr<gfxFontFamily>, 128> accepted; bool whitelistedFontFound = false; for (const auto& entry : mFontFamilies) { - if (entry.GetData()->IsHidden()) { - // Hidden system fonts are exempt from whitelisting, but don't count - // towards determining whether we "kept" any (user-visible) fonts - accepted.AppendElement(entry.GetData()); - continue; - } nsAutoCString fontFamilyName(entry.GetKey()); ToLowerCase(fontFamilyName); if (familyNamesWhitelist.Contains(fontFamilyName)) { @@ -442,8 +436,7 @@ void gfxPlatformFontList::ApplyWhitelist( AutoTArray<fontlist::Family::InitData, 128> accepted; bool keptNonHidden = false; for (auto& f : aFamilies) { - if (f.mVisibility == FontVisibility::Hidden || - familyNamesWhitelist.Contains(f.mKey)) { + if (familyNamesWhitelist.Contains(f.mKey)) { accepted.AppendElement(f); if (f.mVisibility != FontVisibility::Hidden) { keptNonHidden = true; View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/a1… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/a1… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][base-browser-115.8.0esr-13.0-1] 2 commits: fixup! Firefox preference overrides.
by Pier Angelo Vendrame (@pierov) 11 Mar '24

11 Mar '24
Pier Angelo Vendrame pushed to branch base-browser-115.8.0esr-13.0-1 at The Tor Project / Applications / Tor Browser Commits: f251f057 by Pier Angelo Vendrame at 2024-03-11T15:53:27+01:00 fixup! Firefox preference overrides. Bug 42377: Hidden fonts should obey the allow list. Remove .Helvetica Neue DeskInterface from the allow list. This font might not be actually available, and in any case fonts starting with period will not be displayed by the browser. - - - - - 479be760 by Pier Angelo Vendrame at 2024-03-11T15:53:29+01:00 Bug 42377: Hidden fonts should obey the allow list. Hidden font families were automatically added to the `font.system.whitelist`, which is a behavior that conflicts with our font picking. - - - - - 2 changed files: - browser/app/profile/001-base-profile.js - gfx/thebes/gfxPlatformFontList.cpp Changes: ===================================== browser/app/profile/001-base-profile.js ===================================== @@ -643,7 +643,7 @@ pref("toolkit.winRegisterApplicationRestart", false); pref("gfx.bundled-fonts.activate", 1); #ifdef XP_MACOSX -pref("font.system.whitelist", "AppleGothic, Apple Color Emoji, Arial, Courier, Courier New, Geneva, Georgia, Heiti TC, Helvetica, Helvetica Neue, .Helvetica Neue DeskInterface, Hiragino Kaku Gothic ProN, Kailasa, Lucida Grande, Menlo, Monaco, PingFang HK, PingFang SC, PingFang TC, Songti SC, Songti TC, Tahoma, Thonburi, Times, Times New Roman, Verdana, STIX Two Math, Noto Sans Adlam, Noto Sans Armenian, Noto Sans Balinese, Noto Sans Bamum, Noto Sans Bassa Vah, Noto Sans Batak, Noto Sans Bengali, Noto Sans Buginese, Noto Sans Buhid, Noto Sans Canadian Aboriginal, Noto Sans Chakma, Noto Sans Cham, Noto Sans Cherokee, Noto Sans Coptic, Noto Sans Deseret, Noto Sans Devanagari, Noto Sans Elbasan, Noto Sans Ethiopic, Noto Sans Georgian, Noto Sans Grantha, Noto Sans Gujarati, Noto Sans Gunjala Gondi, Noto Sans Gurmukhi, Noto Sans Hanifi Rohingya, Noto Sans Hanunoo, Noto Sans Hebrew, Noto Sans Kannada, Noto Sans Khmer, Noto Sans Javanese, Noto Sans Kayah Li, Noto Sans Khojki, Noto Sans Khudawadi, Noto Sans Lao, Noto Sans Lepcha, Noto Sans Limbu, Noto Sans Lisu, Noto Sans Mahajani, Noto Sans Malayalam, Noto Sans Mandaic, Noto Sans Masaram Gondi, Noto Sans Medefaidrin, Noto Sans Meetei Mayek, Noto Sans Mende Kikakui, Noto Sans Miao, Noto Sans Modi, Noto Sans Mongolian, Noto Sans Mro, Noto Sans Myanmar, Noto Sans Multani, Noto Sans Newa, Noto Sans New Tai Lue, Noto Sans NKo, Noto Sans Ol Chiki, Noto Sans Oriya, Noto Sans Osage, Noto Sans Osmanya, Noto Sans Pahawh Hmong, Noto Sans Pau Cin Hau, Noto Sans Rejang, Noto Sans Runic, Noto Sans Samaritan, Noto Sans Saurashtra, Noto Sans Sharada, Noto Sans Shavian, Noto Sans Sinhala, Noto Sans Sora Sompeng, Noto Sans Soyombo, Noto Sans Sundanese, Noto Sans Syloti Nagri, Noto Sans Symbols 2, Noto Sans Symbols, Noto Sans Syriac, Noto Sans Tagalog, Noto Sans Tagbanwa, Noto Sans Tai Le, Noto Sans Tai Tham, Noto Sans Tai Viet, Noto Sans Takri, Noto Sans Tamil, Noto Sans Telugu, Noto Sans Thaana, Noto Sans Tifinagh Adrar, Noto Sans Tifinagh Agraw Imazighen, Noto Sans Tifinagh Ahaggar, Noto Sans Tifinagh Air, Noto Sans Tifinagh APT, Noto Sans Tifinagh Azawagh, Noto Sans Tifinagh Ghat, Noto Sans Tifinagh Hawad, Noto Sans Tifinagh, Noto Sans Tifinagh Rhissa Ixa, Noto Sans Tifinagh SIL, Noto Sans Tifinagh Tawellemmet, Noto Sans Tirhuta, Noto Sans Vai, Noto Sans Wancho, Noto Sans Warang Citi, Noto Sans Yi, Noto Sans Zanabazar Square, Noto Serif Armenian, Noto Serif Balinese, Noto Serif Bengali, Noto Serif Devanagari, Noto Serif Dogra, Noto Serif Ethiopic, Noto Serif Georgian, Noto Serif Grantha, Noto Serif Gujarati, Noto Serif Gurmukhi, Noto Serif Hebrew, Noto Serif Kannada, Noto Serif Khmer, Noto Serif Khojki, Noto Serif Lao, Noto Serif Malayalam, Noto Serif Myanmar, Noto Serif NP Hmong, Noto Serif Sinhala, Noto Serif Tamil, Noto Serif Telugu, Noto Serif Tibetan, Noto Serif Yezidi"); +pref("font.system.whitelist", "AppleGothic, Apple Color Emoji, Arial, Courier, Courier New, Geneva, Georgia, Heiti TC, Helvetica, Helvetica Neue, Hiragino Kaku Gothic ProN, Kailasa, Lucida Grande, Menlo, Monaco, PingFang HK, PingFang SC, PingFang TC, Songti SC, Songti TC, Tahoma, Thonburi, Times, Times New Roman, Verdana, STIX Two Math, Noto Sans Adlam, Noto Sans Armenian, Noto Sans Balinese, Noto Sans Bamum, Noto Sans Bassa Vah, Noto Sans Batak, Noto Sans Bengali, Noto Sans Buginese, Noto Sans Buhid, Noto Sans Canadian Aboriginal, Noto Sans Chakma, Noto Sans Cham, Noto Sans Cherokee, Noto Sans Coptic, Noto Sans Deseret, Noto Sans Devanagari, Noto Sans Elbasan, Noto Sans Ethiopic, Noto Sans Georgian, Noto Sans Grantha, Noto Sans Gujarati, Noto Sans Gunjala Gondi, Noto Sans Gurmukhi, Noto Sans Hanifi Rohingya, Noto Sans Hanunoo, Noto Sans Hebrew, Noto Sans Kannada, Noto Sans Khmer, Noto Sans Javanese, Noto Sans Kayah Li, Noto Sans Khojki, Noto Sans Khudawadi, Noto Sans Lao, Noto Sans Lepcha, Noto Sans Limbu, Noto Sans Lisu, Noto Sans Mahajani, Noto Sans Malayalam, Noto Sans Mandaic, Noto Sans Masaram Gondi, Noto Sans Medefaidrin, Noto Sans Meetei Mayek, Noto Sans Mende Kikakui, Noto Sans Miao, Noto Sans Modi, Noto Sans Mongolian, Noto Sans Mro, Noto Sans Myanmar, Noto Sans Multani, Noto Sans Newa, Noto Sans New Tai Lue, Noto Sans NKo, Noto Sans Ol Chiki, Noto Sans Oriya, Noto Sans Osage, Noto Sans Osmanya, Noto Sans Pahawh Hmong, Noto Sans Pau Cin Hau, Noto Sans Rejang, Noto Sans Runic, Noto Sans Samaritan, Noto Sans Saurashtra, Noto Sans Sharada, Noto Sans Shavian, Noto Sans Sinhala, Noto Sans Sora Sompeng, Noto Sans Soyombo, Noto Sans Sundanese, Noto Sans Syloti Nagri, Noto Sans Symbols 2, Noto Sans Symbols, Noto Sans Syriac, Noto Sans Tagalog, Noto Sans Tagbanwa, Noto Sans Tai Le, Noto Sans Tai Tham, Noto Sans Tai Viet, Noto Sans Takri, Noto Sans Tamil, Noto Sans Telugu, Noto Sans Thaana, Noto Sans Tifinagh Adrar, Noto Sans Tifinagh Agraw Imazighen, Noto Sans Tifinagh Ahaggar, Noto Sans Tifinagh Air, Noto Sans Tifinagh APT, Noto Sans Tifinagh Azawagh, Noto Sans Tifinagh Ghat, Noto Sans Tifinagh Hawad, Noto Sans Tifinagh, Noto Sans Tifinagh Rhissa Ixa, Noto Sans Tifinagh SIL, Noto Sans Tifinagh Tawellemmet, Noto Sans Tirhuta, Noto Sans Vai, Noto Sans Wancho, Noto Sans Warang Citi, Noto Sans Yi, Noto Sans Zanabazar Square, Noto Serif Armenian, Noto Serif Balinese, Noto Serif Bengali, Noto Serif Devanagari, Noto Serif Dogra, Noto Serif Ethiopic, Noto Serif Georgian, Noto Serif Grantha, Noto Serif Gujarati, Noto Serif Gurmukhi, Noto Serif Hebrew, Noto Serif Kannada, Noto Serif Khmer, Noto Serif Khojki, Noto Serif Lao, Noto Serif Malayalam, Noto Serif Myanmar, Noto Serif NP Hmong, Noto Serif Sinhala, Noto Serif Tamil, Noto Serif Telugu, Noto Serif Tibetan, Noto Serif Yezidi"); // Armenian pref("font.name-list.serif.x-armn", "Noto Serif Armenian, Times, Times New Roman"); ===================================== gfx/thebes/gfxPlatformFontList.cpp ===================================== @@ -401,12 +401,6 @@ void gfxPlatformFontList::ApplyWhitelist() { AutoTArray<RefPtr<gfxFontFamily>, 128> accepted; bool whitelistedFontFound = false; for (const auto& entry : mFontFamilies) { - if (entry.GetData()->IsHidden()) { - // Hidden system fonts are exempt from whitelisting, but don't count - // towards determining whether we "kept" any (user-visible) fonts - accepted.AppendElement(entry.GetData()); - continue; - } nsAutoCString fontFamilyName(entry.GetKey()); ToLowerCase(fontFamilyName); if (familyNamesWhitelist.Contains(fontFamilyName)) { @@ -442,8 +436,7 @@ void gfxPlatformFontList::ApplyWhitelist( AutoTArray<fontlist::Family::InitData, 128> accepted; bool keptNonHidden = false; for (auto& f : aFamilies) { - if (f.mVisibility == FontVisibility::Hidden || - familyNamesWhitelist.Contains(f.mKey)) { + if (familyNamesWhitelist.Contains(f.mKey)) { accepted.AppendElement(f); if (f.mVisibility != FontVisibility::Hidden) { keptNonHidden = true; View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/63c89d… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/63c89d… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.8.0esr-13.0-1] 2 commits: fixup! Firefox preference overrides.
by Pier Angelo Vendrame (@pierov) 11 Mar '24

11 Mar '24
Pier Angelo Vendrame pushed to branch tor-browser-115.8.0esr-13.0-1 at The Tor Project / Applications / Tor Browser Commits: 9a246151 by Pier Angelo Vendrame at 2024-03-11T15:52:04+01:00 fixup! Firefox preference overrides. Bug 42377: Hidden fonts should obey the allow list. Remove .Helvetica Neue DeskInterface from the allow list. This font might not be actually available, and in any case fonts starting with period will not be displayed by the browser. - - - - - 6bbacc00 by Pier Angelo Vendrame at 2024-03-11T15:52:13+01:00 Bug 42377: Hidden fonts should obey the allow list. Hidden font families were automatically added to the `font.system.whitelist`, which is a behavior that conflicts with our font picking. - - - - - 2 changed files: - browser/app/profile/001-base-profile.js - gfx/thebes/gfxPlatformFontList.cpp Changes: ===================================== browser/app/profile/001-base-profile.js ===================================== @@ -643,7 +643,7 @@ pref("toolkit.winRegisterApplicationRestart", false); pref("gfx.bundled-fonts.activate", 1); #ifdef XP_MACOSX -pref("font.system.whitelist", "AppleGothic, Apple Color Emoji, Arial, Courier, Courier New, Geneva, Georgia, Heiti TC, Helvetica, Helvetica Neue, .Helvetica Neue DeskInterface, Hiragino Kaku Gothic ProN, Kailasa, Lucida Grande, Menlo, Monaco, PingFang HK, PingFang SC, PingFang TC, Songti SC, Songti TC, Tahoma, Thonburi, Times, Times New Roman, Verdana, STIX Two Math, Noto Sans Adlam, Noto Sans Armenian, Noto Sans Balinese, Noto Sans Bamum, Noto Sans Bassa Vah, Noto Sans Batak, Noto Sans Bengali, Noto Sans Buginese, Noto Sans Buhid, Noto Sans Canadian Aboriginal, Noto Sans Chakma, Noto Sans Cham, Noto Sans Cherokee, Noto Sans Coptic, Noto Sans Deseret, Noto Sans Devanagari, Noto Sans Elbasan, Noto Sans Ethiopic, Noto Sans Georgian, Noto Sans Grantha, Noto Sans Gujarati, Noto Sans Gunjala Gondi, Noto Sans Gurmukhi, Noto Sans Hanifi Rohingya, Noto Sans Hanunoo, Noto Sans Hebrew, Noto Sans Kannada, Noto Sans Khmer, Noto Sans Javanese, Noto Sans Kayah Li, Noto Sans Khojki, Noto Sans Khudawadi, Noto Sans Lao, Noto Sans Lepcha, Noto Sans Limbu, Noto Sans Lisu, Noto Sans Mahajani, Noto Sans Malayalam, Noto Sans Mandaic, Noto Sans Masaram Gondi, Noto Sans Medefaidrin, Noto Sans Meetei Mayek, Noto Sans Mende Kikakui, Noto Sans Miao, Noto Sans Modi, Noto Sans Mongolian, Noto Sans Mro, Noto Sans Myanmar, Noto Sans Multani, Noto Sans Newa, Noto Sans New Tai Lue, Noto Sans NKo, Noto Sans Ol Chiki, Noto Sans Oriya, Noto Sans Osage, Noto Sans Osmanya, Noto Sans Pahawh Hmong, Noto Sans Pau Cin Hau, Noto Sans Rejang, Noto Sans Runic, Noto Sans Samaritan, Noto Sans Saurashtra, Noto Sans Sharada, Noto Sans Shavian, Noto Sans Sinhala, Noto Sans Sora Sompeng, Noto Sans Soyombo, Noto Sans Sundanese, Noto Sans Syloti Nagri, Noto Sans Symbols 2, Noto Sans Symbols, Noto Sans Syriac, Noto Sans Tagalog, Noto Sans Tagbanwa, Noto Sans Tai Le, Noto Sans Tai Tham, Noto Sans Tai Viet, Noto Sans Takri, Noto Sans Tamil, Noto Sans Telugu, Noto Sans Thaana, Noto Sans Tifinagh Adrar, Noto Sans Tifinagh Agraw Imazighen, Noto Sans Tifinagh Ahaggar, Noto Sans Tifinagh Air, Noto Sans Tifinagh APT, Noto Sans Tifinagh Azawagh, Noto Sans Tifinagh Ghat, Noto Sans Tifinagh Hawad, Noto Sans Tifinagh, Noto Sans Tifinagh Rhissa Ixa, Noto Sans Tifinagh SIL, Noto Sans Tifinagh Tawellemmet, Noto Sans Tirhuta, Noto Sans Vai, Noto Sans Wancho, Noto Sans Warang Citi, Noto Sans Yi, Noto Sans Zanabazar Square, Noto Serif Armenian, Noto Serif Balinese, Noto Serif Bengali, Noto Serif Devanagari, Noto Serif Dogra, Noto Serif Ethiopic, Noto Serif Georgian, Noto Serif Grantha, Noto Serif Gujarati, Noto Serif Gurmukhi, Noto Serif Hebrew, Noto Serif Kannada, Noto Serif Khmer, Noto Serif Khojki, Noto Serif Lao, Noto Serif Malayalam, Noto Serif Myanmar, Noto Serif NP Hmong, Noto Serif Sinhala, Noto Serif Tamil, Noto Serif Telugu, Noto Serif Tibetan, Noto Serif Yezidi"); +pref("font.system.whitelist", "AppleGothic, Apple Color Emoji, Arial, Courier, Courier New, Geneva, Georgia, Heiti TC, Helvetica, Helvetica Neue, Hiragino Kaku Gothic ProN, Kailasa, Lucida Grande, Menlo, Monaco, PingFang HK, PingFang SC, PingFang TC, Songti SC, Songti TC, Tahoma, Thonburi, Times, Times New Roman, Verdana, STIX Two Math, Noto Sans Adlam, Noto Sans Armenian, Noto Sans Balinese, Noto Sans Bamum, Noto Sans Bassa Vah, Noto Sans Batak, Noto Sans Bengali, Noto Sans Buginese, Noto Sans Buhid, Noto Sans Canadian Aboriginal, Noto Sans Chakma, Noto Sans Cham, Noto Sans Cherokee, Noto Sans Coptic, Noto Sans Deseret, Noto Sans Devanagari, Noto Sans Elbasan, Noto Sans Ethiopic, Noto Sans Georgian, Noto Sans Grantha, Noto Sans Gujarati, Noto Sans Gunjala Gondi, Noto Sans Gurmukhi, Noto Sans Hanifi Rohingya, Noto Sans Hanunoo, Noto Sans Hebrew, Noto Sans Kannada, Noto Sans Khmer, Noto Sans Javanese, Noto Sans Kayah Li, Noto Sans Khojki, Noto Sans Khudawadi, Noto Sans Lao, Noto Sans Lepcha, Noto Sans Limbu, Noto Sans Lisu, Noto Sans Mahajani, Noto Sans Malayalam, Noto Sans Mandaic, Noto Sans Masaram Gondi, Noto Sans Medefaidrin, Noto Sans Meetei Mayek, Noto Sans Mende Kikakui, Noto Sans Miao, Noto Sans Modi, Noto Sans Mongolian, Noto Sans Mro, Noto Sans Myanmar, Noto Sans Multani, Noto Sans Newa, Noto Sans New Tai Lue, Noto Sans NKo, Noto Sans Ol Chiki, Noto Sans Oriya, Noto Sans Osage, Noto Sans Osmanya, Noto Sans Pahawh Hmong, Noto Sans Pau Cin Hau, Noto Sans Rejang, Noto Sans Runic, Noto Sans Samaritan, Noto Sans Saurashtra, Noto Sans Sharada, Noto Sans Shavian, Noto Sans Sinhala, Noto Sans Sora Sompeng, Noto Sans Soyombo, Noto Sans Sundanese, Noto Sans Syloti Nagri, Noto Sans Symbols 2, Noto Sans Symbols, Noto Sans Syriac, Noto Sans Tagalog, Noto Sans Tagbanwa, Noto Sans Tai Le, Noto Sans Tai Tham, Noto Sans Tai Viet, Noto Sans Takri, Noto Sans Tamil, Noto Sans Telugu, Noto Sans Thaana, Noto Sans Tifinagh Adrar, Noto Sans Tifinagh Agraw Imazighen, Noto Sans Tifinagh Ahaggar, Noto Sans Tifinagh Air, Noto Sans Tifinagh APT, Noto Sans Tifinagh Azawagh, Noto Sans Tifinagh Ghat, Noto Sans Tifinagh Hawad, Noto Sans Tifinagh, Noto Sans Tifinagh Rhissa Ixa, Noto Sans Tifinagh SIL, Noto Sans Tifinagh Tawellemmet, Noto Sans Tirhuta, Noto Sans Vai, Noto Sans Wancho, Noto Sans Warang Citi, Noto Sans Yi, Noto Sans Zanabazar Square, Noto Serif Armenian, Noto Serif Balinese, Noto Serif Bengali, Noto Serif Devanagari, Noto Serif Dogra, Noto Serif Ethiopic, Noto Serif Georgian, Noto Serif Grantha, Noto Serif Gujarati, Noto Serif Gurmukhi, Noto Serif Hebrew, Noto Serif Kannada, Noto Serif Khmer, Noto Serif Khojki, Noto Serif Lao, Noto Serif Malayalam, Noto Serif Myanmar, Noto Serif NP Hmong, Noto Serif Sinhala, Noto Serif Tamil, Noto Serif Telugu, Noto Serif Tibetan, Noto Serif Yezidi"); // Armenian pref("font.name-list.serif.x-armn", "Noto Serif Armenian, Times, Times New Roman"); ===================================== gfx/thebes/gfxPlatformFontList.cpp ===================================== @@ -401,12 +401,6 @@ void gfxPlatformFontList::ApplyWhitelist() { AutoTArray<RefPtr<gfxFontFamily>, 128> accepted; bool whitelistedFontFound = false; for (const auto& entry : mFontFamilies) { - if (entry.GetData()->IsHidden()) { - // Hidden system fonts are exempt from whitelisting, but don't count - // towards determining whether we "kept" any (user-visible) fonts - accepted.AppendElement(entry.GetData()); - continue; - } nsAutoCString fontFamilyName(entry.GetKey()); ToLowerCase(fontFamilyName); if (familyNamesWhitelist.Contains(fontFamilyName)) { @@ -442,8 +436,7 @@ void gfxPlatformFontList::ApplyWhitelist( AutoTArray<fontlist::Family::InitData, 128> accepted; bool keptNonHidden = false; for (auto& f : aFamilies) { - if (f.mVisibility == FontVisibility::Hidden || - familyNamesWhitelist.Contains(f.mKey)) { + if (familyNamesWhitelist.Contains(f.mKey)) { accepted.AppendElement(f); if (f.mVisibility != FontVisibility::Hidden) { keptNonHidden = true; View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/572c0b… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/572c0b… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser-build][maint-13.0] Bug 41102: Compress firefox source tarball in a container
by boklm (@boklm) 11 Mar '24

11 Mar '24
boklm pushed to branch maint-13.0 at The Tor Project / Applications / tor-browser-build Commits: c73503ae by Nicolas Vigier at 2024-03-11T15:48:23+01:00 Bug 41102: Compress firefox source tarball in a container As the xz version on the host can be different and produce different output, we compress the firefox source tarball inside a container. At the same time we use xz&#39;s --threads option to make compression faster by using multiple threads. We also move the src-tarballs step definition from rbm.conf to projects/firefox/config since it&#39;s not used in any other project. - - - - - 3 changed files: - projects/firefox/config - projects/release/config - rbm.conf Changes: ===================================== projects/firefox/config ===================================== @@ -58,9 +58,25 @@ steps: src-tarballs: filename: 'src-[% project %]-[% c("version") %].tar.xz' version: '[% c("git_hash") %]' - input_files: [] + input_files: + - project: container-image + pkg_type: build + compress_tar: '' container: - use_container: 0 + use_container: 1 + var: + # single-thread and multi-thread xz will generate a different result, + # se we use at least 2 threads + xz_threads: '[% c("num_procs") == "1" ? "2" : c("num_procs") %]' + src-tarballs: | + #!/bin/bash + set -e + mkdir -p '[% dest_dir %]' + # Files copied to the container are owned by group root (rbm#40074), + # and it seems xz doesn't like that and exits with an error + chgrp rbm '[% project %]-[% c("version") %].tar' + xz --threads=[% c("var/xz_threads") %] -f '[% project %]-[% c("version") %].tar' + mv -vf '[% project %]-[% c("version") %].tar.xz' '[% dest_dir %]/[% c("filename") %]' targets: nightly: version: '[% c("abbrev") %]' ===================================== projects/release/config ===================================== @@ -229,8 +229,7 @@ input_files: pkg_type: src-tarballs target: - '[% c("var/build_target") %]' - - browser-src - - '[% c("var/browser_type") %]' + - '[% c("var/browser_type") %]-macos' steps: signtag: ===================================== rbm.conf ===================================== @@ -14,14 +14,6 @@ container: build: 1 steps: - src-tarballs: - compress_tar: xz - src-tarballs: | - #!/bin/bash - set -e - mkdir -p '[% dest_dir %]' - mv -vf '[% project %]-[% c("version") %].tar.xz' '[% dest_dir %]/[% c("filename") %]' - list_toolchain_updates: build_log: '-' list_toolchain_updates: '[% INCLUDE list_toolchain_updates %]' View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/c… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/c… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser-build][main] Bug 41102: Compress firefox source tarball in a container
by boklm (@boklm) 11 Mar '24

11 Mar '24
boklm pushed to branch main at The Tor Project / Applications / tor-browser-build Commits: 5e9f8f0c by Nicolas Vigier at 2024-03-11T15:47:20+01:00 Bug 41102: Compress firefox source tarball in a container As the xz version on the host can be different and produce different output, we compress the firefox source tarball inside a container. At the same time we use xz&#39;s --threads option to make compression faster by using multiple threads. We also move the src-tarballs step definition from rbm.conf to projects/firefox/config since it&#39;s not used in any other project. - - - - - 3 changed files: - projects/firefox/config - projects/release/config - rbm.conf Changes: ===================================== projects/firefox/config ===================================== @@ -58,9 +58,25 @@ steps: src-tarballs: filename: 'src-[% project %]-[% c("version") %].tar.xz' version: '[% c("git_hash") %]' - input_files: [] + input_files: + - project: container-image + pkg_type: build + compress_tar: '' container: - use_container: 0 + use_container: 1 + var: + # single-thread and multi-thread xz will generate a different result, + # se we use at least 2 threads + xz_threads: '[% c("num_procs") == "1" ? "2" : c("num_procs") %]' + src-tarballs: | + #!/bin/bash + set -e + mkdir -p '[% dest_dir %]' + # Files copied to the container are owned by group root (rbm#40074), + # and it seems xz doesn't like that and exits with an error + chgrp rbm '[% project %]-[% c("version") %].tar' + xz --threads=[% c("var/xz_threads") %] -f '[% project %]-[% c("version") %].tar' + mv -vf '[% project %]-[% c("version") %].tar.xz' '[% dest_dir %]/[% c("filename") %]' targets: nightly: version: '[% c("abbrev") %]' ===================================== projects/release/config ===================================== @@ -229,8 +229,7 @@ input_files: pkg_type: src-tarballs target: - '[% c("var/build_target") %]' - - browser-src - - '[% c("var/browser_type") %]' + - '[% c("var/browser_type") %]-macos' steps: signtag: ===================================== rbm.conf ===================================== @@ -14,14 +14,6 @@ container: build: 1 steps: - src-tarballs: - compress_tar: xz - src-tarballs: | - #!/bin/bash - set -e - mkdir -p '[% dest_dir %]' - mv -vf '[% project %]-[% c("version") %].tar.xz' '[% dest_dir %]/[% c("filename") %]' - list_toolchain_updates: build_log: '-' list_toolchain_updates: '[% INCLUDE list_toolchain_updates %]' View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/5… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/5… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.8.0esr-13.5-1] fixup! Add TorStrings module for localization
by Pier Angelo Vendrame (@pierov) 07 Mar '24

07 Mar '24
Pier Angelo Vendrame pushed to branch tor-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: f6c7b7f2 by Henry Wilkes at 2024-03-07T11:46:58+00:00 fixup! Add TorStrings module for localization Bug 42442: Remove unused bridge settings strings. - - - - - 1 changed file: - toolkit/torbutton/chrome/locale/en-US/settings.properties Changes: ===================================== toolkit/torbutton/chrome/locale/en-US/settings.properties ===================================== @@ -96,32 +96,3 @@ settings.allowedPortsPlaceholder=Comma-separated values # Log dialog settings.torLogDialogTitle=Tor Logs settings.copyLog=Copy Tor Log to Clipboard - - -# TODO: Remove - -settings.bridgeCurrent=Your Current Bridges -settings.bridgeCurrentDescription=You can keep one or more bridges saved, and Tor will choose which one to use when you connect. Tor will automatically switch to use another bridge when needed. -# Translation note: %1$S = bridge type; %2$S = bridge emoji id -settings.bridgeId=%1$S bridge: %2$S -settings.connectedBridge=Connected -settings.bridgeShare=Share this bridge using the QR code or by copying its address: -settings.whatAreThese=What are these? -settings.bridgeCopy=Copy Bridge Address -settings.bridgeShowAll=Show All Bridges -settings.bridgeShowFewer=Show Fewer Bridges -settings.allBridgesEnabled=Use current bridges -settings.bridgeRemoveAll=Remove All Bridges -settings.bridgeAdd=Add a New Bridge -settings.bridgeSelectBrowserBuiltin=Choose from one of Tor Browser’s built-in bridges -settings.bridgeSelectBuiltin=Select a Built-In Bridge… -settings.bridgeRequestFromTorProject=Request a bridge from torproject.org -settings.bridgeRequest=Request a Bridge… -settings.bridgeEnterKnown=Enter a bridge address you already know -settings.bridgeAddManually=Add a Bridge Manually… - -# Provide bridge dialog -settings.provideBridgeTitleAdd=Add a Bridge Manually -# Translation note: %S is a Learn more link. -settings.provideBridgeDescription=Add a bridge provided by a trusted organization or someone you know. If you don’t have a bridge, you can request one from the Tor Project. %S -settings.provideBridgePlaceholder=type address:port (one per line) View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/f6c7b7f… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/f6c7b7f… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.8.0esr-13.5-1] 3 commits: fixup! Tor Browser localization migration scripts.
by Pier Angelo Vendrame (@pierov) 07 Mar '24

07 Mar '24
Pier Angelo Vendrame pushed to branch tor-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: 708a2c47 by Henry Wilkes at 2024-03-07T10:37:42+00:00 fixup! Tor Browser localization migration scripts. Bug 42305: Move localization scripts into new folder. - - - - - ad71ddb2 by Henry Wilkes at 2024-03-07T10:37:42+00:00 Bug 42305: Add script to combine translation files across versions. - - - - - f13a9d22 by Henry Wilkes at 2024-03-07T10:37:42+00:00 Add CI for Tor Browser - - - - - 13 changed files: - + .gitlab-ci.yml - + tools/torbrowser/l10n/combine-translation-versions.py - + tools/torbrowser/l10n/combine/__init__.py - + tools/torbrowser/l10n/combine/combine.py - + tools/torbrowser/l10n/combine/tests/README - tools/torbrowser/l10n_migrations/__init__.py → tools/torbrowser/l10n/combine/tests/__init__.py - + tools/torbrowser/l10n/combine/tests/test_android.py - + tools/torbrowser/l10n/combine/tests/test_dtd.py - + tools/torbrowser/l10n/combine/tests/test_fluent.py - + tools/torbrowser/l10n/combine/tests/test_properties.py - tools/torbrowser/migrate_l10n.py → tools/torbrowser/l10n/migrate.py - + tools/torbrowser/l10n/migrations/__init__.py - tools/torbrowser/l10n_migrations/bug-41333-new-about-tor.py → tools/torbrowser/l10n/migrations/bug-41333-new-about-tor.py Changes: ===================================== .gitlab-ci.yml ===================================== @@ -0,0 +1,69 @@ +stages: + - update-translations + +.update-translation-base: + stage: update-translations + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + changes: + - "**/*.ftl" + - "**/*.properties" + - "**/*.dtd" + - if: $FORCE_UPDATE_TRANSLATIONS == "true" + variables: + TOR_BROWSER_COMBINED_FILES_JSON: "combined-translation-files.json" + + +combine-en-US-translations: + extends: .update-translation-base + image: python + variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + TRANSLATION_FILES: ' + tor-browser:tor-browser.ftl + tor-browser:aboutDialog.dtd + tor-browser:aboutTBUpdate.dtd + tor-browser:aboutTor.dtd + tor-browser:torbutton.dtd + tor-browser:browserOnboarding.properties + tor-browser:cryptoSafetyPrompt.properties + tor-browser:onboarding.properties + tor-browser:onionLocation.properties + tor-browser:rulesets.properties + tor-browser:settings.properties + tor-browser:torbutton.properties + tor-browser:torConnect.properties + tor-browser:torlauncher.properties + base-browser:base-browser.ftl + base-browser:newIdentity.properties + base-browser:securityLevel.properties + ' + cache: + paths: + - .cache/pip + # Artifact is for translation project job + artifacts: + paths: + - "$TOR_BROWSER_COMBINED_FILES_JSON" + expire_in: "60 min" + reports: + dotenv: job_id.env + # Don't load artifacts for this job. + dependencies: [] + script: + # Save this CI_JOB_ID to the dotenv file to be used in the variables for the + # push-en-US-translations job. + - echo 'COMBINE_TRANSLATIONS_JOB_ID='"$CI_JOB_ID" >job_id.env + - pip install compare_locales + - python ./tools/torbrowser/l10n/combine-translation-versions.py "$CI_COMMIT_BRANCH" "$TRANSLATION_FILES" "$TOR_BROWSER_COMBINED_FILES_JSON" + +push-en-US-translations: + extends: .update-translation-base + needs: + - job: combine-en-US-translations + variables: + TOR_BROWSER_COMBINED_FILES_JSON_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${COMBINE_TRANSLATIONS_JOB_ID}/artifacts/${TOR_BROWSER_COMBINED_FILES_JSON}" + trigger: + strategy: depend + project: tor-browser-translation-bot/translation + branch: tor-browser-ci ===================================== tools/torbrowser/l10n/combine-translation-versions.py ===================================== @@ -0,0 +1,208 @@ +import argparse +import json +import logging +import os +import re +import subprocess + +from combine import combine_files + +arg_parser = argparse.ArgumentParser( + description="Combine a translation file across two different versions" +) + +arg_parser.add_argument( + "current_branch", metavar="<current-branch>", help="branch for the newest version" +) +arg_parser.add_argument( + "filenames", metavar="<filenames>", help="name of the translation files" +) +arg_parser.add_argument("outname", metavar="<json>", help="name of the json output") + +args = arg_parser.parse_args() + +logging.basicConfig() +logger = logging.getLogger("combine-translation-versions") +logger.setLevel(logging.INFO) + + +def in_pink(msg: str) -> str: + """Present a message as pink in the terminal output. + + :param msg: The message to wrap in pink. + :returns: The message to print to terminal. + """ + # Pink and bold. + return f"\x1b[1;38;5;212m{msg}\x1b[0m" + + +def git_run(git_args: list[str]) -> None: + """Run a git command. + + :param git_args: The arguments that should follow "git". + """ + # Add some text to give context to git's stderr appearing in log. + logger.info("Running: " + in_pink("git " + " ".join(git_args))) + subprocess.run(["git", *git_args], check=True) + + +def git_text(git_args: list[str]) -> str: + """Get the text output for a git command. + + :param git_args: The arguments that should follow "git". + :returns: The stdout of the command. + """ + logger.info("Running: " + in_pink("git " + " ".join(git_args))) + return subprocess.run( + ["git", *git_args], text=True, check=True, stdout=subprocess.PIPE + ).stdout + + +def git_lines(git_args: list[str]) -> list[str]: + """Get the lines from a git command. + + :param git_args: The arguments that should follow "git". + :returns: The non-empty lines from stdout of the command. + """ + return [line for line in git_text(git_args).split("\n") if line] + + +def git_file_paths(git_ref: str) -> list[str]: + """Get the full list of file paths found under the given tree. + + :param git_ref: The git reference for the tree to search. + :returns: The found file paths. + """ + return git_lines(["ls-tree", "-r", "--format=%(path)", git_ref]) + + +def matching_path(search_paths: list[str], filename: str) -> str | None: + """Get the matching file path with the given filename, if it exists. + + :param search_paths: The file paths to search through. + :param filename: The file name to match. + :returns: The unique file path with the matching name, or None if no such + match was found. + :throws Exception: If multiple paths shared the same file name. + """ + matching = [path for path in search_paths if os.path.basename(path) == filename] + if not matching: + return None + if len(matching) > 1: + raise Exception("Multiple occurrences of {filename}") + return matching[0] + + +def git_file_content(git_ref: str, path: str | None) -> str | None: + """Get the file content of the specified git blob object. + + :param git_ref: The reference for the tree to find the file under. + :param path: The file path for the object, or None if there is no path. + :returns: The file content, or None if no path was given. + """ + if path is None: + return None + return git_text(["cat-file", "blob", f"{git_ref}:{path}"]) + + +def get_stable_branch(branch_prefix: str) -> str: + """Find the most recent stable branch in the origin repository. + + :param branch_prefix: The prefix that the stable branch should have. + :returns: The branch name. + """ + tag_glob = f"{branch_prefix}-*-build1" + # To speed up, only fetch the tags without blobs. + git_run( + ["fetch", "--depth=1", "--filter=object:type=tag", "origin", "tag", tag_glob] + ) + # Get most recent stable tag. + for build_tag, annotation in ( + line.split(" ", 1) + for line in git_lines(["tag", "-n1", "--list", tag_glob, "--sort=-taggerdate"]) + ): + if "stable" in annotation: + # Branch name is the same as the tag, minus "-build1". + return re.sub(r"-build1$", "", build_tag) + raise Exception("No stable build1 tag found") + + +def get_version_from_branch_name(branch_name: str) -> tuple[str, float]: + """Get the branch prefix and version from its name. + + :param branch_name: The branch to extract from. + :returns: The branch prefix and its version number. + """ + version_match = re.match( + r"([a-z-]+)-[^-]*-([0-9]+\.[05])-", + branch_name, + ) + + if not version_match: + raise ValueError(f"Unable to parse the version from the branch {branch_name}") + + return (version_match.group(1), float(version_match.group(2))) + + +branch_prefix, current_version = get_version_from_branch_name(args.current_branch) + +stable_branch = get_stable_branch(branch_prefix) +_, stable_version = get_version_from_branch_name(stable_branch) + +if stable_version > current_version or stable_version < current_version - 0.5: + raise Exception( + f"Version of stable branch {stable_branch} is not within 0.5 of the " + f"current branch {args.current_branch}" + ) + +# Minimal fetch of stable_branch. +# Individual file blobs will be downloaded as needed. +git_run(["fetch", "--depth=1", "--filter=blob:none", "origin", stable_branch]) + +current_file_paths = git_file_paths("HEAD") +old_file_paths = git_file_paths(f"origin/{stable_branch}") + +ci_commit = os.environ.get("CI_COMMIT_SHA", "") +ci_url_base = os.environ.get("CI_PROJECT_URL", "") + +json_data = { + "commit": ci_commit, + "commit-url": f"{ci_url_base}/-/commit/{ci_commit}" + if (ci_commit and ci_url_base) + else "", + "project-path": os.environ.get("CI_PROJECT_PATH", ""), + "current-branch": args.current_branch, + "stable-branch": stable_branch, + "files": [], +} + +for translation_branch, name in ( + part.strip().split(":", 1) for part in args.filenames.split(" ") if part.strip() +): + current_path = matching_path(current_file_paths, name) + old_path = matching_path(old_file_paths, name) + + if current_path is None and old_path is None: + # No file in either branch. + logger.warning(f"{name} does not exist in either the current or stable branch") + elif current_path is None: + logger.warning(f"{name} deleted in the current branch") + elif old_path is None: + logger.warning(f"{name} does not exist in the stable branch") + + content = combine_files( + name, + git_file_content("HEAD", current_path), + git_file_content(f"origin/{stable_branch}", old_path), + f"Will be unused in Tor Browser {current_version}!", + ) + json_data["files"].append( + { + "name": name, + "branch": translation_branch, + "content": content, + } + ) + +with open(args.outname, "w") as file: + json.dump(json_data, file) ===================================== tools/torbrowser/l10n/combine/__init__.py ===================================== @@ -0,0 +1,3 @@ +# flake8: noqa + +from .combine import combine_files ===================================== tools/torbrowser/l10n/combine/combine.py ===================================== @@ -0,0 +1,181 @@ +import re +from typing import TYPE_CHECKING, Any + +from compare_locales.parser import getParser +from compare_locales.parser.android import AndroidEntity, DocumentWrapper +from compare_locales.parser.base import Comment, Entity, Junk, Whitespace +from compare_locales.parser.dtd import DTDEntity +from compare_locales.parser.fluent import FluentComment, FluentEntity +from compare_locales.parser.properties import PropertiesEntity + +if TYPE_CHECKING: + from collections.abc import Iterable + + +def combine_files( + filename: str, + new_content: str | None, + old_content: str | None, + comment_prefix: str, +) -> str | None: + """Combine two translation files into one to include all strings from both. + The new content is presented first, and any strings only found in the old + content are placed at the end with an additional comment. + + :param filename: The filename for the file, determines the format. + :param new_content: The new content for the file, or None if it has been + deleted. + :param old_content: The old content for the file, or None if it did not + exist before. + :comment_prefix: A comment to include for any strings that are only found in + the old content. This will be placed before any other comments for the + string. + + :returns: The combined content, or None if both given contents are None. + """ + if new_content is None and old_content is None: + return None + + # getParser from compare_locale returns the same instance for the same file + # extension. + parser = getParser(filename) + + is_android = filename.endswith(".xml") + if new_content is None: + if is_android: + # File was deleted, add some document parts. + content_start = ( + '<?xml version="1.0" encoding="utf-8" standalone="yes"?>\n<resources>\n' + ) + content_end = "</resources>\n" + else: + # Treat as an empty file. + content_start = "" + content_end = "" + existing_keys = [] + else: + parser.readUnicode(new_content) + + # Start with the same content as the current file. + # For android strings, we want to keep the final "</resources>" until after. + if is_android: + closing_match = re.match( + r"^(.*)(</resources>\s*)$", parser.ctx.contents, re.DOTALL + ) + if not closing_match: + raise ValueError("Missing a final </resources>") + content_start = closing_match.group(1) + content_end = closing_match.group(2) + else: + content_start = parser.ctx.contents + content_end = "" + existing_keys = [entry.key for entry in parser.walk(only_localizable=True)] + + # For Fluent, we want to prefix the strings using GroupComments. + # On weblate this will cause all the strings that fall under the GroupComment's + # scope to have the prefix added to their "notes". + # We set up an initial GroupComment for the first string we find. This will also + # end the scope of the last GroupComment in the new translation file. + # This will be replaced with a the next GroupComment when it is found. + fluent_group_comment_prefix = f"\n## {comment_prefix}\n" + fluent_group_comment: str | None = fluent_group_comment_prefix + + # For other formats, we want to keep all the comment lines that come directly + # before the string. + # In compare_locales.parser, only the comment line directly before an Entity + # counts as the pre_comment for that Entity. I.e. only this line will be + # included in Entity.all + # However, in weblate every comment line that comes before the Entity is + # included as a comment. So we also want to keep these additional comments to + # preserve them for weblate. + # We gather these extra comments in stacked_comments, and clear them whenever we + # reach an Entity or a blank line (Whitespace is more than "\n"). + stacked_comments: list[str] = [] + + additions: list[str] = [] + + entry_iter: Iterable[Any] = () + # If the file does not exist in the old branch, don't make any additions. + if old_content is not None: + parser.readUnicode(old_content) + entry_iter = parser.walk(only_localizable=False) + for entry in entry_iter: + if isinstance(entry, Junk): + raise ValueError(f"Unexpected Junk: {entry.all}") + if isinstance(entry, Whitespace): + # Clear stacked comments if more than one empty line. + if entry.all != "\n": + stacked_comments.clear() + continue + if isinstance(entry, Comment): + if isinstance(entry, FluentComment): + # Don't stack Fluent comments. + # Only the comments included in Entity.pre_comment count towards + # that Entity's comment. + if entry.all.startswith("##"): + # A Fluent GroupComment + if entry.all == "##": + # Empty GroupComment. Used to end the scope of a previous + # GroupComment. + # Replace this with our prefix comment. + fluent_group_comment = fluent_group_comment_prefix + else: + # Prefix the group comment. + fluent_group_comment = ( + f"{fluent_group_comment_prefix}{entry.all}\n" + ) + else: + stacked_comments.append(entry.all) + continue + if isinstance(entry, DocumentWrapper): + # Not needed. + continue + + if not isinstance(entry, Entity): + raise ValueError(f"Unexpected type: {entry.__class__.__name__}") + + if entry.key in existing_keys: + # Already included this string in the new translation file. + # Drop the gathered comments for this Entity. + stacked_comments.clear() + continue + + if isinstance(entry, FluentEntity): + if fluent_group_comment is not None: + # We have a found GroupComment which has not been included yet. + # All following Entity's will be under its scope, until the next + # GroupComment. + additions.append(fluent_group_comment) + # Added GroupComment, so don't need to add again. + fluent_group_comment = None + elif isinstance(entry, DTDEntity): + # Include our additional comment before we print the rest for this + # Entity. + additions.append(f"<!-- LOCALIZATION NOTE: {comment_prefix} -->") + elif isinstance(entry, PropertiesEntity): + additions.append(f"# {comment_prefix}") + elif isinstance(entry, AndroidEntity): + additions.append(f"<!-- {comment_prefix} -->") + else: + raise ValueError(f"Unexpected Entity type: {entry.__class__.__name__}") + + # Add any other comment lines that came directly before this Entity. + additions.extend(stacked_comments) + stacked_comments.clear() + additions.append(entry.all) + + content_middle = "" + + if additions: + # New line before and after the additions + additions.insert(0, "") + additions.append("") + if is_android: + content_middle = "\n ".join(additions) + else: + content_middle = "\n".join(additions) + + # Remove " " in otherwise blank lines. + content_middle = re.sub("^ +$", "", content_middle, flags=re.MULTILINE) + + return content_start + content_middle + content_end ===================================== tools/torbrowser/l10n/combine/tests/README ===================================== @@ -0,0 +1,2 @@ +python tests to be run with pytest. +Requires the compare-locales package. ===================================== tools/torbrowser/l10n_migrations/__init__.py → tools/torbrowser/l10n/combine/tests/__init__.py ===================================== ===================================== tools/torbrowser/l10n/combine/tests/test_android.py ===================================== @@ -0,0 +1,330 @@ +import textwrap + +from combine import combine_files + + +def wrap_in_xml(content): + if content is None: + return None + # Allow for indents to make the tests more readable. + content = textwrap.dedent(content) + return f"""\ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<resources> +{textwrap.indent(content, " ")}</resources> +""" + + +def assert_result(new_content, old_content, expect): + new_content = wrap_in_xml(new_content) + old_content = wrap_in_xml(old_content) + expect = wrap_in_xml(expect) + assert expect == combine_files( + "test_strings.xml", new_content, old_content, "REMOVED STRING" + ) + + +def test_combine_empty(): + assert_result(None, None, None) + + +def test_combine_new_file(): + # New file with no old content. + assert_result( + """\ + <string name="string_1">First</string> + <string name="string_2">Second</string> + """, + None, + """\ + <string name="string_1">First</string> + <string name="string_2">Second</string> + """, + ) + + +def test_combine_removed_file(): + # Entire file was removed. + assert_result( + None, + """\ + <string name="string_1">First</string> + <string name="string_2">Second</string> + """, + """\ + + <!-- REMOVED STRING --> + <string name="string_1">First</string> + <!-- REMOVED STRING --> + <string name="string_2">Second</string> + """, + ) + + +def test_no_change(): + content = """\ + <string name="string_1">First</string> + <string name="string_2">Second</string> + """ + assert_result(content, content, content) + + +def test_added_string(): + assert_result( + """\ + <string name="string_1">First</string> + <string name="string_new">NEW</string> + <string name="string_2">Second</string> + """, + """\ + <string name="string_1">First</string> + <string name="string_2">Second</string> + """, + """\ + <string name="string_1">First</string> + <string name="string_new">NEW</string> + <string name="string_2">Second</string> + """, + ) + + +def test_removed_string(): + assert_result( + """\ + <string name="string_1">First</string> + <string name="string_2">Second</string> + """, + """\ + <string name="string_1">First</string> + <string name="removed">REMOVED</string> + <string name="string_2">Second</string> + """, + """\ + <string name="string_1">First</string> + <string name="string_2">Second</string> + + <!-- REMOVED STRING --> + <string name="removed">REMOVED</string> + """, + ) + + +def test_removed_and_added(): + assert_result( + """\ + <string name="new_1">New string</string> + <string name="string_1">First</string> + <string name="string_2">Second</string> + <string name="new_2">New string 2</string> + """, + """\ + <string name="string_1">First</string> + <string name="removed_1">First removed</string> + <string name="removed_2">Second removed</string> + <string name="string_2">Second</string> + <string name="removed_3">Third removed</string> + """, + """\ + <string name="new_1">New string</string> + <string name="string_1">First</string> + <string name="string_2">Second</string> + <string name="new_2">New string 2</string> + + <!-- REMOVED STRING --> + <string name="removed_1">First removed</string> + <!-- REMOVED STRING --> + <string name="removed_2">Second removed</string> + <!-- REMOVED STRING --> + <string name="removed_3">Third removed</string> + """, + ) + + +def test_updated(): + # String content was updated. + assert_result( + """\ + <string name="changed_string">NEW</string> + """, + """\ + <string name="changed_string">OLD</string> + """, + """\ + <string name="changed_string">NEW</string> + """, + ) + + +def test_updated_comment(): + # String comment was updated. + assert_result( + """\ + <!-- NEW --> + <string name="changed_string">string</string> + """, + """\ + <!-- OLD --> + <string name="changed_string">string</string> + """, + """\ + <!-- NEW --> + <string name="changed_string">string</string> + """, + ) + # Comment added. + assert_result( + """\ + <!-- NEW --> + <string name="changed_string">string</string> + """, + """\ + <string name="changed_string">string</string> + """, + """\ + <!-- NEW --> + <string name="changed_string">string</string> + """, + ) + # Comment removed. + assert_result( + """\ + <string name="changed_string">string</string> + """, + """\ + <!-- OLD --> + <string name="changed_string">string</string> + """, + """\ + <string name="changed_string">string</string> + """, + ) + + # With file comments + assert_result( + """\ + <!-- NEW file comment --> + + <!-- NEW --> + <string name="changed_string">string</string> + """, + """\ + <!-- OLD file comment --> + + <!-- OLD --> + <string name="changed_string">string</string> + """, + """\ + <!-- NEW file comment --> + + <!-- NEW --> + <string name="changed_string">string</string> + """, + ) + + +def test_reordered(): + # String was re_ordered. + assert_result( + """\ + <string name="string_1">value</string> + <string name="moved_string">move</string> + """, + """\ + <string name="moved_string">move</string> + <string name="string_1">value</string> + """, + """\ + <string name="string_1">value</string> + <string name="moved_string">move</string> + """, + ) + + +def test_removed_string_with_comment(): + assert_result( + """\ + <!-- Comment for first. --> + <string name="string_1">First</string> + <string name="string_2">Second</string> + """, + """\ + <!-- Comment for first. --> + <string name="string_1">First</string> + <!-- Comment for removed. --> + <string name="removed">REMOVED</string> + <string name="string_2">Second</string> + """, + """\ + <!-- Comment for first. --> + <string name="string_1">First</string> + <string name="string_2">Second</string> + + <!-- REMOVED STRING --> + <!-- Comment for removed. --> + <string name="removed">REMOVED</string> + """, + ) + + # With file comments and multi-line. + # All comments prior to a removed string are moved with it, until another + # entity or blank line is reached. + assert_result( + """\ + <!-- First File comment --> + + <!-- Comment for first. --> + <!-- Comment 2 for first. --> + <string name="string_1">First</string> + + <!-- Second --> + <!-- File comment --> + + <string name="string_2">Second</string> + """, + """\ + <!-- First File comment --> + + <!-- Comment for first. --> + <!-- Comment 2 for first. --> + <string name="string_1">First</string> + <string name="removed_1">First removed</string> + <!-- Comment for second removed. --> + <string name="removed_2">Second removed</string> + + <!-- Removed file comment --> + + <!-- Comment 1 for third removed --> + <!-- Comment 2 for third removed --> + <string name="removed_3">Third removed</string> + + <!-- Second --> + <!-- File comment --> + + <string name="removed_4">Fourth removed</string> + <string name="string_2">Second</string> + """, + """\ + <!-- First File comment --> + + <!-- Comment for first. --> + <!-- Comment 2 for first. --> + <string name="string_1">First</string> + + <!-- Second --> + <!-- File comment --> + + <string name="string_2">Second</string> + + <!-- REMOVED STRING --> + <string name="removed_1">First removed</string> + <!-- REMOVED STRING --> + <!-- Comment for second removed. --> + <string name="removed_2">Second removed</string> + <!-- REMOVED STRING --> + <!-- Comment 1 for third removed --> + <!-- Comment 2 for third removed --> + <string name="removed_3">Third removed</string> + <!-- REMOVED STRING --> + <string name="removed_4">Fourth removed</string> + """, + ) ===================================== tools/torbrowser/l10n/combine/tests/test_dtd.py ===================================== @@ -0,0 +1,325 @@ +import textwrap + +from combine import combine_files + + +def assert_result(new_content, old_content, expect): + # Allow for indents to make the tests more readable. + if new_content is not None: + new_content = textwrap.dedent(new_content) + if old_content is not None: + old_content = textwrap.dedent(old_content) + if expect is not None: + expect = textwrap.dedent(expect) + assert expect == combine_files( + "test.dtd", new_content, old_content, "REMOVED STRING" + ) + + +def test_combine_empty(): + assert_result(None, None, None) + + +def test_combine_new_file(): + # New file with no old content. + assert_result( + """\ + <!ENTITY string.1 "First"> + <!ENTITY string.2 "Second"> + """, + None, + """\ + <!ENTITY string.1 "First"> + <!ENTITY string.2 "Second"> + """, + ) + + +def test_combine_removed_file(): + # Entire file was removed. + assert_result( + None, + """\ + <!ENTITY string.1 "First"> + <!ENTITY string.2 "Second"> + """, + """\ + + <!-- LOCALIZATION NOTE: REMOVED STRING --> + <!ENTITY string.1 "First"> + <!-- LOCALIZATION NOTE: REMOVED STRING --> + <!ENTITY string.2 "Second"> + """, + ) + + +def test_no_change(): + content = """\ + <!ENTITY string.1 "First"> + <!ENTITY string.2 "Second"> + """ + assert_result(content, content, content) + + +def test_added_string(): + assert_result( + """\ + <!ENTITY string.1 "First"> + <!ENTITY string.new "NEW"> + <!ENTITY string.2 "Second"> + """, + """\ + <!ENTITY string.1 "First"> + <!ENTITY string.2 "Second"> + """, + """\ + <!ENTITY string.1 "First"> + <!ENTITY string.new "NEW"> + <!ENTITY string.2 "Second"> + """, + ) + + +def test_removed_string(): + assert_result( + """\ + <!ENTITY string.1 "First"> + <!ENTITY string.2 "Second"> + """, + """\ + <!ENTITY string.1 "First"> + <!ENTITY removed "REMOVED"> + <!ENTITY string.2 "Second"> + """, + """\ + <!ENTITY string.1 "First"> + <!ENTITY string.2 "Second"> + + <!-- LOCALIZATION NOTE: REMOVED STRING --> + <!ENTITY removed "REMOVED"> + """, + ) + + +def test_removed_and_added(): + assert_result( + """\ + <!ENTITY new.1 "New string"> + <!ENTITY string.1 "First"> + <!ENTITY string.2 "Second"> + <!ENTITY new.2 "New string 2"> + """, + """\ + <!ENTITY string.1 "First"> + <!ENTITY removed.1 "First removed"> + <!ENTITY removed.2 "Second removed"> + <!ENTITY string.2 "Second"> + <!ENTITY removed.3 "Third removed"> + """, + """\ + <!ENTITY new.1 "New string"> + <!ENTITY string.1 "First"> + <!ENTITY string.2 "Second"> + <!ENTITY new.2 "New string 2"> + + <!-- LOCALIZATION NOTE: REMOVED STRING --> + <!ENTITY removed.1 "First removed"> + <!-- LOCALIZATION NOTE: REMOVED STRING --> + <!ENTITY removed.2 "Second removed"> + <!-- LOCALIZATION NOTE: REMOVED STRING --> + <!ENTITY removed.3 "Third removed"> + """, + ) + + +def test_updated(): + # String content was updated. + assert_result( + """\ + <!ENTITY changed.string "NEW"> + """, + """\ + <!ENTITY changed.string "OLD"> + """, + """\ + <!ENTITY changed.string "NEW"> + """, + ) + + +def test_updated_comment(): + # String comment was updated. + assert_result( + """\ + <!-- LOCALIZATION NOTE: NEW --> + <!ENTITY changed.string "string"> + """, + """\ + <!-- LOCALIZATION NOTE: OLD --> + <!ENTITY changed.string "string"> + """, + """\ + <!-- LOCALIZATION NOTE: NEW --> + <!ENTITY changed.string "string"> + """, + ) + # Comment added. + assert_result( + """\ + <!-- LOCALIZATION NOTE: NEW --> + <!ENTITY changed.string "string"> + """, + """\ + <!ENTITY changed.string "string"> + """, + """\ + <!-- LOCALIZATION NOTE: NEW --> + <!ENTITY changed.string "string"> + """, + ) + # Comment removed. + assert_result( + """\ + <!ENTITY changed.string "string"> + """, + """\ + <!-- LOCALIZATION NOTE: OLD --> + <!ENTITY changed.string "string"> + """, + """\ + <!ENTITY changed.string "string"> + """, + ) + + # With multiple comments + assert_result( + """\ + <!-- NEW FILE COMMENT --> + + <!-- LOCALIZATION NOTE: NEW --> + <!ENTITY changed.string "string"> + """, + """\ + <!-- OLD --> + + <!-- LOCALIZATION NOTE: OLD --> + <!ENTITY changed.string "string"> + """, + """\ + <!-- NEW FILE COMMENT --> + + <!-- LOCALIZATION NOTE: NEW --> + <!ENTITY changed.string "string"> + """, + ) + + +def test_reordered(): + # String was re.ordered. + assert_result( + """\ + <!ENTITY string.1 "value"> + <!ENTITY moved.string "move"> + """, + """\ + <!ENTITY moved.string "move"> + <!ENTITY string.1 "value"> + """, + """\ + <!ENTITY string.1 "value"> + <!ENTITY moved.string "move"> + """, + ) + + +def test_removed_string_with_comment(): + assert_result( + """\ + <!-- LOCALIZATION NOTE: Comment for first. --> + <!ENTITY string.1 "First"> + <!ENTITY string.2 "Second"> + """, + """\ + <!-- LOCALIZATION NOTE: Comment for first. --> + <!ENTITY string.1 "First"> + <!-- LOCALIZATION NOTE: Comment for removed. --> + <!ENTITY removed "REMOVED"> + <!ENTITY string.2 "Second"> + """, + """\ + <!-- LOCALIZATION NOTE: Comment for first. --> + <!ENTITY string.1 "First"> + <!ENTITY string.2 "Second"> + + <!-- LOCALIZATION NOTE: REMOVED STRING --> + <!-- LOCALIZATION NOTE: Comment for removed. --> + <!ENTITY removed "REMOVED"> + """, + ) + + # With multiple lines of comments. + + assert_result( + """\ + <!-- First file comment --> + + <!-- LOCALIZATION NOTE: Comment for first. --> + <!-- LOCALIZATION NOTE: Comment 2 for first. --> + <!ENTITY string.1 "First"> + + <!-- Second + - file + - comment --> + + <!ENTITY string.2 "Second"> + """, + """\ + <!-- First file comment --> + + <!-- LOCALIZATION NOTE: Comment for first. --> + <!ENTITY string.1 "First"> + <!ENTITY removed.1 "First removed"> + <!-- LOCALIZATION NOTE: Comment for second removed. --> + <!ENTITY removed.2 "Second removed"> + + <!-- Removed file comment --> + + <!-- LOCALIZATION NOTE: Comment for third removed. --> + <!-- LOCALIZATION NOTE: Comment 2 for + third removed. --> + <!ENTITY removed.3 "Third removed"> + + <!-- Second + - file + - comment --> + + <!ENTITY removed.4 "Fourth removed"> + <!ENTITY string.2 "Second"> + """, + """\ + <!-- First file comment --> + + <!-- LOCALIZATION NOTE: Comment for first. --> + <!-- LOCALIZATION NOTE: Comment 2 for first. --> + <!ENTITY string.1 "First"> + + <!-- Second + - file + - comment --> + + <!ENTITY string.2 "Second"> + + <!-- LOCALIZATION NOTE: REMOVED STRING --> + <!ENTITY removed.1 "First removed"> + <!-- LOCALIZATION NOTE: REMOVED STRING --> + <!-- LOCALIZATION NOTE: Comment for second removed. --> + <!ENTITY removed.2 "Second removed"> + <!-- LOCALIZATION NOTE: REMOVED STRING --> + <!-- LOCALIZATION NOTE: Comment for third removed. --> + <!-- LOCALIZATION NOTE: Comment 2 for + third removed. --> + <!ENTITY removed.3 "Third removed"> + <!-- LOCALIZATION NOTE: REMOVED STRING --> + <!ENTITY removed.4 "Fourth removed"> + """, + ) ===================================== tools/torbrowser/l10n/combine/tests/test_fluent.py ===================================== @@ -0,0 +1,344 @@ +import textwrap + +from combine import combine_files + + +def assert_result(new_content, old_content, expect): + # Allow for indents to make the tests more readable. + if new_content is not None: + new_content = textwrap.dedent(new_content) + if old_content is not None: + old_content = textwrap.dedent(old_content) + if expect is not None: + expect = textwrap.dedent(expect) + assert expect == combine_files( + "test.ftl", new_content, old_content, "REMOVED STRING" + ) + + +def test_combine_empty(): + assert_result(None, None, None) + + +def test_combine_new_file(): + # New file with no old content. + assert_result( + """\ + string-1 = First + string-2 = Second + """, + None, + """\ + string-1 = First + string-2 = Second + """, + ) + + +def test_combine_removed_file(): + # Entire file was removed. + assert_result( + None, + """\ + string-1 = First + string-2 = Second + """, + """\ + + + ## REMOVED STRING + + string-1 = First + string-2 = Second + """, + ) + + +def test_no_change(): + content = """\ + string-1 = First + string-2 = Second + """ + assert_result(content, content, content) + + +def test_added_string(): + assert_result( + """\ + string-1 = First + string-new = NEW + string-2 = Second + """, + """\ + string-1 = First + string-2 = Second + """, + """\ + string-1 = First + string-new = NEW + string-2 = Second + """, + ) + + +def test_removed_string(): + assert_result( + """\ + string-1 = First + string-2 = Second + """, + """\ + string-1 = First + removed = REMOVED + string-2 = Second + """, + """\ + string-1 = First + string-2 = Second + + + ## REMOVED STRING + + removed = REMOVED + """, + ) + + +def test_removed_and_added(): + assert_result( + """\ + new-1 = New string + string-1 = + .attr = First + string-2 = Second + new-2 = + .title = New string 2 + """, + """\ + string-1 = + .attr = First + removed-1 = First removed + removed-2 = + .attr = Second removed + string-2 = Second + removed-3 = Third removed + """, + """\ + new-1 = New string + string-1 = + .attr = First + string-2 = Second + new-2 = + .title = New string 2 + + + ## REMOVED STRING + + removed-1 = First removed + removed-2 = + .attr = Second removed + removed-3 = Third removed + """, + ) + + +def test_updated(): + # String content was updated. + assert_result( + """\ + changed-string = NEW + """, + """\ + changed-string = OLD + """, + """\ + changed-string = NEW + """, + ) + + +def test_updated_comment(): + # String comment was updated. + assert_result( + """\ + # NEW + changed-string = string + """, + """\ + # OLD + changed-string = string + """, + """\ + # NEW + changed-string = string + """, + ) + # Comment added. + assert_result( + """\ + # NEW + changed-string = string + """, + """\ + changed-string = string + """, + """\ + # NEW + changed-string = string + """, + ) + # Comment removed. + assert_result( + """\ + changed-string = string + """, + """\ + # OLD + changed-string = string + """, + """\ + changed-string = string + """, + ) + + # With group comments. + assert_result( + """\ + ## GROUP NEW + + # NEW + changed-string = string + """, + """\ + ## GROUP OLD + + # OLD + changed-string = string + """, + """\ + ## GROUP NEW + + # NEW + changed-string = string + """, + ) + + +def test_reordered(): + # String was re-ordered. + assert_result( + """\ + string-1 = value + moved-string = move + """, + """\ + moved-string = move + string-1 = value + """, + """\ + string-1 = value + moved-string = move + """, + ) + + +def test_removed_string_with_comment(): + assert_result( + """\ + # Comment for first. + string-1 = First + string-2 = Second + """, + """\ + # Comment for first. + string-1 = First + # Comment for removed. + removed = REMOVED + string-2 = Second + """, + """\ + # Comment for first. + string-1 = First + string-2 = Second + + + ## REMOVED STRING + + # Comment for removed. + removed = REMOVED + """, + ) + + # Group comments are combined with the "REMOVED STRING" comments. + # If strings have no group comment, then a single "REMOVED STRING" is + # included for them. + assert_result( + """\ + ## First Group comment + + # Comment for first. + string-1 = First + + ## + + no-group = No group comment + + ## Second + ## Group comment + + string-2 = Second + """, + """\ + ## First Group comment + + # Comment for first. + string-1 = First + removed-1 = First removed + # Comment for second removed. + removed-2 = Second removed + + ## + + no-group = No group comment + removed-3 = Third removed + + ## Second + ## Group comment + + removed-4 = Fourth removed + string-2 = Second + """, + """\ + ## First Group comment + + # Comment for first. + string-1 = First + + ## + + no-group = No group comment + + ## Second + ## Group comment + + string-2 = Second + + + ## REMOVED STRING + ## First Group comment + + removed-1 = First removed + # Comment for second removed. + removed-2 = Second removed + + ## REMOVED STRING + + removed-3 = Third removed + + ## REMOVED STRING + ## Second + ## Group comment + + removed-4 = Fourth removed + """, + ) ===================================== tools/torbrowser/l10n/combine/tests/test_properties.py ===================================== @@ -0,0 +1,322 @@ +import textwrap + +from combine import combine_files + + +def assert_result(new_content, old_content, expect): + # Allow for indents to make the tests more readable. + if new_content is not None: + new_content = textwrap.dedent(new_content) + if old_content is not None: + old_content = textwrap.dedent(old_content) + if expect is not None: + expect = textwrap.dedent(expect) + assert expect == combine_files( + "test.properties", new_content, old_content, "REMOVED STRING" + ) + + +def test_combine_empty(): + assert_result(None, None, None) + + +def test_combine_new_file(): + # New file with no old content. + assert_result( + """\ + string.1 = First + string.2 = Second + """, + None, + """\ + string.1 = First + string.2 = Second + """, + ) + + +def test_combine_removed_file(): + # Entire file was removed. + assert_result( + None, + """\ + string.1 = First + string.2 = Second + """, + """\ + + # REMOVED STRING + string.1 = First + # REMOVED STRING + string.2 = Second + """, + ) + + +def test_no_change(): + content = """\ + string.1 = First + string.2 = Second + """ + assert_result(content, content, content) + + +def test_added_string(): + assert_result( + """\ + string.1 = First + string.new = NEW + string.2 = Second + """, + """\ + string.1 = First + string.2 = Second + """, + """\ + string.1 = First + string.new = NEW + string.2 = Second + """, + ) + + +def test_removed_string(): + assert_result( + """\ + string.1 = First + string.2 = Second + """, + """\ + string.1 = First + removed = REMOVED + string.2 = Second + """, + """\ + string.1 = First + string.2 = Second + + # REMOVED STRING + removed = REMOVED + """, + ) + + +def test_removed_and_added(): + assert_result( + """\ + new.1 = New string + string.1 = First + string.2 = Second + new.2 = New string 2 + """, + """\ + string.1 = First + removed.1 = First removed + removed.2 = Second removed + string.2 = Second + removed.3 = Third removed + """, + """\ + new.1 = New string + string.1 = First + string.2 = Second + new.2 = New string 2 + + # REMOVED STRING + removed.1 = First removed + # REMOVED STRING + removed.2 = Second removed + # REMOVED STRING + removed.3 = Third removed + """, + ) + + +def test_updated(): + # String content was updated. + assert_result( + """\ + changed.string = NEW + """, + """\ + changed.string = OLD + """, + """\ + changed.string = NEW + """, + ) + + +def test_updated_comment(): + # String comment was updated. + assert_result( + """\ + # NEW + changed.string = string + """, + """\ + # OLD + changed.string = string + """, + """\ + # NEW + changed.string = string + """, + ) + # Comment added. + assert_result( + """\ + # NEW + changed.string = string + """, + """\ + changed.string = string + """, + """\ + # NEW + changed.string = string + """, + ) + # Comment removed. + assert_result( + """\ + changed.string = string + """, + """\ + # OLD + changed.string = string + """, + """\ + changed.string = string + """, + ) + + # With file comments + assert_result( + """\ + # NEW file comment + + # NEW + changed.string = string + """, + """\ + # OLD file comment + + # OLD + changed.string = string + """, + """\ + # NEW file comment + + # NEW + changed.string = string + """, + ) + + +def test_reordered(): + # String was re.ordered. + assert_result( + """\ + string.1 = value + moved.string = move + """, + """\ + moved.string = move + string.1 = value + """, + """\ + string.1 = value + moved.string = move + """, + ) + + +def test_removed_string_with_comment(): + assert_result( + """\ + # Comment for first. + string.1 = First + string.2 = Second + """, + """\ + # Comment for first. + string.1 = First + # Comment for removed. + removed = REMOVED + string.2 = Second + """, + """\ + # Comment for first. + string.1 = First + string.2 = Second + + # REMOVED STRING + # Comment for removed. + removed = REMOVED + """, + ) + + # With file comments and multi-line. + # All comments prior to a removed string are moved with it, until another + # entity or blank line is reached. + assert_result( + """\ + # First File comment + + # Comment for first. + # Comment 2 for first. + string.1 = First + + # Second + # File comment + + string.2 = Second + """, + """\ + # First File comment + + # Comment for first. + # Comment 2 for first. + string.1 = First + removed.1 = First removed + # Comment for second removed. + removed.2 = Second removed + + # Removed file comment + + # Comment 1 for third removed + # Comment 2 for third removed + removed.3 = Third removed + + # Second + # File comment + + removed.4 = Fourth removed + string.2 = Second + """, + """\ + # First File comment + + # Comment for first. + # Comment 2 for first. + string.1 = First + + # Second + # File comment + + string.2 = Second + + # REMOVED STRING + removed.1 = First removed + # REMOVED STRING + # Comment for second removed. + removed.2 = Second removed + # REMOVED STRING + # Comment 1 for third removed + # Comment 2 for third removed + removed.3 = Third removed + # REMOVED STRING + removed.4 = Fourth removed + """, + ) ===================================== tools/torbrowser/migrate_l10n.py → tools/torbrowser/l10n/migrate.py ===================================== ===================================== tools/torbrowser/l10n/migrations/__init__.py ===================================== ===================================== tools/torbrowser/l10n_migrations/bug-41333-new-about-tor.py → tools/torbrowser/l10n/migrations/bug-41333-new-about-tor.py ===================================== View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/a014a0… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/a014a0… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/mullvad-browser][mullvad-browser-115.8.0esr-13.5-1] Bug 42438: Tweaks to the migration wizard.
by Pier Angelo Vendrame (@pierov) 07 Mar '24

07 Mar '24
Pier Angelo Vendrame pushed to branch mullvad-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser Commits: 1b9657fb by Pier Angelo Vendrame at 2024-03-07T10:46:47+01:00 Bug 42438: Tweaks to the migration wizard. Remove the items not compatible with our features (such as history) from the migration wizard. On Linux, allow to specify an alternative home directory, since we usually change $HOME in our startup script. - - - - - 2 changed files: - browser/components/migration/ChromeMigrationUtils.sys.mjs - browser/components/migration/content/migration-wizard.mjs Changes: ===================================== browser/components/migration/ChromeMigrationUtils.sys.mjs ===================================== @@ -317,7 +317,10 @@ export var ChromeMigrationUtils = { for (let subfolders of options) { let rootDir = subfolders[0]; try { - let targetPath = Services.dirsvc.get(rootDir, Ci.nsIFile).path; + let targetPath = + rootDir === "Home" && Services.env.get("BB_ORIGINAL_HOME") + ? Services.env.get("BB_ORIGINAL_HOME") + : Services.dirsvc.get(rootDir, Ci.nsIFile).path; targetPath = PathUtils.join(targetPath, ...subfolders.slice(1)); if (await IOUtils.exists(targetPath)) { return targetPath; ===================================== browser/components/migration/content/migration-wizard.mjs ===================================== @@ -416,7 +416,10 @@ export class MigrationWizard extends HTMLElement { } let key = panelItem.getAttribute("key"); - let resourceTypes = panelItem.resourceTypes; + const allowedTypes = ["BOOKMARKS"]; + let resourceTypes = panelItem.resourceTypes.filter(t => + allowedTypes.includes(t) + ); for (let child of this.#resourceTypeList.querySelectorAll( "label[data-resource-type]" View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/1b9… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/1b9… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][base-browser-115.8.0esr-13.5-1] Bug 42438: Tweaks to the migration wizard.
by Pier Angelo Vendrame (@pierov) 07 Mar '24

07 Mar '24
Pier Angelo Vendrame pushed to branch base-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: 12b60a12 by Pier Angelo Vendrame at 2024-03-07T10:46:11+01:00 Bug 42438: Tweaks to the migration wizard. Remove the items not compatible with our features (such as history) from the migration wizard. On Linux, allow to specify an alternative home directory, since we usually change $HOME in our startup script. - - - - - 2 changed files: - browser/components/migration/ChromeMigrationUtils.sys.mjs - browser/components/migration/content/migration-wizard.mjs Changes: ===================================== browser/components/migration/ChromeMigrationUtils.sys.mjs ===================================== @@ -317,7 +317,10 @@ export var ChromeMigrationUtils = { for (let subfolders of options) { let rootDir = subfolders[0]; try { - let targetPath = Services.dirsvc.get(rootDir, Ci.nsIFile).path; + let targetPath = + rootDir === "Home" && Services.env.get("BB_ORIGINAL_HOME") + ? Services.env.get("BB_ORIGINAL_HOME") + : Services.dirsvc.get(rootDir, Ci.nsIFile).path; targetPath = PathUtils.join(targetPath, ...subfolders.slice(1)); if (await IOUtils.exists(targetPath)) { return targetPath; ===================================== browser/components/migration/content/migration-wizard.mjs ===================================== @@ -416,7 +416,10 @@ export class MigrationWizard extends HTMLElement { } let key = panelItem.getAttribute("key"); - let resourceTypes = panelItem.resourceTypes; + const allowedTypes = ["BOOKMARKS"]; + let resourceTypes = panelItem.resourceTypes.filter(t => + allowedTypes.includes(t) + ); for (let child of this.#resourceTypeList.querySelectorAll( "label[data-resource-type]" View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/12b60a1… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/12b60a1… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.8.0esr-13.5-1] Bug 42438: Tweaks to the migration wizard.
by Pier Angelo Vendrame (@pierov) 07 Mar '24

07 Mar '24
Pier Angelo Vendrame pushed to branch tor-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: a014a0e0 by Pier Angelo Vendrame at 2024-03-07T10:44:55+01:00 Bug 42438: Tweaks to the migration wizard. Remove the items not compatible with our features (such as history) from the migration wizard. On Linux, allow to specify an alternative home directory, since we usually change $HOME in our startup script. - - - - - 2 changed files: - browser/components/migration/ChromeMigrationUtils.sys.mjs - browser/components/migration/content/migration-wizard.mjs Changes: ===================================== browser/components/migration/ChromeMigrationUtils.sys.mjs ===================================== @@ -317,7 +317,10 @@ export var ChromeMigrationUtils = { for (let subfolders of options) { let rootDir = subfolders[0]; try { - let targetPath = Services.dirsvc.get(rootDir, Ci.nsIFile).path; + let targetPath = + rootDir === "Home" && Services.env.get("BB_ORIGINAL_HOME") + ? Services.env.get("BB_ORIGINAL_HOME") + : Services.dirsvc.get(rootDir, Ci.nsIFile).path; targetPath = PathUtils.join(targetPath, ...subfolders.slice(1)); if (await IOUtils.exists(targetPath)) { return targetPath; ===================================== browser/components/migration/content/migration-wizard.mjs ===================================== @@ -416,7 +416,10 @@ export class MigrationWizard extends HTMLElement { } let key = panelItem.getAttribute("key"); - let resourceTypes = panelItem.resourceTypes; + const allowedTypes = ["BOOKMARKS"]; + let resourceTypes = panelItem.resourceTypes.filter(t => + allowedTypes.includes(t) + ); for (let child of this.#resourceTypeList.querySelectorAll( "label[data-resource-type]" View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/a014a0e… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/a014a0e… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser-build][main] Bug 42438 (TB): Export the original $HOME on Linux.
by Pier Angelo Vendrame (@pierov) 07 Mar '24

07 Mar '24
Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build Commits: 14d5ad27 by Pier Angelo Vendrame at 2024-03-06T18:47:08+00:00 Bug 42438 (TB): Export the original $HOME on Linux. We need it for the migration wizard (e.g., to import bookmarks). - - - - - 1 changed file: - projects/browser/RelativeLink/start-browser Changes: ===================================== projects/browser/RelativeLink/start-browser ===================================== @@ -254,6 +254,7 @@ if [ "$register_desktop_app" -eq -1 ]; then exit 0 fi +export BB_ORIGINAL_HOME="$HOME" HOME="${PWD}" export HOME View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/1… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/1… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/mullvad-browser][mullvad-browser-115.8.0esr-13.5-1] fixup! Bug 41918: Option to reuse last window size when letterboxing is enabled.
by ma1 (@ma1) 07 Mar '24

07 Mar '24
ma1 pushed to branch mullvad-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser Commits: 6da931f7 by hackademix at 2024-03-06T22:12:22+01:00 fixup! Bug 41918: Option to reuse last window size when letterboxing is enabled. Fixes typo in RFHelper.sys.mjs (Service -&gt; Services). - - - - - 1 changed file: - toolkit/components/resistfingerprinting/RFPHelper.sys.mjs Changes: ===================================== toolkit/components/resistfingerprinting/RFPHelper.sys.mjs ===================================== @@ -223,7 +223,7 @@ class _RFPHelper { _handlePrefChanged(data) { switch (data) { case kPrefResistFingerprinting: - Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); + Services.prefs.clearUserPref(kPrefLetterboxingDidForceSize); this._handleResistFingerprintingChanged(); break; case kPrefSpoofEnglish: @@ -231,7 +231,7 @@ class _RFPHelper { this._handleSpoofEnglishChanged(); break; case kPrefLetterboxing: - Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); + Services.prefs.clearUserPref(kPrefLetterboxingDidForceSize); case kPrefLetterboxingVcenter: case kPrefLetterboxingGradient: this._handleLetterboxingPrefChanged(); View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/6da… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/6da… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][base-browser-115.8.0esr-13.5-1] fixup! Bug 41918: Option to reuse last window size when letterboxing is enabled.
by ma1 (@ma1) 07 Mar '24

07 Mar '24
ma1 pushed to branch base-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: 1564281f by hackademix at 2024-03-06T22:10:59+01:00 fixup! Bug 41918: Option to reuse last window size when letterboxing is enabled. Fixes typo in RFHelper.sys.mjs (Service -&gt; Services). - - - - - 1 changed file: - toolkit/components/resistfingerprinting/RFPHelper.sys.mjs Changes: ===================================== toolkit/components/resistfingerprinting/RFPHelper.sys.mjs ===================================== @@ -223,7 +223,7 @@ class _RFPHelper { _handlePrefChanged(data) { switch (data) { case kPrefResistFingerprinting: - Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); + Services.prefs.clearUserPref(kPrefLetterboxingDidForceSize); this._handleResistFingerprintingChanged(); break; case kPrefSpoofEnglish: @@ -231,7 +231,7 @@ class _RFPHelper { this._handleSpoofEnglishChanged(); break; case kPrefLetterboxing: - Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); + Services.prefs.clearUserPref(kPrefLetterboxingDidForceSize); case kPrefLetterboxingVcenter: case kPrefLetterboxingGradient: this._handleLetterboxingPrefChanged(); View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/1564281… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/1564281… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.8.0esr-13.5-1] fixup! Bug 41918: Option to reuse last window size when letterboxing is enabled.
by ma1 (@ma1) 07 Mar '24

07 Mar '24
ma1 pushed to branch tor-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: 03dbfffc by hackademix at 2024-03-06T22:06:28+01:00 fixup! Bug 41918: Option to reuse last window size when letterboxing is enabled. Fixes typo in RFHelper.sys.mjs (Service -&gt; Services). - - - - - 1 changed file: - toolkit/components/resistfingerprinting/RFPHelper.sys.mjs Changes: ===================================== toolkit/components/resistfingerprinting/RFPHelper.sys.mjs ===================================== @@ -223,7 +223,7 @@ class _RFPHelper { _handlePrefChanged(data) { switch (data) { case kPrefResistFingerprinting: - Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); + Services.prefs.clearUserPref(kPrefLetterboxingDidForceSize); this._handleResistFingerprintingChanged(); break; case kPrefSpoofEnglish: @@ -231,7 +231,7 @@ class _RFPHelper { this._handleSpoofEnglishChanged(); break; case kPrefLetterboxing: - Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); + Services.prefs.clearUserPref(kPrefLetterboxingDidForceSize); case kPrefLetterboxingVcenter: case kPrefLetterboxingGradient: this._handleLetterboxingPrefChanged(); View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/03dbfff… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/03dbfff… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.8.0esr-13.5-1] 3 commits: fixup! Bug 40562: Added Tor Browser preferences to 000-tor-browser.js
by richard (@richard) 06 Mar '24

06 Mar '24
richard pushed to branch tor-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: ba957be4 by Henry Wilkes at 2024-03-06T18:40:27+00:00 fixup! Bug 40562: Added Tor Browser preferences to 000-tor-browser.js Bug 42437: Drop &quot;torbrowser.version&quot; pref. - - - - - cba03e79 by Henry Wilkes at 2024-03-06T18:40:27+00:00 fixup! Bug 7494: Create local home page for TBB. Bug 42437: Drop &quot;torbrowser.version&quot; pref. - - - - - f44e1549 by Henry Wilkes at 2024-03-06T18:40:27+00:00 fixup! Bug 12620: TorBrowser regression tests Bug 42437: Drop &quot;torbrowser.version&quot; pref. - - - - - 3 changed files: - browser/app/profile/000-tor-browser.js - browser/components/abouttor/AboutTorMessage.sys.mjs - tbb-tests/browser_tor_TB4.js Changes: ===================================== browser/app/profile/000-tor-browser.js ===================================== @@ -46,8 +46,6 @@ pref("network.http.http3.enable", false); // 0 = do not use a second connection, see all.js and #7656 pref("network.http.connection-retry-timeout", 0); -#expand pref("torbrowser.version", __BASE_BROWSER_VERSION_QUOTED__); - // Tor Browser used to be compatible with non-Tor proxies. This feature is not // available anymore, but this legacy preference can be still used to disable // first-party domain circuit isolation. ===================================== browser/components/abouttor/AboutTorMessage.sys.mjs ===================================== @@ -27,7 +27,9 @@ export const AboutTorMessage = { if (Services.prefs.getBoolPref(shouldNotifyPref, false)) { Services.prefs.clearUserPref(shouldNotifyPref); return { - updateVersion: Services.prefs.getCharPref("torbrowser.version"), + updateVersion: Services.prefs.getCharPref( + "browser.startup.homepage_override.torbrowser.version" + ), updateURL: Services.prefs.getCharPref("torbrowser.post_update.url", "") || Services.urlFormatter.formatURLPref("startup.homepage_override_url"), ===================================== tbb-tests/browser_tor_TB4.js ===================================== @@ -11,9 +11,6 @@ let expectedPrefs = [ // Disable the "Refresh" prompt that is displayed for stale profiles. ["browser.disableResetPrompt", true], - - // Version placeholder - ["torbrowser.version", "dev-build"], ]; let getPref = function (prefName) { View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/12e3f7… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/12e3f7… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/mullvad-browser][mullvad-browser-115.8.0esr-13.5-1] 2 commits: fixup! MB 39: Add home page about:mullvad-browser
by richard (@richard) 06 Mar '24

06 Mar '24
richard pushed to branch mullvad-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser Commits: 17a59ab8 by Henry Wilkes at 2024-03-06T18:38:37+00:00 fixup! MB 39: Add home page about:mullvad-browser Bug 271: Show update in about:mullvad-browser - - - - - f7da4302 by Henry Wilkes at 2024-03-06T18:38:37+00:00 fixup! MB 112: Updater customization for Mullvad Browser Bug 271: Do not open update override page in a new tab, and show in about:mullvad-browser instead. - - - - - 11 changed files: - browser/components/BrowserContentHandler.sys.mjs - browser/components/BrowserGlue.sys.mjs - + browser/components/mullvad-browser/AboutMullvadBrowserChild.sys.mjs - + browser/components/mullvad-browser/AboutMullvadBrowserParent.sys.mjs - + browser/components/mullvad-browser/content/2728-sparkles.svg - browser/components/mullvad-browser/content/aboutMullvadBrowser.css - + browser/components/mullvad-browser/content/aboutMullvadBrowser.js - browser/components/mullvad-browser/content/aboutMullvadBrowser.xhtml - browser/components/mullvad-browser/jar.mn - browser/components/mullvad-browser/moz.build - browser/locales/en-US/browser/mullvad-browser/aboutMullvadBrowser.ftl Changes: ===================================== browser/components/BrowserContentHandler.sys.mjs ===================================== @@ -666,6 +666,23 @@ nsBrowserContentHandler.prototype = { } } + // Retrieve the home page early so we can compare it against + // about:mullvad-browser to decide whether or not we need an override page + // (second tab) after an update was applied. + var startPage = ""; + try { + var choice = prefb.getIntPref("browser.startup.page"); + if (choice == 1 || choice == 3) { + startPage = lazy.HomePage.get(); + } + } catch (e) { + console.error(e); + } + + if (startPage == "about:blank") { + startPage = ""; + } + var override; var overridePage = ""; var additionalPage = ""; @@ -734,6 +751,17 @@ nsBrowserContentHandler.prototype = { "%OLD_BASE_BROWSER_VERSION%", old_forkVersion ); + if (overridePage && AppConstants.BASE_BROWSER_UPDATE) { + // Mullvad Browser, copied from tor-browser: Instead of opening + // the post-update "override page" directly, we include a link in + // about:mullvad-browser. + prefb.setCharPref("mullvadbrowser.post_update.url", overridePage); + prefb.setBoolPref("mullvadbrowser.post_update.shouldNotify", true); + // If the user's homepage is about:tor, we will inform them + // about the update on that page; otherwise, we arrange to + // open about:tor in a secondary tab. + overridePage = startPage === "about:mullvad-browser" ? "" : "about:mullvad-browser"; + } break; case OVERRIDE_NEW_BUILD_ID: if (lazy.UpdateManager.readyUpdate) { @@ -806,20 +834,6 @@ nsBrowserContentHandler.prototype = { } } - var startPage = ""; - try { - var choice = prefb.getIntPref("browser.startup.page"); - if (choice == 1 || choice == 3) { - startPage = lazy.HomePage.get(); - } - } catch (e) { - console.error(e); - } - - if (startPage == "about:blank") { - startPage = ""; - } - let skipStartPage = override == OVERRIDE_NEW_PROFILE && prefb.getBoolPref("browser.startup.firstrunSkipsHomepage"); ===================================== browser/components/BrowserGlue.sys.mjs ===================================== @@ -370,6 +370,20 @@ let JSWINDOWACTORS = { matches: ["about:messagepreview", "about:messagepreview?*"], }, + AboutMullvadBrowser: { + parent: { + esModuleURI: "resource:///actors/AboutMullvadBrowserParent.sys.mjs", + }, + child: { + esModuleURI: "resource:///actors/AboutMullvadBrowserChild.sys.mjs", + events: { + DOMContentLoaded: {}, + }, + }, + + matches: ["about:mullvad-browser"], + }, + AboutPlugins: { parent: { esModuleURI: "resource:///actors/AboutPluginsParent.sys.mjs", ===================================== browser/components/mullvad-browser/AboutMullvadBrowserChild.sys.mjs ===================================== @@ -0,0 +1,14 @@ +export class AboutMullvadBrowserChild extends JSWindowActorChild { + handleEvent(event) { + switch (event.type) { + case "DOMContentLoaded": + this.sendQuery("AboutMullvadBrowser:GetUpdateData").then(data => { + const updateEvent = new this.contentWindow.CustomEvent("UpdateData", { + detail: Cu.cloneInto(data, this.contentWindow), + }); + this.contentWindow.dispatchEvent(updateEvent); + }); + break; + } + } +} ===================================== browser/components/mullvad-browser/AboutMullvadBrowserParent.sys.mjs ===================================== @@ -0,0 +1,23 @@ +export class AboutMullvadBrowserParent extends JSWindowActorParent { + receiveMessage(message) { + const shouldNotifyPref = "mullvadbrowser.post_update.shouldNotify"; + switch (message.name) { + case "AboutMullvadBrowser:GetUpdateData": + if (!Services.prefs.getBoolPref(shouldNotifyPref, false)) { + return Promise.resolve(null); + } + Services.prefs.clearUserPref(shouldNotifyPref); + return Promise.resolve({ + version: Services.prefs.getCharPref( + "browser.startup.homepage_override.mullvadbrowser.version" + ), + url: + Services.prefs.getCharPref("mullvadbrowser.post_update.url", "") || + Services.urlFormatter.formatURLPref( + "startup.homepage_override_url" + ), + }); + } + return undefined; + } +} ===================================== browser/components/mullvad-browser/content/2728-sparkles.svg ===================================== @@ -0,0 +1,3 @@ +<!-- FROM https://github.com/twitter/twemoji + - licensed under CC-BY 4.0: https://creativecommons.org/licenses/by/4.0/ --> +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#FFAC33" d="M34.347 16.893l-8.899-3.294-3.323-10.891c-.128-.42-.517-.708-.956-.708-.439 0-.828.288-.956.708l-3.322 10.891-8.9 3.294c-.393.146-.653.519-.653.938 0 .418.26.793.653.938l8.895 3.293 3.324 11.223c.126.424.516.715.959.715.442 0 .833-.291.959-.716l3.324-11.223 8.896-3.293c.391-.144.652-.518.652-.937 0-.418-.261-.792-.653-.938z"/><path fill="#FFCC4D" d="M14.347 27.894l-2.314-.856-.9-3.3c-.118-.436-.513-.738-.964-.738-.451 0-.846.302-.965.737l-.9 3.3-2.313.856c-.393.145-.653.52-.653.938 0 .418.26.793.653.938l2.301.853.907 3.622c.112.444.511.756.97.756.459 0 .858-.312.97-.757l.907-3.622 2.301-.853c.393-.144.653-.519.653-.937 0-.418-.26-.793-.653-.937zM10.009 6.231l-2.364-.875-.876-2.365c-.145-.393-.519-.653-.938-.653-.418 0-.792.26-.938.653l-.875 2.365-2.365.875c-.393.146-.653.52-.653.938 0 .418.26.793.653.938l2.365.875.875 2.365c.146.393.52.653.938.653.418 0 .792-.26.938-.653l.875-2.365 2.365-.875c.393-.146.653-.52.653-.938 0-.418-.26-.792-.653-.938z"/></svg> ===================================== browser/components/mullvad-browser/content/aboutMullvadBrowser.css ===================================== @@ -44,14 +44,14 @@ p { #header { display: grid; - grid-template-rows: auto auto; - grid-template-columns: auto; + grid-template: "heading" auto "text" auto / auto; justify-items: center; align-content: center; gap: 1.5em; } #headingContainer { + grid-area: heading; display: inline flex; flex-direction: row; white-space: nowrap; @@ -59,6 +59,32 @@ p { gap: 16px; } +#mullvad-browser-update, +#mullvad-browser-intro { + grid-area: text; +} + +body:not(.has-update) #mullvad-browser-update { + display: none; +} + +body:not(.no-update) #mullvad-browser-intro { + /* Invisible but still reserves space for when the page is initially loaded to + * prevent the Mullvad title from jumping. */ + visibility: hidden; +} + +#mullvad-browser-update-img { + height: 1em; + vertical-align: sub; + margin-inline-end: 0.3em; +} + +#mullvad-browser-update a { + /* Increase gap between the link and the rest of the text. */ + margin-inline: 0.4em; +} + #footer { padding-block: 40px; background: rgba(0, 0, 0, 0.2); ===================================== browser/components/mullvad-browser/content/aboutMullvadBrowser.js ===================================== @@ -0,0 +1,20 @@ +"use strict"; + +window.addEventListener("UpdateData", event => { + const detail = event.detail; + if (detail) { + const { url, version } = detail; + + const text = document.getElementById("mullvad-browser-update"); + document.l10n.setAttributes( + text.querySelector("span"), + "about-mullvad-browser-update-message", + { version } + ); + text.querySelector("a").href = url; + } + // Before the first call, neither the intro nor update text are shown, this + // prevents the intro text from flashing in and out when we have an update. + document.body.classList.toggle("no-update", !detail); + document.body.classList.toggle("has-update", !!detail); +}); ===================================== browser/components/mullvad-browser/content/aboutMullvadBrowser.xhtml ===================================== @@ -21,6 +21,8 @@ rel="localization" href="browser/mullvad-browser/aboutMullvadBrowser.ftl" /> + + <script src="chrome://browser/content/mullvad-browser/aboutMullvadBrowser.js"></script> </head> <body> <div id="header"> @@ -48,11 +50,22 @@ data-l10n-id="about-mullvad-browser-heading" ></h1> </div> - <p data-l10n-id="about-mullvad-browser-developed-by"> + <p + id="mullvad-browser-intro" + data-l10n-id="about-mullvad-browser-developed-by" + > <a data-l10n-name="tor-project-link" href="https://www.torproject.org"> </a> <a data-l10n-name="mullvad-vpn-link" href="https://mullvad.net"> </a> </p> + <p id="mullvad-browser-update"> + <img + id="mullvad-browser-update-img" + alt="" + src="chrome://browser/content/mullvad-browser/2728-sparkles.svg" + /> + <span><a data-l10n-name="update-link"></a></span> + </p> </div> <div id="footer"> <p data-l10n-id="about-mullvad-browser-use-vpn"> ===================================== browser/components/mullvad-browser/jar.mn ===================================== @@ -1,4 +1,6 @@ browser.jar: + content/browser/mullvad-browser/aboutMullvadBrowser.js (content/aboutMullvadBrowser.js) content/browser/mullvad-browser/aboutMullvadBrowser.xhtml (content/aboutMullvadBrowser.xhtml) content/browser/mullvad-browser/aboutMullvadBrowser.css (content/aboutMullvadBrowser.css) content/browser/mullvad-browser/mullvadBrowserFont.css (content/mullvadBrowserFont.css) + content/browser/mullvad-browser/2728-sparkles.svg (content/2728-sparkles.svg) ===================================== browser/components/mullvad-browser/moz.build ===================================== @@ -1 +1,6 @@ JAR_MANIFESTS += ["jar.mn"] + +FINAL_TARGET_FILES.actors += [ + "AboutMullvadBrowserChild.sys.mjs", + "AboutMullvadBrowserParent.sys.mjs", +] ===================================== browser/locales/en-US/browser/mullvad-browser/aboutMullvadBrowser.ftl ===================================== @@ -3,6 +3,11 @@ about-mullvad-browser-developed-by = Developed in collaboration between the <a d about-mullvad-browser-use-vpn = Get more privacy by using the browser <a data-l10n-name="with-vpn-link">with Mullvad VPN</a>. about-mullvad-browser-learn-more = Curious to learn more about the browser? <a data-l10n-name="learn-more-link">Take a dive into the mole hole</a>. +# Update message. +# <a data-l10n-name="update-link"> should contain the link text and close with </a>. +# $version (String) - The new browser version. +about-mullvad-browser-update-message = { -brand-short-name } has been updated to { $version }. <a data-l10n-name="update-link">See what’s new</a> + ## Deprecated. To be removed when 13.5 becomes stable. View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/68… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/68… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.8.0esr-13.5-1] 2 commits: fixup! Firefox preference overrides.
by Pier Angelo Vendrame (@pierov) 06 Mar '24

06 Mar '24
Pier Angelo Vendrame pushed to branch tor-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: d4310b2a by Pier Angelo Vendrame at 2024-03-06T19:22:00+01:00 fixup! Firefox preference overrides. MB 80: Allow default browser on Windows for Mullvad Browser - - - - - 12e3f725 by Pier Angelo Vendrame at 2024-03-06T19:22:09+01:00 fixup! Bug 9173: Change the default Firefox profile directory to be relative. Force `GenerateAppUserModelID` to use the profile directory in portable mode. - - - - - 2 changed files: - browser/app/profile/001-base-profile.js - widget/windows/WinTaskbar.cpp Changes: ===================================== browser/app/profile/001-base-profile.js ===================================== @@ -631,11 +631,6 @@ pref("privacy.query_stripping.strip_on_share.enabled", true); pref("dom.text-recognition.enabled", false); #ifdef XP_WIN -// prefs to disable jump-list entries in the taskbar on Windows (see bug #12885) -// this pref changes the app's set AUMID to be dependent on the profile path, rather than -// attempting to read it from the registry; this is necessary so that the file generated -// by the jumplist system can be properly deleted if it is disabled -pref("taskbar.grouping.useprofile", true); pref("browser.taskbar.lists.enabled", false); pref("browser.taskbar.lists.frequent.enabled", false); pref("browser.taskbar.lists.tasks.enabled", false); ===================================== widget/windows/WinTaskbar.cpp ===================================== @@ -209,6 +209,19 @@ bool WinTaskbar::GenerateAppUserModelID(nsAString& aAppUserModelId, // If marked as such in prefs, use a hash of the profile path for the id // instead of the install path hash setup by the installer. bool useProfile = Preferences::GetBool("taskbar.grouping.useprofile", false); + + { + // For portable mode, force the AUMID to be based on the profile directory + // instead of reading it from the registry. + bool isPortable = true; + // Do not even check if taskbar.grouping.useprofile is already true. + if (!useProfile && + NS_SUCCEEDED(gDirServiceProvider->GetIsPortableMode(&isPortable)) && + isPortable) { + useProfile = true; + } + } + if (useProfile) { nsCOMPtr<nsIFile> profileDir; NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/f4471d… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/f4471d… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][base-browser-115.8.0esr-13.5-1] 2 commits: fixup! Firefox preference overrides.
by Pier Angelo Vendrame (@pierov) 06 Mar '24

06 Mar '24
Pier Angelo Vendrame pushed to branch base-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: dc518fc9 by Pier Angelo Vendrame at 2024-03-06T19:21:22+01:00 fixup! Firefox preference overrides. MB 80: Allow default browser on Windows for Mullvad Browser - - - - - afac3196 by Pier Angelo Vendrame at 2024-03-06T19:21:32+01:00 fixup! Bug 9173: Change the default Firefox profile directory to be relative. Force `GenerateAppUserModelID` to use the profile directory in portable mode. - - - - - 2 changed files: - browser/app/profile/001-base-profile.js - widget/windows/WinTaskbar.cpp Changes: ===================================== browser/app/profile/001-base-profile.js ===================================== @@ -631,11 +631,6 @@ pref("privacy.query_stripping.strip_on_share.enabled", true); pref("dom.text-recognition.enabled", false); #ifdef XP_WIN -// prefs to disable jump-list entries in the taskbar on Windows (see bug #12885) -// this pref changes the app's set AUMID to be dependent on the profile path, rather than -// attempting to read it from the registry; this is necessary so that the file generated -// by the jumplist system can be properly deleted if it is disabled -pref("taskbar.grouping.useprofile", true); pref("browser.taskbar.lists.enabled", false); pref("browser.taskbar.lists.frequent.enabled", false); pref("browser.taskbar.lists.tasks.enabled", false); ===================================== widget/windows/WinTaskbar.cpp ===================================== @@ -209,6 +209,19 @@ bool WinTaskbar::GenerateAppUserModelID(nsAString& aAppUserModelId, // If marked as such in prefs, use a hash of the profile path for the id // instead of the install path hash setup by the installer. bool useProfile = Preferences::GetBool("taskbar.grouping.useprofile", false); + + { + // For portable mode, force the AUMID to be based on the profile directory + // instead of reading it from the registry. + bool isPortable = true; + // Do not even check if taskbar.grouping.useprofile is already true. + if (!useProfile && + NS_SUCCEEDED(gDirServiceProvider->GetIsPortableMode(&isPortable)) && + isPortable) { + useProfile = true; + } + } + if (useProfile) { nsCOMPtr<nsIFile> profileDir; NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/f3ff42… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/f3ff42… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/mullvad-browser][mullvad-browser-115.8.0esr-13.5-1] 6 commits: Revert "MB 87: Disable the default browser box on Windows and Linux"
by Pier Angelo Vendrame (@pierov) 06 Mar '24

06 Mar '24
Pier Angelo Vendrame pushed to branch mullvad-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser Commits: 8893383e by Pier Angelo Vendrame at 2024-03-06T19:18:51+01:00 Revert &quot;MB 87: Disable the default browser box on Windows and Linux&quot; This reverts commit bd64d5f09ec5cd2bab9db6fdc0ff679107b7fc4a. We are going to disable the default browser whenever we are in portable mode instead. - - - - - 757aaf94 by Pier Angelo Vendrame at 2024-03-06T19:18:53+01:00 fixup! Firefox preference overrides. MB 80: Allow default browser on Windows for Mullvad Browser - - - - - 51bf1800 by Pier Angelo Vendrame at 2024-03-06T19:18:54+01:00 fixup! Bug 9173: Change the default Firefox profile directory to be relative. Force `GenerateAppUserModelID` to use the profile directory in portable mode. - - - - - 722401c5 by Pier Angelo Vendrame at 2024-03-06T19:18:55+01:00 fixup! MB 38: Mullvad Browser configuration MB 80: Enable the default browser agent - - - - - 5eeb2ea8 by Pier Angelo Vendrame at 2024-03-06T19:18:55+01:00 MB 80: Enable Mullvad Browser as a default browser - - - - - 68744b70 by Pier Angelo Vendrame at 2024-03-06T19:18:56+01:00 fixup! MB 80: Enable Mullvad Browser as a default browser Debugging faciliites. - - - - - 14 changed files: - browser/app/profile/001-base-profile.js - browser/components/preferences/main.js - browser/components/shell/ShellService.sys.mjs - browser/components/shell/WindowsDefaultBrowser.cpp - browser/components/shell/nsWindowsShellService.cpp - browser/installer/package-manifest.in - mozconfig-windows-x86_64 - + other-licenses/nsis/Contrib/ApplicationID/Makefile - + other-licenses/nsis/Contrib/CityHash/Makefile - toolkit/mozapps/defaultagent/EventLog.h - toolkit/mozapps/defaultagent/SetDefaultBrowser.cpp - toolkit/mozapps/defaultagent/moz.build - widget/windows/WinTaskbar.cpp - widget/windows/moz.build Changes: ===================================== browser/app/profile/001-base-profile.js ===================================== @@ -629,11 +629,6 @@ pref("privacy.query_stripping.strip_on_share.enabled", true); pref("dom.text-recognition.enabled", false); #ifdef XP_WIN -// prefs to disable jump-list entries in the taskbar on Windows (see bug #12885) -// this pref changes the app's set AUMID to be dependent on the profile path, rather than -// attempting to read it from the registry; this is necessary so that the file generated -// by the jumplist system can be properly deleted if it is disabled -pref("taskbar.grouping.useprofile", true); pref("browser.taskbar.lists.enabled", false); pref("browser.taskbar.lists.frequent.enabled", false); pref("browser.taskbar.lists.tasks.enabled", false); ===================================== browser/components/preferences/main.js ===================================== @@ -1743,10 +1743,11 @@ var gMainPane = { let shellSvc = getShellService(); let defaultBrowserBox = document.getElementById("defaultBrowserBox"); let isInFlatpak = gGIOService?.isRunningUnderFlatpak; + const xreDirProvider = Cc[ + "@mozilla.org/xre/directory-provider;1" + ].getService(Ci.nsIXREDirProvider); // Flatpak does not support setting nor detection of default browser - // privacy-browser#87: Let's keep the default browser box only on macOS - // for now. - if (!shellSvc || isInFlatpak || Services.appinfo.OS !== "Darwin") { + if (!shellSvc || isInFlatpak || xreDirProvider.isPortableMode) { defaultBrowserBox.hidden = true; return; } ===================================== browser/components/shell/ShellService.sys.mjs ===================================== @@ -64,7 +64,8 @@ let ShellServiceInternal = { }, isDefaultBrowserOptOut() { - if (AppConstants.platform == "win") { + // Mozilla is also going to disable this, see Bug 1274517 and Bug 1272162. + if (AppConstants.platform == "win" && !AppConstants.BASE_BROWSER_VERSION) { let optOutValue = lazy.WindowsRegistry.readRegKey( Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, "Software\\Mozilla\\Firefox", @@ -295,7 +296,7 @@ let ShellServiceInternal = { ) { if (this._shouldSetDefaultPDFHandler()) { lazy.log.info("Setting Firefox as default PDF handler"); - exeArgs.push(".pdf", "FirefoxPDF"); + exeArgs.push(".pdf", "MullvadBrowserPDF"); } else { lazy.log.info("Not setting Firefox as default PDF handler"); } @@ -338,7 +339,7 @@ let ShellServiceInternal = { "set-default-extension-handlers-user-choice", aumi, ".pdf", - "FirefoxPDF", + "MullvadBrowserPDF", ], }); telemetryResult = "ErrOther"; ===================================== browser/components/shell/WindowsDefaultBrowser.cpp ===================================== @@ -31,7 +31,7 @@ #include <wchar.h> #include <windows.h> -#define APP_REG_NAME_BASE L"Firefox-" +#define APP_REG_NAME_BASE L"MullvadBrowser-" static bool IsWindowsLogonConnected() { WCHAR userName[UNLEN + 1]; ===================================== browser/components/shell/nsWindowsShellService.cpp ===================================== @@ -310,9 +310,11 @@ nsWindowsShellService::CheckAllProgIDsExist(bool* aResult) { return NS_OK; } *aResult = - CheckProgIDExists(FormatProgID(L"FirefoxURL", aumid.get()).get()) && - CheckProgIDExists(FormatProgID(L"FirefoxHTML", aumid.get()).get()) && - CheckProgIDExists(FormatProgID(L"FirefoxPDF", aumid.get()).get()); + CheckProgIDExists( + FormatProgID(L"MullvadBrowserURL", aumid.get()).get()) && + CheckProgIDExists( + FormatProgID(L"MullvadBrowserHTML", aumid.get()).get()) && + CheckProgIDExists(FormatProgID(L"MullvadBrowserPDF", aumid.get()).get()); return NS_OK; } ===================================== browser/installer/package-manifest.in ===================================== @@ -63,8 +63,8 @@ @RESPATH@/updater.ini #endif #ifdef MOZ_DEFAULT_BROWSER_AGENT -@RESPATH@/defaultagent.ini -@RESPATH@/defaultagent_localized.ini +; @RESPATH@/defaultagent.ini +; @RESPATH@/defaultagent_localized.ini #endif #if defined(MOZ_UPDATE_AGENT) || defined(MOZ_DEFAULT_BROWSER_AGENT) @RESPATH@/locale.ini ===================================== mozconfig-windows-x86_64 ===================================== @@ -8,7 +8,6 @@ ac_add_options --enable-strip # Bits is Background Intelligent Transfer Service ac_add_options --disable-bits-download ac_add_options --disable-maintenance-service -ac_add_options --disable-default-browser-agent # See bug #13379 ac_add_options --enable-nss-mar ===================================== other-licenses/nsis/Contrib/ApplicationID/Makefile ===================================== @@ -0,0 +1,14 @@ +CXXFLAGS=-Icityhash -DWIN32 -DNDEBUG -D_WINDOWS -D_USRDLL -DCITYHASH_EXPORTS -DUNICODE +SRCS=Set.cpp +OBJS=$(subst .cpp,.o,$(SRCS)) +LDFLAGS=-lole32 -lshlwapi -shared -Wl,--no-insert-timestamp +PLUGIN=ApplicationID.dll + +all: $(PLUGIN) + +$(PLUGIN): $(OBJS) + $(CXX) $(OBJS) $(LDFLAGS) -o $@ + llvm-strip $@ + +clean: + $(RM) $(OBJS) $(PLUGIN) ===================================== other-licenses/nsis/Contrib/CityHash/Makefile ===================================== @@ -0,0 +1,14 @@ +CXXFLAGS=-Icityhash -DWIN32 -DNDEBUG -D_WINDOWS -D_USRDLL -DCITYHASH_EXPORTS -DUNICODE +SRCS=CityHash.cpp cityhash/city.cpp +OBJS=$(subst .cpp,.o,$(SRCS)) +LDFLAGS=-shared -Wl,--no-insert-timestamp +PLUGIN=CityHash.dll + +all: $(PLUGIN) + +$(PLUGIN): $(OBJS) + $(CXX) $(OBJS) $(LDFLAGS) -o $@ + llvm-strip $@ + +clean: + $(RM) $(OBJS) $(PLUGIN) ===================================== toolkit/mozapps/defaultagent/EventLog.h ===================================== @@ -7,7 +7,7 @@ #ifndef __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__ #define __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__ -#include "mozilla/Types.h" +#include <cwchar> MOZ_BEGIN_EXTERN_C @@ -15,10 +15,21 @@ extern MOZ_EXPORT const wchar_t* gWinEventLogSourceName; MOZ_END_EXTERN_C -#include "mozilla/WindowsEventLog.h" - -#define LOG_ERROR(hr) MOZ_WIN_EVENT_LOG_ERROR(gWinEventLogSourceName, hr) -#define LOG_ERROR_MESSAGE(format, ...) \ - MOZ_WIN_EVENT_LOG_ERROR_MESSAGE(gWinEventLogSourceName, format, __VA_ARGS__) +#ifdef LOG_ERRORS_FILE +extern FILE* gLogFile; +# define LOG_ERROR(hr) \ + if (gLogFile) { \ + fprintf(gLogFile, "Error in %s:%d: 0x%X\r\n", __FILE__, __LINE__, \ + (unsigned int)hr); \ + } +# define LOG_ERROR_MESSAGE(format, ...) \ + if (gLogFile) { \ + fwprintf(gLogFile, format __VA_OPT__(, ) __VA_ARGS__); \ + fputs("\r\n", gLogFile); \ + } +#else +# define LOG_ERROR(hr) +# define LOG_ERROR_MESSAGE(format, ...) +#endif #endif // __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__ ===================================== toolkit/mozapps/defaultagent/SetDefaultBrowser.cpp ===================================== @@ -224,19 +224,19 @@ static bool VerifyUserDefault(const wchar_t* aExt, const wchar_t* aProgID) { HRESULT SetDefaultBrowserUserChoice( const wchar_t* aAumi, const wchar_t* const* aExtraFileExtensions) { - auto urlProgID = FormatProgID(L"FirefoxURL", aAumi); + auto urlProgID = FormatProgID(L"MullvadBrowserURL", aAumi); if (!CheckProgIDExists(urlProgID.get())) { LOG_ERROR_MESSAGE(L"ProgID %s not found", urlProgID.get()); return MOZ_E_NO_PROGID; } - auto htmlProgID = FormatProgID(L"FirefoxHTML", aAumi); + auto htmlProgID = FormatProgID(L"MullvadBrowserHTML", aAumi); if (!CheckProgIDExists(htmlProgID.get())) { LOG_ERROR_MESSAGE(L"ProgID %s not found", htmlProgID.get()); return MOZ_E_NO_PROGID; } - auto pdfProgID = FormatProgID(L"FirefoxPDF", aAumi); + auto pdfProgID = FormatProgID(L"MullvadBrowserPDF", aAumi); if (!CheckProgIDExists(pdfProgID.get())) { LOG_ERROR_MESSAGE(L"ProgID %s not found", pdfProgID.get()); return MOZ_E_NO_PROGID; @@ -363,3 +363,41 @@ HRESULT SetDefaultExtensionHandlersUserChoiceImpl( return S_OK; } + +#ifdef LOG_ERRORS_FILE +FILE* gLogFile; +#endif + +// Simplified version of wmain that uses only this file from main.cpp. +int wmain(int argc, wchar_t** argv) { + if (argc < 3 || !argv[1] || !argv[2]) { + return E_INVALIDARG; + } + +#ifdef LOG_ERRORS_FILE + std::unique_ptr<FILE, decltype(&fclose)> logFile(fopen(LOG_ERRORS_FILE, "a+"), + &fclose); + gLogFile = logFile.get(); +#endif + + HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED); + if (FAILED(hr)) { + LOG_ERROR(hr); + return hr; + } + const struct ComUninitializer { + ~ComUninitializer() { CoUninitialize(); } + } kCUi; + + if (!wcscmp(argv[1], L"set-default-browser-user-choice")) { + // `argv` is itself null-terminated, so we can safely pass the tail of the + // array here. + return SetDefaultBrowserUserChoice(argv[2], &argv[3]); + } else if (!wcscmp(argv[1], L"set-default-extension-handlers-user-choice")) { + // `argv` is itself null-terminated, so we can safely pass the tail of the + // array here. + return SetDefaultExtensionHandlersUserChoice(argv[2], &argv[3]); + } else { + return E_INVALIDARG; + } +} ===================================== toolkit/mozapps/defaultagent/moz.build ===================================== @@ -6,51 +6,23 @@ Program("default-browser-agent") -SPHINX_TREES["default-browser-agent"] = "docs" - -DIRS += ["rust"] - UNIFIED_SOURCES += [ "/mfbt/Poison.cpp", "/mfbt/Unused.cpp", - "Cache.cpp", - "common.cpp", - "DefaultBrowser.cpp", - "DefaultPDF.cpp", - "EventLog.cpp", - "main.cpp", - "Notification.cpp", - "Policy.cpp", - "Registry.cpp", - "RemoteSettings.cpp", - "ScheduledTask.cpp", "SetDefaultBrowser.cpp", - "Telemetry.cpp", - "UtfConvert.cpp", ] SOURCES += [ "/browser/components/shell/WindowsDefaultBrowser.cpp", "/browser/components/shell/WindowsUserChoice.cpp", "/other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp", - "/third_party/WinToast/wintoastlib.cpp", "/toolkit/mozapps/update/common/readstrings.cpp", ] -# Suppress warnings from third-party code. -SOURCES["/third_party/WinToast/wintoastlib.cpp"].flags += ["-Wno-implicit-fallthrough"] - -USE_LIBS += [ - "defaultagent-static", - "jsoncpp", -] - LOCAL_INCLUDES += [ "/browser/components/shell/", "/mfbt/", "/other-licenses/nsis/Contrib/CityHash/cityhash", - "/third_party/WinToast", - "/toolkit/components/jsoncpp/include", "/toolkit/mozapps/update/common", "/xpcom/build", ] @@ -58,20 +30,12 @@ LOCAL_INCLUDES += [ OS_LIBS += [ "advapi32", "bcrypt", - "comsupp", "crypt32", - "kernel32", "netapi32", "ole32", - "oleaut32", - "rpcrt4", "shell32", "shlwapi", - "taskschd", - "userenv", - "wininet", - "ws2_32", - "ntdll", + "uuid", ] DEFINES["NS_NO_XPCOM"] = True @@ -96,18 +60,3 @@ if CONFIG["CC_TYPE"] == "clang-cl": WIN32_EXE_LDFLAGS += ["-ENTRY:wmainCRTStartup"] else: WIN32_EXE_LDFLAGS += ["-municode"] - -GENERATED_FILES += ["defaultagent.ini"] -defaultagentini = GENERATED_FILES["defaultagent.ini"] -defaultagentini.script = "/browser/locales/generate_ini.py" -defaultagentini.inputs = [ - "defaultagent.ini", - "defaultagent_append.ini", -] -FINAL_TARGET_FILES += ["!defaultagent.ini"] - -if CONFIG["ENABLE_TESTS"]: - DIRS += ["tests/gtest"] - -with Files("**"): - BUG_COMPONENT = ("Toolkit", "Default Browser Agent") ===================================== widget/windows/WinTaskbar.cpp ===================================== @@ -209,6 +209,19 @@ bool WinTaskbar::GenerateAppUserModelID(nsAString& aAppUserModelId, // If marked as such in prefs, use a hash of the profile path for the id // instead of the install path hash setup by the installer. bool useProfile = Preferences::GetBool("taskbar.grouping.useprofile", false); + + { + // For portable mode, force the AUMID to be based on the profile directory + // instead of reading it from the registry. + bool isPortable = true; + // Do not even check if taskbar.grouping.useprofile is already true. + if (!useProfile && + NS_SUCCEEDED(gDirServiceProvider->GetIsPortableMode(&isPortable)) && + isPortable) { + useProfile = true; + } + } + if (useProfile) { nsCOMPtr<nsIFile> profileDir; NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, @@ -237,7 +250,7 @@ bool WinTaskbar::GenerateAppUserModelID(nsAString& aAppUserModelId, nsCString appName; if (appInfo && NS_SUCCEEDED(appInfo->GetName(appName))) { nsAutoString regKey; - regKey.AssignLiteral("Software\\Mozilla\\"); + regKey.AssignLiteral("Software\\" MOZ_APP_VENDOR "\\"); AppendASCIItoUTF16(appName, regKey); regKey.AppendLiteral("\\TaskBarIDs"); ===================================== widget/windows/moz.build ===================================== @@ -188,6 +188,7 @@ DEFINES["MOZ_UNICODE"] = True DEFINES["MOZ_APP_NAME"] = '"%s"' % CONFIG["MOZ_APP_NAME"] # Turn `firefox` into `Firefox`. DEFINES["MOZ_TOAST_APP_NAME"] = '"%s"' % CONFIG["MOZ_APP_NAME"].title() +DEFINES["MOZ_APP_VENDOR"] = '"%s"' % CONFIG["MOZ_APP_VENDOR"] for var in ("MOZ_ENABLE_D3D10_LAYER",): if CONFIG[var]: View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/bb… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/bb… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser-build][main] Bug 41089: Register file types in the Mullvad Browser installer.
by Pier Angelo Vendrame (@pierov) 06 Mar '24

06 Mar '24
Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build Commits: e764744f by Pier Angelo Vendrame at 2024-03-04T11:24:56+01:00 Bug 41089: Register file types in the Mullvad Browser installer. This step is needed to set Mullvad Browser as a default browser. Also, we use the same way as Firefox to identify different installs uniquely based on the hash of their installation directory. Therefore, we need to build the CityHash NSIS plugin on Firefox and consume it in browser. We do the same for the ApplicationID plugin. - - - - - 7 changed files: - projects/browser/build - projects/browser/config - projects/browser/windows-installer/browser-install.nsi - projects/browser/windows-installer/defines.nsh.in - projects/browser/windows-installer/postupdate.nsi - projects/browser/windows-installer/registry.nsh - projects/firefox/build Changes: ===================================== projects/browser/build ===================================== @@ -320,6 +320,7 @@ done [% IF c('var/mullvad-browser') -%] pushd $distdir/windows-installer + tar -xf $rootdir/[% c('input_files_by_name/firefox') %]/nsis-plugins.tar.[% c("compress_tar") %] # While Firefox re-uses the uninstaller for this, we cannot do it, because # we write the uninstaller from the installer. # Instead, we need to write an updated postupdate.exe also when updating. ===================================== projects/browser/config ===================================== @@ -124,6 +124,7 @@ input_files: - filename: 'defines.nsh' content: '[% INCLUDE "windows-installer/defines.nsh.in" %]' refresh_input: 1 + enable: '[% c("var/windows") %]' - filename: pe_checksum_fix.py enable: '[% c("var/windows") %]' # To generate a new keystore, see how-to-generate-keystore.txt ===================================== projects/browser/windows-installer/browser-install.nsi ===================================== @@ -1,5 +1,7 @@ + !addplugindir nsis-plugins !include "common.nsh" !include "registry.nsh" + !include "Win\COM.nsh" ;-------------------------------- OutFile "browser-install.exe" @@ -219,7 +221,7 @@ Section "Browser" SecBrowser ; Write the uninstaller WriteUninstaller $INSTDIR\uninstall.exe - !insertmacro UPDATE_REGISTRY + Call UpdateRegistry CreateShortCut "$SMPROGRAMS\${DISPLAY_NAME}.lnk" "$INSTDIR\${EXE_NAME}" ${If} $createDesktopShortcut == "true" @@ -238,24 +240,57 @@ FunctionEnd ;-------------------------------- ; Uninstaller + +Function un.GetPathFromString + !insertmacro GetPathFromStringImp +FunctionEnd + Section "Uninstall" + ; Currently, the uninstaller is written by the installer, only in install + ; mode, and we do not have any way to update it. + ; However, we keep postupdate.exe updated, so we can use that instead. + ExecWait '"$INSTDIR\postupdate.exe" /Uninstall' $0 + RMDir /r "$INSTDIR" DeleteRegKey HKCU "${UNINST_KEY}" - StrCpy $0 "" - ShellLink::GetShortCutTarget "$SMPROGRAMS\${DISPLAY_NAME}.lnk" - Pop $0 - ${If} $0 == "$INSTDIR\${EXE_NAME}" - Delete "$SMPROGRAMS\${DISPLAY_NAME}.lnk" - ${EndIf} + StrCpy $2 "$SMPROGRAMS\${DISPLAY_NAME}.lnk" + StrCpy $3 "" + ShellLink::GetShortCutTarget "$2" + Pop $3 + ${If} $3 == "$INSTDIR\${EXE_NAME}" + ; https://stackoverflow.com/questions/42816091/nsis-remove-pinned-icon-from-t… + !insertmacro ComHlpr_CreateInProcInstance ${CLSID_StartMenuPin} ${IID_IStartMenuPinnedList} r0 "" + ${If} $0 P<> 0 + System::Call 'SHELL32::SHCreateItemFromParsingName(ws, p0, g "${IID_IShellItem}", *p0r1)' "$2" + ${If} $1 P<> 0 + ${IStartMenuPinnedList::RemoveFromList} $0 '(r1)' + ${IUnknown::Release} $1 "" + ${EndIf} + ${IUnknown::Release} $0 "" + ${EndIf} - StrCpy $0 "" - ShellLink::GetShortCutTarget "$DESKTOP\${DISPLAY_NAME}.lnk" - Pop $0 - ${If} $0 == "$INSTDIR\${EXE_NAME}" - Delete "$DESKTOP\${DISPLAY_NAME}.lnk" + Delete "$2" ${EndIf} + FindFirst $1 $2 "$DESKTOP\*.lnk" + loop: + IfErrors end + StrCpy $0 "" + ShellLink::GetShortCutTarget "$DESKTOP\$2" + ; Do not pop, and pass the value over + Call un.GetPathFromString + Pop $0 + ${If} $0 == "$INSTDIR\${EXE_NAME}" + Delete "$DESKTOP\$2" + ${EndIf} + FindNext $1 $2 + goto loop + end: + FindClose $1 + + ${RefreshShellIcons} + ; TODO: Optionally remove profiles. ; This operation is not trivial, because it involes finding our installation ; hash, its associated default profile and making sure it is not shared with ===================================== projects/browser/windows-installer/defines.nsh.in ===================================== @@ -5,13 +5,7 @@ ; Project and display name !define PROJECT_NAME "[% c('var/Project_Name') %]" -[% IF c("var/channel") == "release" -%] - !define DISPLAY_NAME "[% c('var/Project_Name') %]" -[% ELSIF c("var/testbuild") -%] - !define DISPLAY_NAME "[% c('var/Project_Name') %] Testbuild" -[% ELSE -%] - !define DISPLAY_NAME "[% c('var/Project_Name_Channel') %]" -[% END -%] + !define DISPLAY_NAME "[% c('var/display_name') %]" !define NAME_NO_SPACES "[% c('var/ProjectName') %]" !define UPDATE_CHANNEL "[% c('var/channel') FILTER ucfirst %]" ===================================== projects/browser/windows-installer/postupdate.nsi ===================================== @@ -1,3 +1,4 @@ +!addplugindir nsis-plugins !include "FileFunc.nsh" !include "LogicLib.nsh" @@ -9,9 +10,14 @@ Icon "${ICON_NAME}" RequestExecutionLevel user Function .onInit + StrCpy $INSTDIR $EXEDIR + ${GetOptions} $CMDLINE "/Visible" $0 IfErrors 0 +2 SetSilent silent + ${GetOptions} $CMDLINE "/Uninstall" $0 + IfErrors +2 0 + Call Uninstall FunctionEnd Section PostUpdate "PostUpdate" @@ -19,10 +25,14 @@ Section PostUpdate "PostUpdate" IfFileExists $EXEDIR\system-install 0 +2 StrCpy $0 "true" ${If} $0 == "true" - StrCpy $INSTDIR $EXEDIR - !insertmacro UPDATE_REGISTRY + Call UpdateRegistry RMDir /r /REBOOTOK $EXEDIR\tobedeleted ${Else} RMDir /r $EXEDIR\tobedeleted ${EndIf} SectionEnd + +Function Uninstall + Call ClearRegistry + Quit +FunctionEnd ===================================== projects/browser/windows-installer/registry.nsh ===================================== @@ -1,6 +1,39 @@ +; Utilities to update the registry values in installs. +; Based on Firefox's NSIS scripts. +; +; 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/. + !define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME_NO_SPACES}${UPDATE_CHANNEL}" -!macro UPDATE_REGISTRY +; The only "public" functions of this file are UpdateRegistry and ClearRegistry. + +var aumid + +; Compute the AUMID we will use for our links. +; We use the same strategy as Firefox: we hash the path of the installation +; directory with CityHash64. +; See InitHashAppModelId in toolkit/mozapps/installer/windows/nsis/common.nsh. +; While we could differentiate between channels (we force one install for each +; channel), following Firefox has the advantage that we have to adapt/rework +; less stuff. +Function ComputeAumid + StrCpy $0 $INSTDIR + ; NSIS command will not convert from short form to the long one. + ; So, this is the way they suggest to get the long name in their docs. + System::Call 'kernel32::GetLongPathName(t r0, t .r1, i ${NSIS_MAX_STRLEN}) i .r2' + ${If} $2 != "error" + CityHash::GetCityHash64 $1 + Pop $aumid + ${Else} + StrCpy $aumid "error" + ${EndIf} +FunctionEnd + +; Set the installation details. +; See https://nsis.sourceforge.io/Add_uninstall_information_to_Add/Remove_Programs. +Function SetUninstallData WriteRegStr HKCU "${UNINST_KEY}" "DisplayName" "${DISPLAY_NAME}" WriteRegStr HKCU "${UNINST_KEY}" "DisplayIcon" "$\"$INSTDIR\${EXE_NAME}$\"" WriteRegStr HKCU "${UNINST_KEY}" "DisplayVersion" "${VERSION}" @@ -16,4 +49,332 @@ WriteRegStr HKCU "${UNINST_KEY}" "URLInfoAbout" "${URL_ABOUT}" WriteRegStr HKCU "${UNINST_KEY}" "URLUpdateInfo" "${URL_UPDATE}" WriteRegStr HKCU "${UNINST_KEY}" "HelpLink" "${URL_HELP}" +FunctionEnd + +; Register a certain class in the form $browserName$className-$aumid. +; The classes registered by Firefox are URL, HTML and PDF. +; The default browser agent checks them before registering anything. +; See SetDefaultBrowserUserChoice in +; toolkit/mozapps/defaultagent/SetDefaultBrowser.cpp, FormatProgID and +; CheckProgIDExists in browser/components/shell/WindowsUserChoice.cpp. +; See also AddHandlerValues in +; toolkit/mozapps/installer/windows/nsis/common.nsh. +Function RegisterClass + ; Based on Firefox's AddHandlerValues + Pop $3 ; Is this a protocol? + Pop $2 ; Icon index + Pop $1 ; Description + Pop $0 ; Class name + + StrCpy $R0 "${NAME_NO_SPACES}$0-$aumid" ; Expanded class name + StrCpy $R1 "${PROJECT_NAME} $1" ; Description with project name + StrCpy $R2 "$INSTDIR\${EXE_NAME}" ; Full path to the main executable + StrCpy $R3 "Software\Classes\$R0" ; Registry key to update + + WriteRegStr HKCU $R3 "" "$R1" + WriteRegStr HKCU $R3 "FriendlyTypeName" "$R1" + ${If} $3 == "true" + WriteRegStr HKCU $R3 "URL Protocol" "" + ${EndIf} + ; Firefox sets EditFlags only when empty + ReadRegDWORD $R4 HKCU $R3 "EditFlags" + ${If} $R4 == "" + WriteRegDWORD HKCU $R3 "EditFlags" 0x00000002 + ${EndIf} + WriteRegStr HKCU "$R3\DefaultIcon" "" "$R2,$2" + WriteRegStr HKCU "$R3\shell" "" "open" + WriteRegStr HKCU "$R3\shell\open\command" "" '"$R2" -osint -url "%1"' +FunctionEnd + +; Register all the classes we need to handle. +; See RegisterClass. +Function RegisterClasses + Push "URL" + Push "URL" + Push 1 + Push true + Call RegisterClass + + Push "HTML" + Push "HTML Document" + Push 1 + Push false + Call RegisterClass + + Push "PDF" + Push "PDF Document" + Push 5 + Push false + Call RegisterClass +FunctionEnd + +; Register the start menu entry. +; Microsoft's documentation says this is deprecated after Windows 8, however +; these entries are still visible in the settings application. +; See the SetStartMenuInternet macro in +; browser/installer/windows/nsis/shared.nsh. +; We do not add entries for features we do not support, such as the safe mode. +; Also, the functionality to hide/show shortcuts should not apply to Windows 10, +; so we did not implement that as well. +Function RegisterStartMenu + StrCpy $0 "Software\Clients\StartMenuInternet\${NAME_NO_SPACES}-$aumid" + StrCpy $1 "$INSTDIR\${EXE_NAME}" + StrCpy $2 "${NAME_NO_SPACES}-$aumid" + StrCpy $3 "${NAME_NO_SPACES}URL-$aumid" + StrCpy $4 "${NAME_NO_SPACES}HTML-$aumid" + StrCpy $5 "${NAME_NO_SPACES}PDF-$aumid" + + WriteRegStr HKCU "$0" "" "${DISPLAY_NAME}" + WriteRegStr HKCU "$0\DefaultItcon" "" "$1,0" + WriteRegStr HKCU "$0\shell\open\command" "" '"$1"' + WriteRegStr HKCU "$0\Capabilities\StartMenu" "StartMenuInternet" "$2" + ; Same as Firefox, see SetStartMenuInternet + ; URLs + WriteRegStr HKCU "$0\Capabilities\URLAssociations" "http" "$3" + WriteRegStr HKCU "$0\Capabilities\URLAssociations" "https" "$3" + ; mailto is currently unsupported, but we could enable it here, if needed. + ; WriteRegStr HKCU "$0\Capabilities\URLAssociations" "mailto" "$3" + ; No need to uninstall FTP here, since we had never installed it. + ; HTML + aumid + WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".htm" "$4" + WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".html" "$4" + WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".shtml" "$4" + WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".xht" "$4" + WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".xhtml" "$4" + WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".svg" "$4" + WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".webp" "$4" + WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".avif" "$4" + ; PDF + aumid + WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".pdf" "$5" + + WriteRegStr HKCU "Software\RegisteredApplications" "$2" "$0\Capabilities" +FunctionEnd + +; Copied from toolkit/mozapps/installer/windows/nsis/common.nsh. +; Implemented as a macro first so that we can use it both in the installer (to +; update the registry) and in the uninstaller (to check which links we have to +; remove). The macro is then expanded in an installer function, and in an +; uninstaller function, to avoid multiple copies of the same code. +!macro GetPathFromStringImp + Exch $R9 + Push $R8 + Push $R7 + + StrCpy $R7 0 ; Set the counter to 0. + + ; Handle quoted paths with arguments. + StrCpy $R8 $R9 1 ; Copy the first char. + StrCmp $R8 '"' +2 +1 ; Is it a "? + StrCmp $R8 "'" +1 +9 ; Is it a '? + StrCpy $R9 $R9 "" 1 ; Remove the first char. + IntOp $R7 $R7 + 1 ; Increment the counter. + StrCpy $R8 $R9 1 $R7 ; Starting from the counter copy the next char. + StrCmp $R8 "" end +1 ; Are there no more chars? + StrCmp $R8 '"' +2 +1 ; Is it a " char? + StrCmp $R8 "'" +1 -4 ; Is it a ' char? + StrCpy $R9 $R9 $R7 ; Copy chars up to the counter. + GoTo end + + ; Handle DefaultIcon paths. DefaultIcon paths are not quoted and end with + ; a , and a number. + IntOp $R7 $R7 - 1 ; Decrement the counter. + StrCpy $R8 $R9 1 $R7 ; Copy one char from the end minus the counter. + StrCmp $R8 '' +4 +1 ; Are there no more chars? + StrCmp $R8 ',' +1 -3 ; Is it a , char? + StrCpy $R9 $R9 $R7 ; Copy chars up to the end minus the counter. + GoTo end + + ; Handle unquoted paths with arguments. An unquoted path with arguments + ; must be an 8dot3 path. + StrCpy $R7 -1 ; Set the counter to -1 so it will start at 0. + IntOp $R7 $R7 + 1 ; Increment the counter. + StrCpy $R8 $R9 1 $R7 ; Starting from the counter copy the next char. + StrCmp $R8 "" end +1 ; Are there no more chars? + StrCmp $R8 " " +1 -3 ; Is it a space char? + StrCpy $R9 $R9 $R7 ; Copy chars up to the counter. + + end: + ClearErrors + + Pop $R7 + Pop $R8 + Exch $R9 !macroend + +Function GetPathFromString + !insertmacro GetPathFromStringImp +FunctionEnd + +; Create a Software\Classes\Applications\$exeName.exe entry, shared by all the +; installs. +; If this key has already been registered by another channel/install, we just +; make sure the open entry has the expected command line flags. +; See SetStartMenuInternet in browser/installer/windows/nsis/shared.nsh. +Function RegisterTypes + StrCpy $0 "Software\Classes\Applications\${EXE_NAME}" + StrCpy $1 "$0\shell\open\command" + StrCpy $2 "$0\SupportedTypes" + + ReadRegStr $3 HKCU "$1" "" + ${If} $3 != "" + ; If the user already has something, we just update it to make sure it + ; contains the -osint flag. This should not be a problem if we created these + ; entries, but we still check them in case they were added manually. + Push $3 + Call GetPathFromString + Pop $3 + WriteRegStr HKCU "$1" "" '"$3" -osint -url "%1"' + ${Else} + WriteRegStr HKCU "$1" "" '"$INSTDIR\${EXE_NAME}" -osint -url "%1"' + WriteRegStr HKCU "$0\DefaultIcon" "" "$INSTDIR\${EXE_NAME},1" + + ; Same as Firefox, see SetStartMenuInternet + WriteRegStr HKCU "$2" ".apng" "" + WriteRegStr HKCU "$2" ".bmp" "" + WriteRegStr HKCU "$2" ".flac" "" + WriteRegStr HKCU "$2" ".gif" "" + WriteRegStr HKCU "$2" ".htm" "" + WriteRegStr HKCU "$2" ".html" "" + WriteRegStr HKCU "$2" ".ico" "" + WriteRegStr HKCU "$2" ".jfif" "" + WriteRegStr HKCU "$2" ".jpeg" "" + WriteRegStr HKCU "$2" ".jpg" "" + WriteRegStr HKCU "$2" ".json" "" + WriteRegStr HKCU "$2" ".m4a" "" + WriteRegStr HKCU "$2" ".mp3" "" + WriteRegStr HKCU "$2" ".oga" "" + WriteRegStr HKCU "$2" ".ogg" "" + WriteRegStr HKCU "$2" ".ogv" "" + WriteRegStr HKCU "$2" ".opus" "" + WriteRegStr HKCU "$2" ".pdf" "" + WriteRegStr HKCU "$2" ".pjpeg" "" + WriteRegStr HKCU "$2" ".pjp" "" + WriteRegStr HKCU "$2" ".png" "" + WriteRegStr HKCU "$2" ".rdf" "" + WriteRegStr HKCU "$2" ".shtml" "" + WriteRegStr HKCU "$2" ".svg" "" + WriteRegStr HKCU "$2" ".webm" "" + WriteRegStr HKCU "$2" ".avif" "" + WriteRegStr HKCU "$2" ".xht" "" + WriteRegStr HKCU "$2" ".xhtml" "" + WriteRegStr HKCU "$2" ".xml" "" + ${EndIf} +FunctionEnd + +; Set the AUMID to all links pointing to our exe in a certain directory. +; See RegisterAumid. +Function RegisterAumidDirectory + Pop $0 + FindFirst $1 $2 "$0\*.lnk" + loop: + IfErrors end + ShellLink::GetShortCutTarget "$0\$2" + ; Do not pop, and pass the value over + Call GetPathFromString + Pop $3 + ${If} $3 == "$INSTDIR\${EXE_NAME}" + ApplicationID::Set "$0\$2" "$aumid" "true" + ${EndIf} + FindNext $1 $2 + goto loop + end: + FindClose $1 +FunctionEnd + +; Firefox expects the installer to write its AUMID in the registry. +; It is hardcoded to use Software\Mozilla\Firefox\TaskBarIDs, but we change it +; in widget/windows/WinTaskbar.cpp in one of our patches. +; See InitHashAppModelId in toolkit/mozapps/installer/windows/nsis/common.nsh. +; +; In addition to that, we need to associate the AUMID to every link as per +; specifications: +; https://learn.microsoft.com/en-us/windows/win32/shell/appids#application-de… +Function RegisterAumid + StrCpy $0 "Software\${APP_DIR}\${PROJECT_NAME}\TaskBarIDs" + WriteRegStr HKCU "$0" "$INSTDIR" "$aumid" + + Push $DESKTOP + Call RegisterAumidDirectory + Push "$QUICKLAUNCH\User Pinned\TaskBar" + Call RegisterAumidDirectory + Push "$QUICKLAUNCH\User Pinned\StartMenu" + Call RegisterAumidDirectory +FunctionEnd + +; Sets all the needed registry keys during an install, or run all the needed +; maintenance in the post update. +Function UpdateRegistry + Call SetUninstallData + Call ComputeAumid + ${If} $aumid != "error" + Call RegisterClasses + Call RegisterStartMenu + Call RegisterTypes + Call RegisterAumid + ${EndIf} +FunctionEnd + +;-------------------------------- +; Uninstall helper +; We do not ship an uninstaller in the updates. +; However, to be able to undo changes done during the post update step, we call +; `postupdate.exe` with the `/Uninstall`. They are implemented here. +; `postupdate.exe` always runs as it was an installer, which is the reason for +; which the following functions do not have the `un.` prefix. +; However, they have an `Un` suffix, and each `Un$function` function undoes the +; changes done by the corresponding `$function` function. + +Function UnregisterClass + Pop $0 ; Class name + StrCpy $1 "${NAME_NO_SPACES}$0-$aumid" ; Expanded class name + DeleteRegKey HKCU "Software\Classes\$1" +FunctionEnd + +Function UnregisterClasses + Push "URL" + Call UnregisterClass + Push "HTML" + Call UnregisterClass + Push "PDF" + Call UnregisterClass +FunctionEnd + +Function UnregisterStartMenu + DeleteRegValue HKCU "Software\RegisteredApplications" "${NAME_NO_SPACES}-$aumid" + DeleteRegKey HKCU "Software\Clients\StartMenuInternet\${NAME_NO_SPACES}-$aumid" +FunctionEnd + +Function UnregisterTypes + StrCpy $0 "Software\Classes\Applications\${EXE_NAME}" + StrCpy $1 "$0\shell\open\command" + ReadRegStr $2 HKCU "$1" "" + ${If} $2 != "" + Push $2 + Call GetPathFromString + Pop $3 + ; Do not do anything if we are not the installation that created the keys. + ${If} $3 == "$INSTDIR\${EXE_NAME}" + DeleteRegKey HKCU "$0" + ${EndIf} + ${EndIf} +FunctionEnd + +Function UnregisterAumid + DeleteRegValue HKCU "Software\${APP_DIR}\${PROJECT_NAME}\TaskBarIDs" "$INSTDIR" + ; No need to do anything on the links, as they will be deleted. +FunctionEnd + +; Remove all the registry changes we have done. +Function ClearRegistry + Call ComputeAumid + ${If} $aumid != "error" + ; We take for granted we do not have conflicting aumids. + Call UnregisterClasses + Call UnregisterStartMenu + Call UnregisterAumid + ${EndIf} + ; The types do not depend on the AUMID. So, even though we add them only + ; when we have an AUMID (they would be useless otherwise), we always check if + ; we should remove them. + Call UnregisterTypes +FunctionEnd ===================================== projects/firefox/build ===================================== @@ -6,7 +6,8 @@ }) %] distdir=/var/tmp/dist/[% project %] mkdir -p /var/tmp/build -mkdir -p [% dest_dir _ '/' _ c('filename') %] +[% SET out_dir = dest_dir _ '/' _ c('filename') -%] +mkdir -p [% out_dir %] [% IF c("var/windows") -%] # Setting up fxc2 @@ -276,6 +277,20 @@ cp -L obj-*/dist/bin/geckodriver* $distdir [% END -%] [% END -%] +[% IF c("var/mullvad-browser") && c("var/windows") -%] + function make_nsis_plugin { + pushd "other-licenses/nsis/Contrib/$1" + make CXX=[% c("arch") %]-w64-mingw32-clang++ + cp "$1.dll" $distdir/nsis-plugins/ + [% c("touch") %] "$distdir/nsis-plugins/$1.dll" + popd + } + + mkdir -p $distdir/nsis-plugins + make_nsis_plugin ApplicationID + make_nsis_plugin CityHash +[% END -%] + cd $distdir [% IF c("var/linux") -%] @@ -328,7 +343,7 @@ echo "Starting to package artifacts $(date)" [% c('tar', { tar_src => [ browserdir ], - tar_args => '-caf ' _ dest_dir _ '/' _ c('filename') _ '/browser.tar.' _ c('compress_tar'), + tar_args => '-caf ' _ out_dir _ '/browser.tar.' _ c('compress_tar'), }) %] # Debug symbols @@ -339,13 +354,13 @@ echo "Starting to package artifacts $(date)" mv include [% c('var/project-name') %]/ [% c('tar', { tar_src => [ c('var/project-name') ], - tar_args => '-cJf ' _ dest_dir _ '/' _ c('filename') _ '/browser-debug-symbols.tar.xz', + tar_args => '-cJf ' _ out_dir _ '/browser-debug-symbols.tar.xz', }) %] popd [% ELSIF c("var/windows") -%] [% c('zip', { zip_src => [ 'Debug' ], - zip_args => dest_dir _ '/' _ c('filename') _ '/browser-debug-symbols.zip', + zip_args => out_dir _ '/browser-debug-symbols.zip', }) %] [% END -%] @@ -354,12 +369,12 @@ llvm-strip geckodriver* [% IF c("var/windows") -%] [% c('zip', { zip_src => [ 'geckodriver.exe' ], - zip_args => dest_dir _ '/' _ c('filename') _ '/geckodriver.zip', + zip_args => out_dir _ '/geckodriver.zip', }) %] [% ELSE -%] [% c('tar', { tar_src => [ 'geckodriver' ], - tar_args => '-cJf ' _ dest_dir _ '/' _ c('filename') _ '/geckodriver.tar.xz', + tar_args => '-cJf ' _ out_dir _ '/geckodriver.tar.xz', }) %] [% END -%] @@ -367,12 +382,19 @@ llvm-strip geckodriver* [% IF c("var/updater_enabled") -%] [% c('zip', { zip_src => [ 'mar-tools' ], - zip_args => dest_dir _ '/' _ c('filename') _ '/' _ 'mar-tools-' _ c("var/osname") _ '-' _ c("var/torbrowser_version") _ '.zip', + zip_args => out_dir _ '/' _ 'mar-tools-' _ c("var/osname") _ '-' _ c("var/torbrowser_version") _ '.zip', + }) %] +[% END -%] + +[% IF c("var/mullvad-browser") && c("var/windows") -%] + [% c('tar', { + tar_src => [ 'nsis-plugins' ], + tar_args => '-caf ' _ out_dir _ '/nsis-plugins.tar.' _ c('compress_tar'), }) %] [% END -%] [% IF c("var/build_infos_json") -%] - cat > "[% dest_dir _ '/' _ c('filename') _ '/build-infos.json' %]" << EOF_BUILDINFOS + cat > "[% out_dir _ '/build-infos.json' %]" << EOF_BUILDINFOS { "firefox_platform_version" : "[% c("var/firefox_platform_version") %]", "firefox_buildid" : "$MOZ_BUILD_DATE" View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/e… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/e… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.8.0esr-13.0-1] fixup! Add TorStrings module for localization
by Pier Angelo Vendrame (@pierov) 06 Mar '24

06 Mar '24
Pier Angelo Vendrame pushed to branch tor-browser-115.8.0esr-13.0-1 at The Tor Project / Applications / Tor Browser Commits: 572c0bd7 by Henry Wilkes at 2024-03-05T16:48:52+00:00 fixup! Add TorStrings module for localization Bug 42305: Tidy up stable strings, ready for new translation CI. Cherry-picked from Bug 42221: Remove unused strings now that 13.0 is stable. Plus removed aboutTor.dtd after Bug 41333. - - - - - 7 changed files: - toolkit/torbutton/chrome/locale/en-US/aboutTBUpdate.dtd - − toolkit/torbutton/chrome/locale/en-US/aboutTor.dtd - toolkit/torbutton/chrome/locale/en-US/settings.properties - toolkit/torbutton/chrome/locale/en-US/torConnect.properties - toolkit/torbutton/chrome/locale/en-US/torbutton.dtd - toolkit/torbutton/chrome/locale/en-US/torbutton.properties - toolkit/torbutton/chrome/locale/en-US/torlauncher.properties Changes: ===================================== toolkit/torbutton/chrome/locale/en-US/aboutTBUpdate.dtd ===================================== @@ -7,9 +7,6 @@ <!ENTITY aboutTBUpdate.version "Version"> <!ENTITY aboutTBUpdate.releaseDate "Release Date"> <!ENTITY aboutTBUpdate.releaseNotes "Release Notes"> - -<!-- TODO: Remove the entries below when 13.0 becomes stable --> -<!ENTITY aboutTBUpdate.updated "Tor Browser has been updated."> <!-- LOCALIZATION NOTE: the following entities are used to create the link to - obtain more information about the latest update. - The markup on the page looks like this: ===================================== toolkit/torbutton/chrome/locale/en-US/aboutTor.dtd deleted ===================================== @@ -1,43 +0,0 @@ -<!-- 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/. --> - - -<!-- Remove this entire file once stable reaches 13.0 --> - -<!ENTITY aboutTor.title "About Tor"> - -<!ENTITY aboutTor.viewChangelog.label "View Changelog"> - -<!ENTITY aboutTor.ready.label "Explore. Privately."> -<!ENTITY aboutTor.ready2.label "You’re ready for the world’s most private browsing experience."> -<!ENTITY aboutTor.failure.label "Something Went Wrong!"> -<!ENTITY aboutTor.failure2.label "Tor is not working in this browser."> - -<!ENTITY aboutTor.search.label "Search with DuckDuckGo"> -<!ENTITY aboutTor.searchDDGPost.link "https://duckduckgo.com"> - -<!ENTITY aboutTor.torbrowser_user_manual_questions.label "Questions?"> -<!ENTITY aboutTor.torbrowser_user_manual_link.label "Check our Tor Browser Manual »"> -<!-- The next two entities are used within the browser's Help menu. --> -<!ENTITY aboutTor.torbrowser_user_manual.accesskey "M"> -<!ENTITY aboutTor.torbrowser_user_manual.label "Tor Browser Manual"> - -<!ENTITY aboutTor.tor_mission.label "The Tor Project is a US 501(c)(3) non-profit organization advancing human rights and freedoms by creating and deploying free and open source anonymity and privacy technologies, supporting their unrestricted availability and use, and furthering their scientific and popular understanding."> -<!ENTITY aboutTor.getInvolved.label "Get Involved »"> - -<!ENTITY aboutTor.newsletter.tagline "Get the latest news from Tor straight to your inbox."> -<!ENTITY aboutTor.newsletter.link_text "Sign up for Tor News."> -<!ENTITY aboutTor.donationBanner.freeToUse "Tor is free to use because of donations from people like you."> -<!ENTITY aboutTor.donationBanner.buttonA "Donate Now"> - -<!ENTITY aboutTor.alpha.ready.label "Test. Thoroughly."> -<!ENTITY aboutTor.alpha.ready2.label "You’re ready to test the world’s most private browsing experience."> -<!ENTITY aboutTor.alpha.bannerDescription "Tor Browser Alpha is an unstable version of Tor Browser you can use to preview new features, test their performance and provide feedback before release."> -<!ENTITY aboutTor.alpha.bannerLink "Report a bug on the Tor Forum"> - -<!ENTITY aboutTor.nightly.ready.label "Test. Thoroughly."> -<!ENTITY aboutTor.nightly.ready2.label "You’re ready to test the world’s most private browsing experience."> -<!ENTITY aboutTor.nightly.bannerDescription "Tor Browser Nightly is an unstable version of Tor Browser you can use to preview new features, test their performance and provide feedback before release."> -<!ENTITY aboutTor.nightly.bannerLink "Report a bug on the Tor Forum"> ===================================== toolkit/torbutton/chrome/locale/en-US/settings.properties ===================================== @@ -26,8 +26,6 @@ settings.quickstartCheckbox=Always connect automatically # Bridge settings settings.bridgesHeading=Bridges -# Old description used up to 12.0 - TODO: remove when 12.5 becomes stable: -settings.bridgesDescription=Bridges help you access the Tor Network in places where Tor is blocked. Depending on where you are, one bridge may work better than another. settings.bridgesDescription2=Bridges help you securely access the Tor Network in places where Tor is blocked. Depending on where you are, one bridge may work better than another. settings.bridgeLocation=Your location settings.bridgeLocationAutomatic=Automatic @@ -88,15 +86,6 @@ settings.builtinBridgeMeekAzureDescription2=Makes it look like you’re connecte settings.bridgeButtonConnect=Connect settings.bridgeButtonAccept=OK -# Old dialog strings used up to 12.0 - TODO: remove when 12.5 becomes stable: -settings.builtinBridgeTitle=Built-In Bridges -settings.builtinBridgeDescription=Tor Browser includes some specific types of bridges known as “pluggable transports”. -settings.builtinBridgeObfs4=obfs4 -settings.builtinBridgeObfs4Description=obfs4 is a type of built-in bridge that makes your Tor traffic look random. They are also less likely to be blocked than their predecessors, obfs3 bridges. -settings.builtinBridgeSnowflakeDescription=Snowflake is a built-in bridge that defeats censorship by routing your connection through Snowflake proxies, ran by volunteers. -settings.builtinBridgeMeekAzureDescription=meek-azure is a built-in bridge that makes it look like you are using a Microsoft web site instead of using Tor. -# end - # Request bridges dialog settings.requestBridgeDialogTitle=Request Bridge settings.submitCaptcha=Submit @@ -132,7 +121,3 @@ settings.allowedPortsPlaceholder=Comma-separated values # Log dialog settings.torLogDialogTitle=Tor Logs settings.copyLog=Copy Tor Log to Clipboard - -# Legacy strings - remove once 12.0 has gone EOL -settings.provideBridgeTitle=Provide Bridge -settings.provideBridgeHeader=Enter bridge information from a trusted source ===================================== toolkit/torbutton/chrome/locale/en-US/torConnect.properties ===================================== @@ -52,12 +52,3 @@ torConnect.autoBootstrappingFailed=Automatic configuration failed torConnect.autoBootstrappingAllFailed=None of the configurations we tried worked torConnect.cannotDetermineCountry=Unable to determine user country torConnect.noSettingsForCountry=No settings available for your location - -# Urlbar strings used up to 12.0 - TODO: remove when 12.5 becomes stable: -torConnect.torNotConnectedConcise=Not Connected -torConnect.torConnectingConcise=Connecting… -torConnect.torConnectedConcise=Connected - -# connectMessage strings used up to 12.0 - TODO: remove when 12.5 becomes stable: -torConnect.tryAgainMessage=Tor Browser has failed to establish a connection to the Tor Network -torConnect.connectMessage=Changes to Tor Settings will not take effect until you connect ===================================== toolkit/torbutton/chrome/locale/en-US/torbutton.dtd ===================================== @@ -8,9 +8,6 @@ <!ENTITY torbutton.context_menu.new_circuit_key "C"> <!ENTITY torbutton.circuit_display.title "Tor Circuit"> -<!-- Old circuit display strings used up to 12.0 - remove when 12.5 becomes - - stable. --> -<!ENTITY torbutton.circuit_display.new_circuit "New Circuit for this Site"> <!-- Onion services strings. Strings are kept here for ease of translation. --> <!ENTITY torbutton.onionServices.authPrompt.tooltip "Open onion service client authentication prompt"> ===================================== toolkit/torbutton/chrome/locale/en-US/torbutton.properties ===================================== @@ -22,25 +22,6 @@ torbutton.circuit_display.region-guard-node = %S (guard) torbutton.circuit_display.new-circuit-guard-description = Your guard node may not change torbutton.circuit_display.new-circuit-bridge-description = Your bridge may not change -# Old circuit display strings used up to 12.0 - remove when 12.5 becomes stable: -torbutton.circuit_display.relay = Relay -torbutton.circuit_display.unknown_country = Unknown country -torbutton.circuit_display.guard = Guard -torbutton.circuit_display.guard_note = Your [Guard] node may not change. -torbutton.circuit_display.learn_more = Learn more -torbutton.circuit_display.click_to_copy = Click to Copy -torbutton.circuit_display.copied = Copied! -# end - -# External app blocker strings used up to 12.0 - TODO: remove when 12.5 becomes stable: -torbutton.popup.external.title = Download an external file type? -torbutton.popup.external.app = Tor Browser cannot display this file. You will need to open it with another application.\n\n -torbutton.popup.external.note = Some types of files can cause applications to connect to the Internet without using Tor.\n\n -torbutton.popup.external.suggest = To be safe, you should only open downloaded files while offline, or use a Tor Live CD such as Tails.\n -torbutton.popup.launch = Download file -torbutton.popup.cancel = Cancel -torbutton.popup.dontask = Automatically download files from now on - # Download pane warning torbutton.download.warning.title = Be careful opening downloads # %S will be a link to the Tails operating system website. With the content given by torbutton.download.warning.tails_brand_name @@ -131,18 +112,3 @@ profileProblemTitle=%S Profile Problem profileReadOnly=You cannot run %S from a read-only file system. Please copy %S to another location before trying to use it. profileReadOnlyMac=You cannot run %S from a read-only file system. Please copy %S to your Desktop or Applications folder before trying to use it. profileAccessDenied=%S does not have permission to access the profile. Please adjust your file system permissions and try again. - -# New identity warning -torbutton.popup.no_newnym = Torbutton cannot safely give you a new identity. It does not have access to the Tor Control Port.\n\nAre you running Tor Browser Bundle? - - -## Legacy - -# Preferences for mobile: these strings are still referenced, but we should -# check whether this feature is still used -torbutton.security_settings.menu.title = Security Settings - -# The notification that appears when maximizing the browser with letterboxing disabled -# TODO: This string is not needed as of 12.5a5, and has a replacement in Base Browser! -# To be removed when 12.0 will not need new updates. -torbutton.maximize_warning = Maximizing Tor Browser can allow websites to determine your monitor size, which can be used to track you. We recommend that you leave Tor Browser windows in their original default size. ===================================== toolkit/torbutton/chrome/locale/en-US/torlauncher.properties ===================================== @@ -59,7 +59,3 @@ torlauncher.bootstrapWarning.pt_missing=missing pluggable transport torlauncher.nsresult.NS_ERROR_NET_RESET=The connection to the server was lost. torlauncher.nsresult.NS_ERROR_CONNECTION_REFUSED=Could not connect to the server. torlauncher.nsresult.NS_ERROR_PROXY_CONNECTION_REFUSED=Could not connect to the proxy. - -## 12.5-only strings that can be removed once it goes EOL. - -torlauncher.tor_controlconn_failed=Could not connect to Tor control port. View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/572c0bd… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/572c0bd… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/mullvad-browser][mullvad-browser-115.8.0esr-13.5-1] Bug 41918: Option to reuse last window size when letterboxing is enabled.
by ma1 (@ma1) 06 Mar '24

06 Mar '24
ma1 pushed to branch mullvad-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser Commits: bbf5383c by hackademix at 2024-03-06T18:20:36+01:00 Bug 41918: Option to reuse last window size when letterboxing is enabled. - - - - - 6 changed files: - browser/app/profile/001-base-profile.js - dom/base/nsContentUtils.cpp - dom/base/nsContentUtils.h - toolkit/components/resistfingerprinting/RFPHelper.sys.mjs - toolkit/components/windowwatcher/nsWindowWatcher.cpp - xpfe/appshell/AppWindow.cpp Changes: ===================================== browser/app/profile/001-base-profile.js ===================================== @@ -379,6 +379,8 @@ pref("privacy.resistFingerprinting.letterboxing", true); pref("privacy.resistFingerprinting.letterboxing.vcenter", true); // tor-browser#41917 letterboxing gradient background pref("privacy.resistFingerprinting.letterboxing.gradient", true); +// tor-browser#41918: should we reuse last window sizes if letterboxing is enabled +pref("privacy.resistFingerprinting.letterboxing.rememberSize", false); // tor-browser#41695: how many warnings we show if user closes them without restoring the window size pref("privacy.resistFingerprinting.resizeWarnings", 3); // tor-browser#33282: new windows start at 1400x900 when there's enough screen space, otherwise down by 200x100 blocks ===================================== dom/base/nsContentUtils.cpp ===================================== @@ -2663,6 +2663,18 @@ void nsContentUtils::CalcRoundedWindowSizeForResistingFingerprinting( *aOutputHeight = resultHeight; } +bool nsContentUtils::ShouldRoundWindowSizeForResistingFingerprinting() { + return !( + Preferences::GetBool("privacy.resistFingerprinting.letterboxing", + false) && + // We want to round window size at least once in the browser's life time: + // AppWindow::ForceRoundedDimensions() will set this preference to true. + Preferences::GetBool( + "privacy.resistFingerprinting.letterboxing.didForceSize", false) && + Preferences::GetBool( + "privacy.resistFingerprinting.letterboxing.rememberSize", false)); +} + bool nsContentUtils::ThreadsafeIsCallerChrome() { return NS_IsMainThread() ? IsCallerChrome() : IsCurrentThreadRunningChromeWorker(); ===================================== dom/base/nsContentUtils.h ===================================== @@ -406,6 +406,10 @@ class nsContentUtils { bool aSetOuterWidth, bool aSetOuterHeight, int32_t* aOutputWidth, int32_t* aOutputHeight); + // Tell if we actually want to round size of new windows for RFP, + // depending on letterboxing status and user's preference. + static bool ShouldRoundWindowSizeForResistingFingerprinting(); + /** * Returns the parent node of aChild crossing document boundaries, but skips * any cross-process parent frames and continues with the nearest in-process ===================================== toolkit/components/resistfingerprinting/RFPHelper.sys.mjs ===================================== @@ -18,6 +18,8 @@ const kPrefLetterboxingVcenter = "privacy.resistFingerprinting.letterboxing.vcenter"; const kPrefLetterboxingGradient = "privacy.resistFingerprinting.letterboxing.gradient"; +const kPrefLetterboxingDidForceSize = + "privacy.resistFingerprinting.letterboxing.didForceSize"; const kTopicDOMWindowOpened = "domwindowopened"; @@ -221,6 +223,7 @@ class _RFPHelper { _handlePrefChanged(data) { switch (data) { case kPrefResistFingerprinting: + Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); this._handleResistFingerprintingChanged(); break; case kPrefSpoofEnglish: @@ -228,6 +231,7 @@ class _RFPHelper { this._handleSpoofEnglishChanged(); break; case kPrefLetterboxing: + Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); case kPrefLetterboxingVcenter: case kPrefLetterboxingGradient: this._handleLetterboxingPrefChanged(); ===================================== toolkit/components/windowwatcher/nsWindowWatcher.cpp ===================================== @@ -2333,7 +2333,9 @@ static void SizeOpenedWindow(nsIDocShellTreeOwner* aTreeOwner, screenDesktopRect.Size() / screenCssToDesktopScale; if (aSizeSpec.SizeSpecified()) { - if (!nsContentUtils::ShouldResistFingerprinting()) { + if (!(nsContentUtils::ShouldResistFingerprinting() && + nsContentUtils:: + ShouldRoundWindowSizeForResistingFingerprinting())) { /* Unlike position, force size out-of-bounds check only if size actually was specified. Otherwise, intrinsically sized windows are broken. */ ===================================== xpfe/appshell/AppWindow.cpp ===================================== @@ -1123,8 +1123,9 @@ NS_IMETHODIMP AppWindow::GetAvailScreenSize(int32_t* aAvailWidth, return NS_OK; } -// Rounds window size to 1000x1000, or, if there isn't enough available -// screen space, to a multiple of 200x100. +// Rounds window size to privacy.window.maxInnerWidth x +// privacy.window.maxInnerWidth, or, if there isn't enough available screen +// space, to a multiple of 200x100. NS_IMETHODIMP AppWindow::ForceRoundedDimensions() { if (mIsHiddenWindow) { return NS_OK; @@ -1164,6 +1165,11 @@ NS_IMETHODIMP AppWindow::ForceRoundedDimensions() { SetPrimaryContentSize(targetSizeDev.width, targetSizeDev.height); + // Ensure we force initial rounded size at least once, as checked by + // nsContentUtils::ShouldRoundWindowSizeForResistingFingerprinting(). + Preferences::SetBool("privacy.resistFingerprinting.letterboxing.didForceSize", + true); + return NS_OK; } @@ -2703,7 +2709,8 @@ void AppWindow::SizeShell() { if (nsContentUtils::ShouldResistFingerprinting( "if RFP is enabled we want to round the dimensions of the new" "new pop up window regardless of their origin") && - windowType.EqualsLiteral("navigator:browser")) { + windowType.EqualsLiteral("navigator:browser") && + nsContentUtils::ShouldRoundWindowSizeForResistingFingerprinting()) { // Once we've got primary content, force dimensions. if (mPrimaryContentShell || mPrimaryBrowserParent) { ForceRoundedDimensions(); View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/bbf… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/bbf… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][base-browser-115.8.0esr-13.5-1] Bug 41918: Option to reuse last window size when letterboxing is enabled.
by ma1 (@ma1) 06 Mar '24

06 Mar '24
ma1 pushed to branch base-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: f3ff4275 by hackademix at 2024-03-06T18:18:16+01:00 Bug 41918: Option to reuse last window size when letterboxing is enabled. - - - - - 6 changed files: - browser/app/profile/001-base-profile.js - dom/base/nsContentUtils.cpp - dom/base/nsContentUtils.h - toolkit/components/resistfingerprinting/RFPHelper.sys.mjs - toolkit/components/windowwatcher/nsWindowWatcher.cpp - xpfe/appshell/AppWindow.cpp Changes: ===================================== browser/app/profile/001-base-profile.js ===================================== @@ -380,6 +380,8 @@ pref("privacy.resistFingerprinting.letterboxing", true); pref("privacy.resistFingerprinting.letterboxing.vcenter", true); // tor-browser#41917 letterboxing gradient background pref("privacy.resistFingerprinting.letterboxing.gradient", true); +// tor-browser#41918: should we reuse last window sizes if letterboxing is enabled +pref("privacy.resistFingerprinting.letterboxing.rememberSize", false); // tor-browser#41695: how many warnings we show if user closes them without restoring the window size pref("privacy.resistFingerprinting.resizeWarnings", 3); // tor-browser#33282: new windows start at 1400x900 when there's enough screen space, otherwise down by 200x100 blocks ===================================== dom/base/nsContentUtils.cpp ===================================== @@ -2663,6 +2663,18 @@ void nsContentUtils::CalcRoundedWindowSizeForResistingFingerprinting( *aOutputHeight = resultHeight; } +bool nsContentUtils::ShouldRoundWindowSizeForResistingFingerprinting() { + return !( + Preferences::GetBool("privacy.resistFingerprinting.letterboxing", + false) && + // We want to round window size at least once in the browser's life time: + // AppWindow::ForceRoundedDimensions() will set this preference to true. + Preferences::GetBool( + "privacy.resistFingerprinting.letterboxing.didForceSize", false) && + Preferences::GetBool( + "privacy.resistFingerprinting.letterboxing.rememberSize", false)); +} + bool nsContentUtils::ThreadsafeIsCallerChrome() { return NS_IsMainThread() ? IsCallerChrome() : IsCurrentThreadRunningChromeWorker(); ===================================== dom/base/nsContentUtils.h ===================================== @@ -406,6 +406,10 @@ class nsContentUtils { bool aSetOuterWidth, bool aSetOuterHeight, int32_t* aOutputWidth, int32_t* aOutputHeight); + // Tell if we actually want to round size of new windows for RFP, + // depending on letterboxing status and user's preference. + static bool ShouldRoundWindowSizeForResistingFingerprinting(); + /** * Returns the parent node of aChild crossing document boundaries, but skips * any cross-process parent frames and continues with the nearest in-process ===================================== toolkit/components/resistfingerprinting/RFPHelper.sys.mjs ===================================== @@ -18,6 +18,8 @@ const kPrefLetterboxingVcenter = "privacy.resistFingerprinting.letterboxing.vcenter"; const kPrefLetterboxingGradient = "privacy.resistFingerprinting.letterboxing.gradient"; +const kPrefLetterboxingDidForceSize = + "privacy.resistFingerprinting.letterboxing.didForceSize"; const kTopicDOMWindowOpened = "domwindowopened"; @@ -221,6 +223,7 @@ class _RFPHelper { _handlePrefChanged(data) { switch (data) { case kPrefResistFingerprinting: + Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); this._handleResistFingerprintingChanged(); break; case kPrefSpoofEnglish: @@ -228,6 +231,7 @@ class _RFPHelper { this._handleSpoofEnglishChanged(); break; case kPrefLetterboxing: + Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); case kPrefLetterboxingVcenter: case kPrefLetterboxingGradient: this._handleLetterboxingPrefChanged(); ===================================== toolkit/components/windowwatcher/nsWindowWatcher.cpp ===================================== @@ -2333,7 +2333,9 @@ static void SizeOpenedWindow(nsIDocShellTreeOwner* aTreeOwner, screenDesktopRect.Size() / screenCssToDesktopScale; if (aSizeSpec.SizeSpecified()) { - if (!nsContentUtils::ShouldResistFingerprinting()) { + if (!(nsContentUtils::ShouldResistFingerprinting() && + nsContentUtils:: + ShouldRoundWindowSizeForResistingFingerprinting())) { /* Unlike position, force size out-of-bounds check only if size actually was specified. Otherwise, intrinsically sized windows are broken. */ ===================================== xpfe/appshell/AppWindow.cpp ===================================== @@ -1123,8 +1123,9 @@ NS_IMETHODIMP AppWindow::GetAvailScreenSize(int32_t* aAvailWidth, return NS_OK; } -// Rounds window size to 1000x1000, or, if there isn't enough available -// screen space, to a multiple of 200x100. +// Rounds window size to privacy.window.maxInnerWidth x +// privacy.window.maxInnerWidth, or, if there isn't enough available screen +// space, to a multiple of 200x100. NS_IMETHODIMP AppWindow::ForceRoundedDimensions() { if (mIsHiddenWindow) { return NS_OK; @@ -1164,6 +1165,11 @@ NS_IMETHODIMP AppWindow::ForceRoundedDimensions() { SetPrimaryContentSize(targetSizeDev.width, targetSizeDev.height); + // Ensure we force initial rounded size at least once, as checked by + // nsContentUtils::ShouldRoundWindowSizeForResistingFingerprinting(). + Preferences::SetBool("privacy.resistFingerprinting.letterboxing.didForceSize", + true); + return NS_OK; } @@ -2703,7 +2709,8 @@ void AppWindow::SizeShell() { if (nsContentUtils::ShouldResistFingerprinting( "if RFP is enabled we want to round the dimensions of the new" "new pop up window regardless of their origin") && - windowType.EqualsLiteral("navigator:browser")) { + windowType.EqualsLiteral("navigator:browser") && + nsContentUtils::ShouldRoundWindowSizeForResistingFingerprinting()) { // Once we've got primary content, force dimensions. if (mPrimaryContentShell || mPrimaryBrowserParent) { ForceRoundedDimensions(); View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/f3ff427… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/f3ff427… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • ...
  • 843
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.