mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1095231 - have migration of sync credentials do the right thing if no default profile exists. r=past
This commit is contained in:
parent
f8c8e1a738
commit
62ca404238
@ -383,13 +383,19 @@ function show(id, childId) {
|
|||||||
|
|
||||||
// Migrate sync data from the default profile to the dev-edition profile.
|
// Migrate sync data from the default profile to the dev-edition profile.
|
||||||
function migrateToDevEdition(user, urlParams) {
|
function migrateToDevEdition(user, urlParams) {
|
||||||
|
let defaultProfilePath;
|
||||||
|
try {
|
||||||
|
defaultProfilePath = window.getDefaultProfilePath();
|
||||||
|
} catch (e) {} // no default profile.
|
||||||
let migrateSyncCreds = false;
|
let migrateSyncCreds = false;
|
||||||
|
if (defaultProfilePath) {
|
||||||
try {
|
try {
|
||||||
migrateSyncCreds = Services.prefs.getBoolPref("identity.fxaccounts.migrateToDevEdition");
|
migrateSyncCreds = Services.prefs.getBoolPref("identity.fxaccounts.migrateToDevEdition");
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
}
|
||||||
if (migrateSyncCreds) {
|
if (migrateSyncCreds) {
|
||||||
Cu.import("resource://gre/modules/osfile.jsm");
|
Cu.import("resource://gre/modules/osfile.jsm");
|
||||||
let fxAccountsStorage = OS.Path.join(window.getDefaultProfilePath(), fxAccountsCommon.DEFAULT_STORAGE_FILENAME);
|
let fxAccountsStorage = OS.Path.join(defaultProfilePath, fxAccountsCommon.DEFAULT_STORAGE_FILENAME);
|
||||||
return OS.File.read(fxAccountsStorage, { encoding: "utf-8" }).then(text => {
|
return OS.File.read(fxAccountsStorage, { encoding: "utf-8" }).then(text => {
|
||||||
let accountData = JSON.parse(text).accountData;
|
let accountData = JSON.parse(text).accountData;
|
||||||
return fxAccounts.setSignedInUser(accountData);
|
return fxAccounts.setSignedInUser(accountData);
|
||||||
|
Loading…
Reference in New Issue
Block a user