mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
Bug 1299445 - use distribution.ini directly to check if automigration is enabled, r=mkaply
MozReview-Commit-ID: DINI8rnyMfe --HG-- extra : rebase_source : b215ff2344417c844ffa9f73ed61de0fadf82998
This commit is contained in:
parent
8880c22504
commit
b30d0cb67b
@ -41,8 +41,28 @@ const AutoMigrate = {
|
||||
return BOOKMARKS | HISTORY | PASSWORDS;
|
||||
},
|
||||
|
||||
_checkIfEnabled() {
|
||||
let pref = Preferences.get(kAutoMigrateEnabledPref, false);
|
||||
// User-set values should take precedence:
|
||||
if (Services.prefs.prefHasUserValue(kAutoMigrateEnabledPref)) {
|
||||
return pref;
|
||||
}
|
||||
// If we're using the default value, make sure the distribution.ini
|
||||
// value is taken into account even early on startup.
|
||||
try {
|
||||
let distributionFile = Services.dirsvc.get("XREAppDist", Ci.nsIFile);
|
||||
distributionFile.append("distribution.ini");
|
||||
let parser = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].
|
||||
getService(Ci.nsIINIParserFactory).
|
||||
createINIParser(distributionFile);
|
||||
return JSON.parse(parser.getString("Preferences", kAutoMigrateEnabledPref));
|
||||
} catch (ex) { /* ignore exceptions (file doesn't exist, invalid value, etc.) */ }
|
||||
|
||||
return pref;
|
||||
},
|
||||
|
||||
init() {
|
||||
this.enabled = Preferences.get(kAutoMigrateEnabledPref, false);
|
||||
this.enabled = this._checkIfEnabled();
|
||||
if (this.enabled) {
|
||||
this.maybeInitUndoObserver();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user