mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Create a default profile for other channels, if Aurora is the first channel installed on a system (bug 1090967). r=bsmedberg,felipe
--HG-- extra : rebase_source : 3d4ed008171a3dd156d691d235d4b03b2c98d931
This commit is contained in:
parent
d5e20d5c1a
commit
3ca75d4403
@ -856,6 +856,10 @@ BrowserGlue.prototype = {
|
||||
|
||||
// All initial windows have opened.
|
||||
_onWindowsRestored: function BG__onWindowsRestored() {
|
||||
#ifdef MOZ_DEV_EDITION
|
||||
this._createExtraDefaultProfile();
|
||||
#endif
|
||||
|
||||
this._initServiceDiscovery();
|
||||
|
||||
// Show update notification, if needed.
|
||||
@ -927,6 +931,39 @@ BrowserGlue.prototype = {
|
||||
#endif
|
||||
},
|
||||
|
||||
#ifdef MOZ_DEV_EDITION
|
||||
_createExtraDefaultProfile: function () {
|
||||
// If Developer Edition is the only installed Firefox version and no other
|
||||
// profiles are present, create a second one for use by other versions.
|
||||
// This helps Firefox versions earlier than 35 avoid accidentally using the
|
||||
// unsuitable Developer Edition profile.
|
||||
let profileService = Cc["@mozilla.org/toolkit/profile-service;1"]
|
||||
.getService(Ci.nsIToolkitProfileService);
|
||||
let profileCount = profileService.profileCount;
|
||||
if (profileCount == 1 && profileService.selectedProfile.name != "default") {
|
||||
let newProfile;
|
||||
try {
|
||||
newProfile = profileService.createProfile(null, "default");
|
||||
profileService.defaultProfile = newProfile;
|
||||
profileService.flush();
|
||||
} catch (e) {
|
||||
Cu.reportError("Could not create profile 'default': " + e);
|
||||
}
|
||||
if (newProfile) {
|
||||
// We don't want a default profile with Developer Edition settings, an
|
||||
// empty profile directory will do. The profile service of the other
|
||||
// Firefox will populate it with its own stuff.
|
||||
let newProfilePath = newProfile.rootDir.path;
|
||||
OS.File.removeDir(newProfilePath).then(() => {
|
||||
return OS.File.makeDir(newProfilePath);
|
||||
}).then(null, e => {
|
||||
Cu.reportError("Could not empty profile 'default': " + e);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
#endif
|
||||
|
||||
_onQuitRequest: function BG__onQuitRequest(aCancelQuit, aQuitType) {
|
||||
// If user has already dismissed quit request, then do nothing
|
||||
if ((aCancelQuit instanceof Ci.nsISupportsPRBool) && aCancelQuit.data)
|
||||
|
Loading…
Reference in New Issue
Block a user