Skip to content
Snippets Groups Projects
Commit a8644cd7 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

BB 42027: Base Browser migration procedures.

This commit implmenents the the Base Browser's version of _migrateUI.
parent d4a62fa5
Branches
Tags
1 merge request!1505BB/TB 43416: Rebased onto 135.0a1
......@@ -1593,6 +1593,9 @@ BrowserGlue.prototype = {
// handle any UI migration
this._migrateUI();
// Base Browser-specific version of _migrateUI.
this._migrateUIBB();
if (!Services.prefs.prefHasUserValue(PREF_PDFJS_ISDEFAULT_CACHE_STATE)) {
lazy.PdfJs.checkIsDefault(this._isNewProfile);
}
......@@ -4719,6 +4722,51 @@ BrowserGlue.prototype = {
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},
_migrateUIBB() {
// Version 1: 13.0a3. Reset layout.css.prefers-color-scheme.content-override
// for tor-browser#41739.
// Version 2: 14.0a5: Reset the privacy tracking headers preferences since
// the UI is hidden. tor-browser#42777.
// Also, do not set
// dom.security.https_only_mode_send_http_background_request in
// the security level anymore (tor-browser#42149).
// Also, reset security.xfocsp.errorReporting.automatic since we
// hid its neterror checkbox. tor-browser#42653.
// Version 3: 14.0a7: Reset general.smoothScroll. tor-browser#42070.
const MIGRATION_VERSION = 3;
const MIGRATION_PREF = "basebrowser.migration.version";
// We do not care whether this is a new or old profile, since in version 1
// we just quickly clear a user preference, which should not do anything to
// new profiles.
// Shall we ever raise the version number and have a watershed, we can add
// a check easily (any version > 0 will be an old profile).
const currentVersion = Services.prefs.getIntPref(MIGRATION_PREF, 0);
if (currentVersion < 1) {
Services.prefs.clearUserPref(
"layout.css.prefers-color-scheme.content-override"
);
}
if (currentVersion < 2) {
for (const prefName of [
"privacy.globalprivacycontrol.enabled",
"privacy.donottrackheader.enabled",
// Telemetry preference for if the user changed the value.
"privacy.globalprivacycontrol.was_ever_enabled",
// The next two preferences have no corresponding UI, but are related.
"privacy.globalprivacycontrol.functionality.enabled",
"privacy.globalprivacycontrol.pbmode.enabled",
"dom.security.https_only_mode_send_http_background_request",
"security.xfocsp.errorReporting.automatic",
]) {
Services.prefs.clearUserPref(prefName);
}
}
if (currentVersion < 3) {
Services.prefs.clearUserPref("general.smoothScroll");
}
Services.prefs.setIntPref(MIGRATION_PREF, MIGRATION_VERSION);
},
async _showUpgradeDialog() {
const data = await lazy.OnboardingMessageProvider.getUpgradeMessage();
const { gBrowser } = lazy.BrowserWindowTracker.getTopWindow();
......
......@@ -259,6 +259,8 @@ export class GeckoViewStartup {
"GeckoView:InitialForeground",
]);
this.#migratePreferences();
Services.obs.addObserver(this, "browser-idle-startup-tasks-finished");
Services.obs.addObserver(this, "handlersvc-store-initialized");
......@@ -365,6 +367,50 @@ export class GeckoViewStartup {
break;
}
}
/**
* This is the equivalent of BrowserGlue._migrateUITBB.
*/
#migratePreferences() {
const MIGRATION_VERSION = 1;
const MIGRATION_PREF = "torbrowser.migration_android.version";
// We do not have a way to check for new profiles on Android.
// However, the first version is harmless for new installs, so run it
// anyway.
const currentVersion = Services.prefs.getIntPref(MIGRATION_PREF, 0);
if (currentVersion < 1) {
// First implementation of the migration on Android (tor-browser#43124,
// 14.0a5, September 2024).
const prefToClear = [
// Old torbutton preferences not used anymore.
// Some of them should have never been set on Android, as on Android we
// force PBM... But who knows about very old profiles.
"browser.cache.disk.enable",
"places.history.enabled",
"security.nocertdb",
"permissions.memory_only",
"extensions.torbutton.loglevel",
"extensions.torbutton.logmethod",
"extensions.torbutton.pref_fixup_version",
"extensions.torbutton.resize_new_windows",
"extensions.torbutton.startup",
"extensions.torlauncher.prompt_for_locale",
"extensions.torlauncher.loglevel",
"extensions.torlauncher.logmethod",
"extensions.torlauncher.torrc_fixup_version",
// tor-browser#42149: Do not change HTTPS-Only settings in the security
// level.
"dom.security.https_only_mode_send_http_background_request",
];
for (const pref of prefToClear) {
if (Services.prefs.prefHasUserValue(pref)) {
Services.prefs.clearUserPref(pref);
}
}
}
Services.prefs.setIntPref(MIGRATION_PREF, MIGRATION_VERSION);
}
}
GeckoViewStartup.prototype.classID = Components.ID(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment