Commit 7596141c authored by Dão Gottwald's avatar Dão Gottwald
Browse files

Bug 1478041 - Remove some old UI migration steps. r=Gijs

MozReview-Commit-ID: KnCUnzZusjf

--HG--
extra : rebase_source : c176ecee67ef62a8ec56d00b1a80ef166ef31aa7
parent 7962eaca
......@@ -19,9 +19,6 @@ with Files("tests/browser/browser_bug538331.js"):
with Files("tests/browser/browser_contentpermissionprompt.js"):
BUG_COMPONENT = ("Firefox", "Site Identity and Permission Panels")
with Files("tests/unit/test_browserGlue_migration_loop_cleanup.js"):
BUG_COMPONENT = ("Firefox", "General")
with Files("tests/unit/test_distribution.js"):
BUG_COMPONENT = ("Firefox", "Distributions")
......
......@@ -1841,63 +1841,6 @@ BrowserGlue.prototype = {
let xulStore = Services.xulStore;
if (currentUIVersion < 36) {
xulStore.removeValue("chrome://passwordmgr/content/passwordManager.xul",
"passwordCol",
"hidden");
}
if (currentUIVersion < 37) {
Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
}
if (currentUIVersion < 38) {
LoginHelper.removeLegacySignonFiles();
}
if (currentUIVersion < 39) {
// Remove the 'defaultset' value for all the toolbars
let toolbars = ["nav-bar", "PersonalToolbar",
"TabsToolbar", "toolbar-menubar"];
for (let toolbarId of toolbars) {
xulStore.removeValue(BROWSER_DOCURL, toolbarId, "defaultset");
}
}
if (currentUIVersion < 40) {
const kOldSafeBrowsingPref = "browser.safebrowsing.enabled";
// Default value is set to true, a user pref means that the pref was
// set to false.
if (Services.prefs.prefHasUserValue(kOldSafeBrowsingPref) &&
!Services.prefs.getBoolPref(kOldSafeBrowsingPref)) {
Services.prefs.setBoolPref("browser.safebrowsing.phishing.enabled",
false);
// Should just remove support for the pref entirely, even if it's
// only in about:config
Services.prefs.clearUserPref(kOldSafeBrowsingPref);
}
}
if (currentUIVersion < 41) {
const Preferences = ChromeUtils.import("resource://gre/modules/Preferences.jsm", {}).Preferences;
Preferences.resetBranch("loop.");
}
if (currentUIVersion < 42) {
let backupFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
backupFile.append("tabgroups-session-backup.json");
OS.File.remove(backupFile.path, {ignoreAbsent: true}).catch(ex => Cu.reportError(ex));
}
if (currentUIVersion < 43) {
let currentTheme = Services.prefs.getCharPref("lightweightThemes.selectedThemeID", "");
if (currentTheme == "firefox-devedition@mozilla.org") {
let newTheme = Services.prefs.getCharPref("devtools.theme") == "dark" ?
"firefox-compact-dark@mozilla.org" : "firefox-compact-light@mozilla.org";
Services.prefs.setCharPref("lightweightThemes.selectedThemeID", newTheme);
}
}
if (currentUIVersion < 44) {
// Merge the various cosmetic animation prefs into one. If any were set to
// disable animations, we'll disabled cosmetic animations entirely.
......@@ -2105,10 +2048,6 @@ BrowserGlue.prototype = {
}
}
if (currentUIVersion < 60) {
// This version is superseded by version 66. See bug 1444965.
}
if (currentUIVersion < 61) {
// Remove persisted toolbarset from navigator toolbox
xulStore.removeValue(BROWSER_DOCURL, "navigator-toolbox", "toolbarset");
......
const UI_VERSION = 41;
const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
const TOPICDATA_BROWSERGLUE_TEST = "force-ui-migration";
var gBrowserGlue = Cc["@mozilla.org/browser/browserglue;1"]
.getService(Ci.nsIObserver);
Services.prefs.setIntPref("browser.migration.version", UI_VERSION - 1);
add_task(async function test_check_cleanup_loop_prefs() {
Services.prefs.setBoolPref("loop.createdRoom", true);
Services.prefs.setBoolPref("loop1.createdRoom", true);
Services.prefs.setBoolPref("loo.createdRoom", true);
// Simulate a migration.
gBrowserGlue.observe(null, TOPIC_BROWSERGLUE_TEST, TOPICDATA_BROWSERGLUE_TEST);
Assert.throws(() => Services.prefs.getBoolPref("loop.createdRoom"),
/NS_ERROR_UNEXPECTED/,
"should have cleared old loop preference 'loop.createdRoom'");
Assert.ok(Services.prefs.getBoolPref("loop1.createdRoom"),
"should have left non-loop pref 'loop1.createdRoom' untouched");
Assert.ok(Services.prefs.getBoolPref("loo.createdRoom"),
"should have left non-loop pref 'loo.createdRoom' untouched");
});
registerCleanupFunction(() => {
Services.prefs.clearUserPref("browser.migration.version");
Services.prefs.clearUserPref("loop.createdRoom");
Services.prefs.clearUserPref("loop1.createdRoom");
Services.prefs.clearUserPref("loo.createdRoom");
});
......@@ -6,7 +6,6 @@ support-files =
distribution.ini
data/engine-de-DE.xml
[test_browserGlue_migration_loop_cleanup.js]
[test_distribution.js]
[test_distribution_cachedexistence.js]
[test_browserGlue_migration_social_cleanup.js]
......
......@@ -741,33 +741,6 @@ var LoginHelper = {
return logins.map(this.vanillaObjectToLogin);
},
removeLegacySignonFiles() {
const {Constants, Path, File} = ChromeUtils.import("resource://gre/modules/osfile.jsm").OS;
const profileDir = Constants.Path.profileDir;
const defaultSignonFilePrefs = new Map([
["signon.SignonFileName", "signons.txt"],
["signon.SignonFileName2", "signons2.txt"],
["signon.SignonFileName3", "signons3.txt"]
]);
const toDeletes = new Set();
for (let [pref, val] of defaultSignonFilePrefs.entries()) {
toDeletes.add(Path.join(profileDir, val));
try {
let signonFile = Services.prefs.getCharPref(pref);
toDeletes.add(Path.join(profileDir, signonFile));
Services.prefs.clearUserPref(pref);
} catch (e) {}
}
for (let file of toDeletes) {
File.remove(file);
}
},
/**
* Returns true if the user has a master password set and false otherwise.
*/
......
/**
* Tests the LoginHelper object.
*/
"use strict";
ChromeUtils.defineModuleGetter(this, "LoginHelper",
"resource://gre/modules/LoginHelper.jsm");
async function createSignonFile(singon) {
let {file, pref} = singon;
if (pref) {
Services.prefs.setCharPref(pref, file);
}
await OS.File.writeAtomic(
OS.Path.join(OS.Constants.Path.profileDir, file), new Uint8Array(1));
}
async function isSignonClear(singon) {
const {file, pref} = singon;
const fileExists = await OS.File.exists(
OS.Path.join(OS.Constants.Path.profileDir, file));
if (pref) {
try {
Services.prefs.getCharPref(pref);
return false;
} catch (e) {}
}
return !fileExists;
}
add_task(async function test_remove_lagecy_signonfile() {
// In the last test case, signons3.txt being deleted even when
// it doesn't exist.
const signonsSettings = [[
{ file: "signons.txt" },
{ file: "signons2.txt" },
{ file: "signons3.txt" }
], [
{ file: "signons.txt", pref: "signon.SignonFileName" },
{ file: "signons2.txt", pref: "signon.SignonFileName2" },
{ file: "signons3.txt", pref: "signon.SignonFileName3" }
], [
{ file: "signons2.txt" },
{ file: "singons.txt", pref: "signon.SignonFileName" },
{ file: "customized2.txt", pref: "signon.SignonFileName2" },
{ file: "customized3.txt", pref: "signon.SignonFileName3" }
]];
for (let setting of signonsSettings) {
for (let singon of setting) {
await createSignonFile(singon);
}
LoginHelper.removeLegacySignonFiles();
for (let singon of setting) {
equal(await isSignonClear(singon), true);
}
}
});
......@@ -7,8 +7,6 @@ support-files = data/**
skip-if = os == "android"
[test_module_LoginStore.js]
skip-if = os == "android"
[test_removeLegacySignonFiles.js]
skip-if = os == "android"
# Test SQLite database backup and migration, applicable to Android only.
[test_storage_mozStorage.js]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment