Bug 1025965 - Migrate browser.safebrowsing.enabled to browser.safebrowsing.phishing.enabled. r=paolo.mozmail

MozReview-Commit-ID: KFWofvaZuw7
This commit is contained in:
Thomas Nguyen 2016-06-23 12:25:32 +08:00
parent ffba687a20
commit 6075feb383
3 changed files with 32 additions and 3 deletions

View File

@ -1927,7 +1927,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 39;
const UI_VERSION = 40;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
let currentUIVersion;
@ -2238,6 +2238,21 @@ BrowserGlue.prototype = {
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);
}
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},

View File

@ -975,7 +975,7 @@ var BrowserApp = {
},
_migrateUI: function() {
const UI_VERSION = 2;
const UI_VERSION = 3;
let currentUIVersion = 0;
try {
currentUIVersion = Services.prefs.getIntPref("browser.migration.version");
@ -1040,6 +1040,20 @@ var BrowserApp = {
}
}
if (currentUIVersion < 3) {
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);
}
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},

View File

@ -29,7 +29,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
BrowserApp._migrateUI();
// Check that migration version increased.
is(Services.prefs.getIntPref("browser.migration.version"), 2, "found expected version");
is(Services.prefs.getIntPref("browser.migration.version"), 3, "found expected version");
// Check that user pref value was reset.
is(Services.prefs.prefHasUserValue("nglayout.debug.paint_flashing"), false, "found expected user value");