зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1561435 - Format toolkit/profile/, a=automatic-formatting
# ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D36058 --HG-- extra : source : fbfc0ec0d915eb554382401ed6b6f28f1d001f92
This commit is contained in:
Родитель
584e273f90
Коммит
463c2994cb
|
@ -5,8 +5,10 @@
|
|||
const C = Cc;
|
||||
const I = Ci;
|
||||
|
||||
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const ToolkitProfileService = "@mozilla.org/toolkit/profile-service;1";
|
||||
|
||||
|
@ -24,7 +26,9 @@ var gProfileDisplay;
|
|||
// Called once when the wizard is opened.
|
||||
function initWizard() {
|
||||
try {
|
||||
gProfileService = C[ToolkitProfileService].getService(I.nsIToolkitProfileService);
|
||||
gProfileService = C[ToolkitProfileService].getService(
|
||||
I.nsIToolkitProfileService
|
||||
);
|
||||
gProfileManagerBundle = document.getElementById("bundle_profileManager");
|
||||
|
||||
gDefaultProfileParent = Services.dirsvc.get("DefProfRt", I.nsIFile);
|
||||
|
@ -32,12 +36,16 @@ function initWizard() {
|
|||
// Initialize the profile location display.
|
||||
gProfileDisplay = document.getElementById("profileDisplay").firstChild;
|
||||
document.addEventListener("wizardfinish", onFinish);
|
||||
document.getElementById("explanation").addEventListener("pageshow", enableNextButton);
|
||||
document.getElementById("createProfile").addEventListener("pageshow", initSecondWizardPage);
|
||||
document
|
||||
.getElementById("explanation")
|
||||
.addEventListener("pageshow", enableNextButton);
|
||||
document
|
||||
.getElementById("createProfile")
|
||||
.addEventListener("pageshow", initSecondWizardPage);
|
||||
setDisplayToDefaultFolder();
|
||||
} catch (e) {
|
||||
window.close();
|
||||
throw (e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,23 +60,58 @@ function initSecondWizardPage() {
|
|||
}
|
||||
|
||||
const kSaltTable = [
|
||||
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n",
|
||||
"o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
|
||||
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0" ];
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"d",
|
||||
"e",
|
||||
"f",
|
||||
"g",
|
||||
"h",
|
||||
"i",
|
||||
"j",
|
||||
"k",
|
||||
"l",
|
||||
"m",
|
||||
"n",
|
||||
"o",
|
||||
"p",
|
||||
"q",
|
||||
"r",
|
||||
"s",
|
||||
"t",
|
||||
"u",
|
||||
"v",
|
||||
"w",
|
||||
"x",
|
||||
"y",
|
||||
"z",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"0",
|
||||
];
|
||||
|
||||
var kSaltString = "";
|
||||
for (var i = 0; i < 8; ++i) {
|
||||
kSaltString += kSaltTable[Math.floor(Math.random() * kSaltTable.length)];
|
||||
}
|
||||
|
||||
|
||||
function saltName(aName) {
|
||||
return kSaltString + "." + aName;
|
||||
}
|
||||
|
||||
function setDisplayToDefaultFolder() {
|
||||
var defaultProfileDir = gDefaultProfileParent.clone();
|
||||
defaultProfileDir.append(saltName(document.getElementById("profileName").value));
|
||||
defaultProfileDir.append(
|
||||
saltName(document.getElementById("profileName").value)
|
||||
);
|
||||
gProfileRoot = defaultProfileDir;
|
||||
document.getElementById("useDefault").disabled = true;
|
||||
}
|
||||
|
@ -81,9 +124,14 @@ function updateProfileDisplay() {
|
|||
function chooseProfileFolder() {
|
||||
var newProfileRoot;
|
||||
|
||||
var dirChooser = C["@mozilla.org/filepicker;1"].createInstance(I.nsIFilePicker);
|
||||
dirChooser.init(window, gProfileManagerBundle.getString("chooseFolder"),
|
||||
I.nsIFilePicker.modeGetFolder);
|
||||
var dirChooser = C["@mozilla.org/filepicker;1"].createInstance(
|
||||
I.nsIFilePicker
|
||||
);
|
||||
dirChooser.init(
|
||||
window,
|
||||
gProfileManagerBundle.getString("chooseFolder"),
|
||||
I.nsIFilePicker.modeGetFolder
|
||||
);
|
||||
dirChooser.appendFilters(I.nsIFilePicker.filterAll);
|
||||
|
||||
// default to the Profiles folder
|
||||
|
@ -94,8 +142,9 @@ function chooseProfileFolder() {
|
|||
|
||||
// Disable the "Default Folder..." button when the default profile folder
|
||||
// was selected manually in the File Picker.
|
||||
document.getElementById("useDefault").disabled =
|
||||
(newProfileRoot.parent.equals(gDefaultProfileParent));
|
||||
document.getElementById(
|
||||
"useDefault"
|
||||
).disabled = newProfileRoot.parent.equals(gDefaultProfileParent);
|
||||
|
||||
gProfileRoot = newProfileRoot;
|
||||
updateProfileDisplay();
|
||||
|
@ -113,9 +162,13 @@ function checkCurrentInput(currentInput) {
|
|||
if (!errorMessage) {
|
||||
finishText.className = "";
|
||||
if (AppConstants.platform == "macosx") {
|
||||
finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishTextMac");
|
||||
finishText.firstChild.data = gProfileManagerBundle.getString(
|
||||
"profileFinishTextMac"
|
||||
);
|
||||
} else {
|
||||
finishText.firstChild.data = gProfileManagerBundle.getString("profileFinishText");
|
||||
finishText.firstChild.data = gProfileManagerBundle.getString(
|
||||
"profileFinishText"
|
||||
);
|
||||
}
|
||||
canAdvance = true;
|
||||
} else {
|
||||
|
@ -143,16 +196,19 @@ function updateProfileName(aNewName) {
|
|||
// Returns an error message describing the error in the name or "" when it's valid.
|
||||
function checkProfileName(profileNameToCheck) {
|
||||
// Check for emtpy profile name.
|
||||
if (!/\S/.test(profileNameToCheck))
|
||||
if (!/\S/.test(profileNameToCheck)) {
|
||||
return gProfileManagerBundle.getString("profileNameEmpty");
|
||||
}
|
||||
|
||||
// Check whether all characters in the profile name are allowed.
|
||||
if (/([\\*:?<>|\/\"])/.test(profileNameToCheck))
|
||||
if (/([\\*:?<>|\/\"])/.test(profileNameToCheck)) {
|
||||
return gProfileManagerBundle.getFormattedString("invalidChar", [RegExp.$1]);
|
||||
}
|
||||
|
||||
// Check whether a profile with the same name already exists.
|
||||
if (profileExists(profileNameToCheck))
|
||||
if (profileExists(profileNameToCheck)) {
|
||||
return gProfileManagerBundle.getString("profileExists");
|
||||
}
|
||||
|
||||
// profileNameToCheck is valid.
|
||||
return "";
|
||||
|
@ -160,8 +216,9 @@ function checkProfileName(profileNameToCheck) {
|
|||
|
||||
function profileExists(aName) {
|
||||
for (let profile of gProfileService.profiles) {
|
||||
if (profile.name.toLowerCase() == aName.toLowerCase())
|
||||
if (profile.name.toLowerCase() == aName.toLowerCase()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -180,12 +237,17 @@ function onFinish(event) {
|
|||
try {
|
||||
profile = gProfileService.createProfile(gProfileRoot, profileName);
|
||||
} catch (e) {
|
||||
var profileCreationFailed =
|
||||
gProfileManagerBundle.getString("profileCreationFailed");
|
||||
var profileCreationFailedTitle =
|
||||
gProfileManagerBundle.getString("profileCreationFailedTitle");
|
||||
Services.prompt.alert(window, profileCreationFailedTitle,
|
||||
profileCreationFailed + "\n" + e);
|
||||
var profileCreationFailed = gProfileManagerBundle.getString(
|
||||
"profileCreationFailed"
|
||||
);
|
||||
var profileCreationFailedTitle = gProfileManagerBundle.getString(
|
||||
"profileCreationFailedTitle"
|
||||
);
|
||||
Services.prompt.alert(
|
||||
window,
|
||||
profileCreationFailedTitle,
|
||||
profileCreationFailed + "\n" + e
|
||||
);
|
||||
|
||||
event.preventDefault();
|
||||
return;
|
||||
|
@ -200,7 +262,9 @@ function onFinish(event) {
|
|||
// Use the newly created Profile.
|
||||
var profileLock = profile.lock(null);
|
||||
|
||||
var dialogParams = window.arguments[0].QueryInterface(I.nsIDialogParamBlock);
|
||||
var dialogParams = window.arguments[0].QueryInterface(
|
||||
I.nsIDialogParamBlock
|
||||
);
|
||||
dialogParams.objects.insertElementAt(profileLock, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
let gParams;
|
||||
|
||||
const { AppConstants } = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
|
||||
function init() {
|
||||
/*
|
||||
|
|
|
@ -4,8 +4,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const C = Cc;
|
||||
const I = Ci;
|
||||
|
@ -20,10 +22,11 @@ var gNeedsFlush = false;
|
|||
|
||||
function startup() {
|
||||
try {
|
||||
gDialogParams = window.arguments[0].
|
||||
QueryInterface(I.nsIDialogParamBlock);
|
||||
gDialogParams = window.arguments[0].QueryInterface(I.nsIDialogParamBlock);
|
||||
|
||||
gProfileService = C[ToolkitProfileService].getService(I.nsIToolkitProfileService);
|
||||
gProfileService = C[ToolkitProfileService].getService(
|
||||
I.nsIToolkitProfileService
|
||||
);
|
||||
|
||||
gProfileManagerBundle = document.getElementById("bundle_profileManager");
|
||||
gBrandBundle = document.getElementById("bundle_brand");
|
||||
|
@ -35,26 +38,34 @@ function startup() {
|
|||
for (let profile of gProfileService.profiles.entries(I.nsIToolkitProfile)) {
|
||||
var listitem = profilesElement.appendItem(profile.name, "");
|
||||
|
||||
var tooltiptext =
|
||||
gProfileManagerBundle.getFormattedString("profileTooltip", [profile.name, profile.rootDir.path]);
|
||||
var tooltiptext = gProfileManagerBundle.getFormattedString(
|
||||
"profileTooltip",
|
||||
[profile.name, profile.rootDir.path]
|
||||
);
|
||||
listitem.setAttribute("tooltiptext", tooltiptext);
|
||||
listitem.profile = profile;
|
||||
try {
|
||||
if (profile === gProfileService.defaultProfile) {
|
||||
setTimeout(function(a) {
|
||||
profilesElement.ensureElementIsVisible(a);
|
||||
profilesElement.selectItem(a);
|
||||
}, 0, listitem);
|
||||
setTimeout(
|
||||
function(a) {
|
||||
profilesElement.ensureElementIsVisible(a);
|
||||
profilesElement.selectItem(a);
|
||||
},
|
||||
0,
|
||||
listitem
|
||||
);
|
||||
}
|
||||
} catch (e) { }
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
var autoSelectLastProfile = document.getElementById("autoSelectLastProfile");
|
||||
var autoSelectLastProfile = document.getElementById(
|
||||
"autoSelectLastProfile"
|
||||
);
|
||||
autoSelectLastProfile.checked = gProfileService.startWithLastProfile;
|
||||
profilesElement.focus();
|
||||
} catch (e) {
|
||||
window.close();
|
||||
throw (e);
|
||||
throw e;
|
||||
}
|
||||
document.addEventListener("dialogaccept", acceptDialog);
|
||||
document.addEventListener("dialogcancel", exitDialog);
|
||||
|
@ -63,7 +74,10 @@ function startup() {
|
|||
function flush(cancelled) {
|
||||
updateStartupPrefs();
|
||||
|
||||
gDialogParams.SetInt(1, document.getElementById("offlineState").checked ? 1 : 0);
|
||||
gDialogParams.SetInt(
|
||||
1,
|
||||
document.getElementById("offlineState").checked ? 1 : 0
|
||||
);
|
||||
|
||||
if (gNeedsFlush) {
|
||||
try {
|
||||
|
@ -73,33 +87,53 @@ function flush(cancelled) {
|
|||
let appName = gBrandBundle.getString("brandShortName");
|
||||
|
||||
let title = gProfileManagerBundle.getString("flushFailTitle");
|
||||
let restartButton = gProfileManagerBundle.getFormattedString("flushFailRestartButton",
|
||||
[appName]);
|
||||
let restartButton = gProfileManagerBundle.getFormattedString(
|
||||
"flushFailRestartButton",
|
||||
[appName]
|
||||
);
|
||||
let exitButton = gProfileManagerBundle.getString("flushFailExitButton");
|
||||
|
||||
let message;
|
||||
if (e.result == undefined) {
|
||||
message = gProfileManagerBundle.getFormattedString("conflictMessage",
|
||||
[productName, appName]);
|
||||
message = gProfileManagerBundle.getFormattedString("conflictMessage", [
|
||||
productName,
|
||||
appName,
|
||||
]);
|
||||
} else {
|
||||
message = gProfileManagerBundle.getString("flushFailMessage");
|
||||
}
|
||||
|
||||
const PS = Ci.nsIPromptService;
|
||||
let result = Services.prompt.confirmEx(window, title, message,
|
||||
(PS.BUTTON_POS_0 * PS.BUTTON_TITLE_IS_STRING) +
|
||||
(PS.BUTTON_POS_1 * PS.BUTTON_TITLE_IS_STRING),
|
||||
restartButton, exitButton, null, null, {});
|
||||
let result = Services.prompt.confirmEx(
|
||||
window,
|
||||
title,
|
||||
message,
|
||||
PS.BUTTON_POS_0 * PS.BUTTON_TITLE_IS_STRING +
|
||||
PS.BUTTON_POS_1 * PS.BUTTON_TITLE_IS_STRING,
|
||||
restartButton,
|
||||
exitButton,
|
||||
null,
|
||||
null,
|
||||
{}
|
||||
);
|
||||
|
||||
gDialogParams.SetInt(0, result == 0 ? Ci.nsIToolkitProfileService.restart
|
||||
: Ci.nsIToolkitProfileService.exit);
|
||||
gDialogParams.SetInt(
|
||||
0,
|
||||
result == 0
|
||||
? Ci.nsIToolkitProfileService.restart
|
||||
: Ci.nsIToolkitProfileService.exit
|
||||
);
|
||||
return;
|
||||
}
|
||||
gNeedsFlush = false;
|
||||
}
|
||||
|
||||
gDialogParams.SetInt(0, cancelled ? Ci.nsIToolkitProfileService.exit
|
||||
: Ci.nsIToolkitProfileService.launchWithProfile);
|
||||
gDialogParams.SetInt(
|
||||
0,
|
||||
cancelled
|
||||
? Ci.nsIToolkitProfileService.exit
|
||||
: Ci.nsIToolkitProfileService.launchWithProfile
|
||||
);
|
||||
}
|
||||
|
||||
function acceptDialog(event) {
|
||||
|
@ -108,9 +142,13 @@ function acceptDialog(event) {
|
|||
var profilesElement = document.getElementById("profiles");
|
||||
var selectedProfile = profilesElement.selectedItem;
|
||||
if (!selectedProfile) {
|
||||
var pleaseSelectTitle = gProfileManagerBundle.getString("pleaseSelectTitle");
|
||||
var pleaseSelect =
|
||||
gProfileManagerBundle.getFormattedString("pleaseSelect", [appName]);
|
||||
var pleaseSelectTitle = gProfileManagerBundle.getString(
|
||||
"pleaseSelectTitle"
|
||||
);
|
||||
var pleaseSelect = gProfileManagerBundle.getFormattedString(
|
||||
"pleaseSelect",
|
||||
[appName]
|
||||
);
|
||||
Services.prompt.alert(window, pleaseSelectTitle, pleaseSelect);
|
||||
event.preventDefault();
|
||||
return;
|
||||
|
@ -145,28 +183,34 @@ function updateStartupPrefs() {
|
|||
|
||||
// handle key event on listboxes
|
||||
function onProfilesKey(aEvent) {
|
||||
switch ( aEvent.keyCode ) {
|
||||
case KeyEvent.DOM_VK_BACK_SPACE:
|
||||
if (AppConstants.platform != "macosx")
|
||||
switch (aEvent.keyCode) {
|
||||
case KeyEvent.DOM_VK_BACK_SPACE:
|
||||
if (AppConstants.platform != "macosx") {
|
||||
break;
|
||||
}
|
||||
case KeyEvent.DOM_VK_DELETE:
|
||||
ConfirmDelete();
|
||||
break;
|
||||
case KeyEvent.DOM_VK_F2:
|
||||
RenameProfile();
|
||||
break;
|
||||
case KeyEvent.DOM_VK_DELETE:
|
||||
ConfirmDelete();
|
||||
break;
|
||||
case KeyEvent.DOM_VK_F2:
|
||||
RenameProfile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function onProfilesDblClick(aEvent) {
|
||||
if (aEvent.target.closest("richlistitem"))
|
||||
if (aEvent.target.closest("richlistitem")) {
|
||||
document.documentElement.acceptDialog();
|
||||
}
|
||||
}
|
||||
|
||||
// invoke the createProfile Wizard
|
||||
function CreateProfileWizard() {
|
||||
window.openDialog("chrome://mozapps/content/profile/createProfileWizard.xul",
|
||||
"", "centerscreen,chrome,modal,titlebar", gProfileService);
|
||||
window.openDialog(
|
||||
"chrome://mozapps/content/profile/createProfileWizard.xul",
|
||||
"",
|
||||
"centerscreen,chrome,modal,titlebar",
|
||||
gProfileService
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,8 +221,10 @@ function CreateProfile(aProfile) {
|
|||
|
||||
var listitem = profilesElement.appendItem(aProfile.name, "");
|
||||
|
||||
var tooltiptext =
|
||||
gProfileManagerBundle.getFormattedString("profileTooltip", [aProfile.name, aProfile.rootDir.path]);
|
||||
var tooltiptext = gProfileManagerBundle.getFormattedString("profileTooltip", [
|
||||
aProfile.name,
|
||||
aProfile.rootDir.path,
|
||||
]);
|
||||
listitem.setAttribute("tooltiptext", tooltiptext);
|
||||
listitem.profile = aProfile;
|
||||
|
||||
|
@ -199,33 +245,43 @@ function RenameProfile() {
|
|||
var selectedProfile = selectedItem.profile;
|
||||
|
||||
var oldName = selectedProfile.name;
|
||||
var newName = {value: oldName};
|
||||
var newName = { value: oldName };
|
||||
|
||||
var dialogTitle = gProfileManagerBundle.getString("renameProfileTitle");
|
||||
var msg =
|
||||
gProfileManagerBundle.getFormattedString("renameProfilePrompt", [oldName]);
|
||||
var msg = gProfileManagerBundle.getFormattedString("renameProfilePrompt", [
|
||||
oldName,
|
||||
]);
|
||||
|
||||
if (Services.prompt.prompt(window, dialogTitle, msg, newName, null, {value: 0})) {
|
||||
if (
|
||||
Services.prompt.prompt(window, dialogTitle, msg, newName, null, {
|
||||
value: 0,
|
||||
})
|
||||
) {
|
||||
newName = newName.value;
|
||||
|
||||
// User hasn't changed the profile name. Treat as if cancel was pressed.
|
||||
if (newName == oldName)
|
||||
if (newName == oldName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
selectedProfile.name = newName;
|
||||
gNeedsFlush = true;
|
||||
} catch (e) {
|
||||
var alTitle = gProfileManagerBundle.getString("profileNameInvalidTitle");
|
||||
var alMsg = gProfileManagerBundle.getFormattedString("profileNameInvalid", [newName]);
|
||||
var alMsg = gProfileManagerBundle.getFormattedString(
|
||||
"profileNameInvalid",
|
||||
[newName]
|
||||
);
|
||||
Services.prompt.alert(window, alTitle, alMsg);
|
||||
return false;
|
||||
}
|
||||
|
||||
selectedItem.firstChild.setAttribute("value", newName);
|
||||
var tiptext = gProfileManagerBundle.
|
||||
getFormattedString("profileTooltip",
|
||||
[newName, selectedProfile.rootDir.path]);
|
||||
var tiptext = gProfileManagerBundle.getFormattedString("profileTooltip", [
|
||||
newName,
|
||||
selectedProfile.rootDir.path,
|
||||
]);
|
||||
selectedItem.setAttribute("tooltiptext", tiptext);
|
||||
|
||||
return true;
|
||||
|
@ -235,7 +291,7 @@ function RenameProfile() {
|
|||
}
|
||||
|
||||
function ConfirmDelete() {
|
||||
var profileList = document.getElementById( "profiles" );
|
||||
var profileList = document.getElementById("profiles");
|
||||
|
||||
var selectedItem = profileList.selectedItem;
|
||||
if (!selectedItem) {
|
||||
|
@ -247,23 +303,31 @@ function ConfirmDelete() {
|
|||
|
||||
if (selectedProfile.rootDir.exists()) {
|
||||
var dialogTitle = gProfileManagerBundle.getString("deleteTitle");
|
||||
var dialogText =
|
||||
gProfileManagerBundle.getFormattedString("deleteProfileConfirm",
|
||||
[selectedProfile.rootDir.path]);
|
||||
var dialogText = gProfileManagerBundle.getFormattedString(
|
||||
"deleteProfileConfirm",
|
||||
[selectedProfile.rootDir.path]
|
||||
);
|
||||
|
||||
var buttonPressed = Services.prompt.confirmEx(window, dialogTitle, dialogText,
|
||||
(Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) +
|
||||
(Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1) +
|
||||
(Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_2),
|
||||
gProfileManagerBundle.getString("dontDeleteFiles"),
|
||||
null,
|
||||
gProfileManagerBundle.getString("deleteFiles"),
|
||||
null, {value: 0});
|
||||
if (buttonPressed == 1)
|
||||
var buttonPressed = Services.prompt.confirmEx(
|
||||
window,
|
||||
dialogTitle,
|
||||
dialogText,
|
||||
Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0 +
|
||||
Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1 +
|
||||
Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_2,
|
||||
gProfileManagerBundle.getString("dontDeleteFiles"),
|
||||
null,
|
||||
gProfileManagerBundle.getString("deleteFiles"),
|
||||
null,
|
||||
{ value: 0 }
|
||||
);
|
||||
if (buttonPressed == 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (buttonPressed == 2)
|
||||
if (buttonPressed == 2) {
|
||||
deleteFiles = true;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -3,10 +3,16 @@
|
|||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
const { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
|
||||
const { FileUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/FileUtils.jsm"
|
||||
);
|
||||
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||
const { AppConstants } = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
const { TelemetryTestUtils } = ChromeUtils.import("resource://testing-common/TelemetryTestUtils.jsm");
|
||||
const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
const { TelemetryTestUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/TelemetryTestUtils.jsm"
|
||||
);
|
||||
|
||||
const NS_ERROR_START_PROFILE_MANAGER = 0x805800c9;
|
||||
|
||||
|
@ -20,8 +26,9 @@ let gDataHomeLocal = gProfD.clone();
|
|||
gDataHomeLocal.append("local");
|
||||
gDataHomeLocal.createUnique(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
|
||||
|
||||
let xreDirProvider = Cc["@mozilla.org/xre/directory-provider;1"].
|
||||
getService(Ci.nsIXREDirProvider);
|
||||
let xreDirProvider = Cc["@mozilla.org/xre/directory-provider;1"].getService(
|
||||
Ci.nsIXREDirProvider
|
||||
);
|
||||
xreDirProvider.setUserDataDirectory(gDataHome, false);
|
||||
xreDirProvider.setUserDataDirectory(gDataHomeLocal, true);
|
||||
|
||||
|
@ -41,7 +48,12 @@ const ShellService = {
|
|||
},
|
||||
};
|
||||
|
||||
registrar.registerFactory(this.ID, "ToolkitShellService", this.CONTRACT, factory);
|
||||
registrar.registerFactory(
|
||||
this.ID,
|
||||
"ToolkitShellService",
|
||||
this.CONTRACT,
|
||||
factory
|
||||
);
|
||||
},
|
||||
|
||||
isDefaultApplication() {
|
||||
|
@ -58,24 +70,27 @@ ShellService.register();
|
|||
let gIsLegacy = false;
|
||||
|
||||
function simulateSnapEnvironment() {
|
||||
let env = Cc["@mozilla.org/process/environment;1"].
|
||||
getService(Ci.nsIEnvironment);
|
||||
let env = Cc["@mozilla.org/process/environment;1"].getService(
|
||||
Ci.nsIEnvironment
|
||||
);
|
||||
env.set("SNAP_NAME", "foo");
|
||||
|
||||
gIsLegacy = true;
|
||||
}
|
||||
|
||||
function enableLegacyProfiles() {
|
||||
let env = Cc["@mozilla.org/process/environment;1"].
|
||||
getService(Ci.nsIEnvironment);
|
||||
let env = Cc["@mozilla.org/process/environment;1"].getService(
|
||||
Ci.nsIEnvironment
|
||||
);
|
||||
env.set("MOZ_LEGACY_PROFILES", "1");
|
||||
|
||||
gIsLegacy = true;
|
||||
}
|
||||
|
||||
function getProfileService() {
|
||||
return Cc["@mozilla.org/toolkit/profile-service;1"].
|
||||
getService(Ci.nsIToolkitProfileService);
|
||||
return Cc["@mozilla.org/toolkit/profile-service;1"].getService(
|
||||
Ci.nsIToolkitProfileService
|
||||
);
|
||||
}
|
||||
|
||||
let PROFILE_DEFAULT = "default";
|
||||
|
@ -103,14 +118,29 @@ function selectStartupProfile(args = [], isResetting = false, legacyHash = "") {
|
|||
let rootDir = {};
|
||||
let localDir = {};
|
||||
let profile = {};
|
||||
let didCreate = service.selectStartupProfile(["xpcshell", ...args], isResetting,
|
||||
UPDATE_CHANNEL, legacyHash, rootDir,
|
||||
localDir, profile);
|
||||
let didCreate = service.selectStartupProfile(
|
||||
["xpcshell", ...args],
|
||||
isResetting,
|
||||
UPDATE_CHANNEL,
|
||||
legacyHash,
|
||||
rootDir,
|
||||
localDir,
|
||||
profile
|
||||
);
|
||||
|
||||
if (profile.value) {
|
||||
Assert.ok(rootDir.value.equals(profile.value.rootDir), "Should have matched the root dir.");
|
||||
Assert.ok(localDir.value.equals(profile.value.localDir), "Should have matched the local dir.");
|
||||
Assert.ok(service.currentProfile === profile.value, "Should have marked the profile as the current profile.");
|
||||
Assert.ok(
|
||||
rootDir.value.equals(profile.value.rootDir),
|
||||
"Should have matched the root dir."
|
||||
);
|
||||
Assert.ok(
|
||||
localDir.value.equals(profile.value.localDir),
|
||||
"Should have matched the local dir."
|
||||
);
|
||||
Assert.ok(
|
||||
service.currentProfile === profile.value,
|
||||
"Should have marked the profile as the current profile."
|
||||
);
|
||||
} else {
|
||||
Assert.ok(!service.currentProfile, "Should be no current profile.");
|
||||
}
|
||||
|
@ -129,7 +159,11 @@ function testStartsProfileManager(args = [], isResetting = false) {
|
|||
Assert.ok(false, "Should have started the profile manager");
|
||||
checkStartupReason();
|
||||
} catch (e) {
|
||||
Assert.equal(e.result, NS_ERROR_START_PROFILE_MANAGER, "Should have started the profile manager");
|
||||
Assert.equal(
|
||||
e.result,
|
||||
NS_ERROR_START_PROFILE_MANAGER,
|
||||
"Should have started the profile manager"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,20 +179,32 @@ function safeGet(ini, section, key) {
|
|||
* Writes a compatibility.ini file that marks the give profile directory as last
|
||||
* used by the given install path.
|
||||
*/
|
||||
function writeCompatibilityIni(dir, appDir = FileUtils.getDir("CurProcD", []),
|
||||
greDir = FileUtils.getDir("GreD", [])) {
|
||||
function writeCompatibilityIni(
|
||||
dir,
|
||||
appDir = FileUtils.getDir("CurProcD", []),
|
||||
greDir = FileUtils.getDir("GreD", [])
|
||||
) {
|
||||
let target = dir.clone();
|
||||
target.append("compatibility.ini");
|
||||
|
||||
let factory = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].
|
||||
getService(Ci.nsIINIParserFactory);
|
||||
let factory = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].getService(
|
||||
Ci.nsIINIParserFactory
|
||||
);
|
||||
let ini = factory.createINIParser().QueryInterface(Ci.nsIINIParserWriter);
|
||||
|
||||
// The profile service doesn't care about these so just use fixed values
|
||||
ini.setString("Compatibility", "LastVersion", "64.0a1_20180919123806/20180919123806");
|
||||
ini.setString(
|
||||
"Compatibility",
|
||||
"LastVersion",
|
||||
"64.0a1_20180919123806/20180919123806"
|
||||
);
|
||||
ini.setString("Compatibility", "LastOSABI", "Darwin_x86_64-gcc3");
|
||||
|
||||
ini.setString("Compatibility", "LastPlatformDir", greDir.persistentDescriptor);
|
||||
ini.setString(
|
||||
"Compatibility",
|
||||
"LastPlatformDir",
|
||||
greDir.persistentDescriptor
|
||||
);
|
||||
ini.setString("Compatibility", "LastAppDir", appDir.persistentDescriptor);
|
||||
|
||||
ini.writeFile(target);
|
||||
|
@ -175,14 +221,19 @@ function writeProfilesIni(profileData) {
|
|||
let target = gDataHome.clone();
|
||||
target.append("profiles.ini");
|
||||
|
||||
let factory = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].
|
||||
getService(Ci.nsIINIParserFactory);
|
||||
let factory = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].getService(
|
||||
Ci.nsIINIParserFactory
|
||||
);
|
||||
let ini = factory.createINIParser().QueryInterface(Ci.nsIINIParserWriter);
|
||||
|
||||
const { options = {}, profiles = [], installs = null } = profileData;
|
||||
|
||||
let { startWithLastProfile = true } = options;
|
||||
ini.setString("General", "StartWithLastProfile", startWithLastProfile ? "1" : "0");
|
||||
ini.setString(
|
||||
"General",
|
||||
"StartWithLastProfile",
|
||||
startWithLastProfile ? "1" : "0"
|
||||
);
|
||||
|
||||
for (let i = 0; i < profiles.length; i++) {
|
||||
let profile = profiles[i];
|
||||
|
@ -203,7 +254,11 @@ function writeProfilesIni(profileData) {
|
|||
for (let hash of Object.keys(installs)) {
|
||||
ini.setString(`Install${hash}`, "Default", installs[hash].default);
|
||||
if ("locked" in installs[hash]) {
|
||||
ini.setString(`Install${hash}`, "Locked", installs[hash].locked ? "1" : "0");
|
||||
ini.setString(
|
||||
`Install${hash}`,
|
||||
"Locked",
|
||||
installs[hash].locked ? "1" : "0"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,11 +292,13 @@ function readProfilesIni() {
|
|||
return profileData;
|
||||
}
|
||||
|
||||
let factory = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].
|
||||
getService(Ci.nsIINIParserFactory);
|
||||
let factory = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].getService(
|
||||
Ci.nsIINIParserFactory
|
||||
);
|
||||
let ini = factory.createINIParser(target);
|
||||
|
||||
profileData.options.startWithLastProfile = safeGet(ini, "General", "StartWithLastProfile") == "1";
|
||||
profileData.options.startWithLastProfile =
|
||||
safeGet(ini, "General", "StartWithLastProfile") == "1";
|
||||
if (safeGet(ini, "General", "Version") == "2") {
|
||||
profileData.installs = {};
|
||||
}
|
||||
|
@ -259,7 +316,11 @@ function readProfilesIni() {
|
|||
if (isRelative === null) {
|
||||
break;
|
||||
}
|
||||
Assert.equal(isRelative, "1", "Paths should always be relative in these tests.");
|
||||
Assert.equal(
|
||||
isRelative,
|
||||
"1",
|
||||
"Paths should always be relative in these tests."
|
||||
);
|
||||
|
||||
let profile = {
|
||||
name: safeGet(ini, section, "Name"),
|
||||
|
@ -268,7 +329,10 @@ function readProfilesIni() {
|
|||
|
||||
try {
|
||||
profile.default = ini.getString(section, "Default") == "1";
|
||||
Assert.ok(profile.default, "The Default value is only written when true.");
|
||||
Assert.ok(
|
||||
profile.default,
|
||||
"The Default value is only written when true."
|
||||
);
|
||||
} catch (e) {
|
||||
profile.default = false;
|
||||
}
|
||||
|
@ -277,7 +341,10 @@ function readProfilesIni() {
|
|||
}
|
||||
|
||||
if (section.startsWith("Install")) {
|
||||
Assert.ok(profileData.installs, "Should only see an install section if the ini version was correct.");
|
||||
Assert.ok(
|
||||
profileData.installs,
|
||||
"Should only see an install section if the ini version was correct."
|
||||
);
|
||||
|
||||
profileData.installs[section.substring(7)] = {
|
||||
default: safeGet(ini, section, "Default"),
|
||||
|
@ -307,15 +374,15 @@ function writeInstallsIni(installData) {
|
|||
if (!installData) {
|
||||
try {
|
||||
target.remove(false);
|
||||
} catch (e) {
|
||||
}
|
||||
} catch (e) {}
|
||||
return;
|
||||
}
|
||||
|
||||
const { installs = {} } = installData;
|
||||
|
||||
let factory = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].
|
||||
getService(Ci.nsIINIParserFactory);
|
||||
let factory = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].getService(
|
||||
Ci.nsIINIParserFactory
|
||||
);
|
||||
let ini = factory.createINIParser(null).QueryInterface(Ci.nsIINIParserWriter);
|
||||
|
||||
for (let hash of Object.keys(installs)) {
|
||||
|
@ -343,8 +410,9 @@ function readInstallsIni() {
|
|||
return installData;
|
||||
}
|
||||
|
||||
let factory = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].
|
||||
getService(Ci.nsIINIParserFactory);
|
||||
let factory = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].getService(
|
||||
Ci.nsIINIParserFactory
|
||||
);
|
||||
let ini = factory.createINIParser(target);
|
||||
|
||||
let sections = ini.getSections();
|
||||
|
@ -369,21 +437,31 @@ function readInstallsIni() {
|
|||
* Check that the backup data in installs.ini matches the install data in
|
||||
* profiles.ini.
|
||||
*/
|
||||
function checkBackup(profileData = readProfilesIni(), installData = readInstallsIni()) {
|
||||
function checkBackup(
|
||||
profileData = readProfilesIni(),
|
||||
installData = readInstallsIni()
|
||||
) {
|
||||
if (!profileData.installs) {
|
||||
// If the profiles db isn't of the right version we wouldn't expect the
|
||||
// backup to be accurate.
|
||||
return;
|
||||
}
|
||||
|
||||
Assert.deepEqual(profileData.installs, installData.installs, "Backup installs.ini should match installs in profiles.ini");
|
||||
Assert.deepEqual(
|
||||
profileData.installs,
|
||||
installData.installs,
|
||||
"Backup installs.ini should match installs in profiles.ini"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the profile service seems to have the right data in it compared
|
||||
* to profile and install data structured as in the above functions.
|
||||
*/
|
||||
function checkProfileService(profileData = readProfilesIni(), verifyBackup = true) {
|
||||
function checkProfileService(
|
||||
profileData = readProfilesIni(),
|
||||
verifyBackup = true
|
||||
) {
|
||||
let service = getProfileService();
|
||||
|
||||
let expectedStartWithLast = true;
|
||||
|
@ -391,20 +469,29 @@ function checkProfileService(profileData = readProfilesIni(), verifyBackup = tru
|
|||
expectedStartWithLast = profileData.options.startWithLastProfile;
|
||||
}
|
||||
|
||||
Assert.equal(service.startWithLastProfile, expectedStartWithLast,
|
||||
"Start with last profile should match.");
|
||||
Assert.equal(
|
||||
service.startWithLastProfile,
|
||||
expectedStartWithLast,
|
||||
"Start with last profile should match."
|
||||
);
|
||||
|
||||
let serviceProfiles = Array.from(service.profiles);
|
||||
|
||||
Assert.equal(serviceProfiles.length, profileData.profiles.length, "Should be the same number of profiles.");
|
||||
Assert.equal(
|
||||
serviceProfiles.length,
|
||||
profileData.profiles.length,
|
||||
"Should be the same number of profiles."
|
||||
);
|
||||
|
||||
// Sort to make matching easy.
|
||||
serviceProfiles.sort((a, b) => a.name.localeCompare(b.name));
|
||||
profileData.profiles.sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
let hash = xreDirProvider.getInstallHash();
|
||||
let defaultPath = (profileData.installs && hash in profileData.installs) ?
|
||||
profileData.installs[hash].default : null;
|
||||
let defaultPath =
|
||||
profileData.installs && hash in profileData.installs
|
||||
? profileData.installs[hash].default
|
||||
: null;
|
||||
let dedicatedProfile = null;
|
||||
let legacyProfile = null;
|
||||
|
||||
|
@ -412,11 +499,21 @@ function checkProfileService(profileData = readProfilesIni(), verifyBackup = tru
|
|||
let serviceProfile = serviceProfiles[i];
|
||||
let expectedProfile = profileData.profiles[i];
|
||||
|
||||
Assert.equal(serviceProfile.name, expectedProfile.name, "Should have the same name.");
|
||||
Assert.equal(
|
||||
serviceProfile.name,
|
||||
expectedProfile.name,
|
||||
"Should have the same name."
|
||||
);
|
||||
|
||||
let expectedPath = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
|
||||
let expectedPath = Cc["@mozilla.org/file/local;1"].createInstance(
|
||||
Ci.nsIFile
|
||||
);
|
||||
expectedPath.setRelativeDescriptor(gDataHome, expectedProfile.path);
|
||||
Assert.equal(serviceProfile.rootDir.path, expectedPath.path, "Should have the same path.");
|
||||
Assert.equal(
|
||||
serviceProfile.rootDir.path,
|
||||
expectedPath.path,
|
||||
"Should have the same path."
|
||||
);
|
||||
|
||||
if (expectedProfile.path == defaultPath) {
|
||||
dedicatedProfile = serviceProfile;
|
||||
|
@ -432,9 +529,17 @@ function checkProfileService(profileData = readProfilesIni(), verifyBackup = tru
|
|||
}
|
||||
|
||||
if (gIsLegacy) {
|
||||
Assert.equal(service.defaultProfile, legacyProfile, "Should have seen the right profile selected.");
|
||||
Assert.equal(
|
||||
service.defaultProfile,
|
||||
legacyProfile,
|
||||
"Should have seen the right profile selected."
|
||||
);
|
||||
} else {
|
||||
Assert.equal(service.defaultProfile, dedicatedProfile, "Should have seen the right profile selected.");
|
||||
Assert.equal(
|
||||
service.defaultProfile,
|
||||
dedicatedProfile,
|
||||
"Should have seen the right profile selected."
|
||||
);
|
||||
}
|
||||
|
||||
if (verifyBackup) {
|
||||
|
@ -456,12 +561,19 @@ function checkStartupReason(expected = undefined) {
|
|||
let scalars = TelemetryTestUtils.getProcessScalars("parent");
|
||||
|
||||
if (expected === undefined) {
|
||||
Assert.ok(!(tId in scalars), "Startup telemetry should not have been recorded.");
|
||||
Assert.ok(
|
||||
!(tId in scalars),
|
||||
"Startup telemetry should not have been recorded."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (tId in scalars) {
|
||||
Assert.equal(scalars[tId], expected, "Should have seen the right startup reason.");
|
||||
Assert.equal(
|
||||
scalars[tId],
|
||||
expected,
|
||||
"Should have seen the right startup reason."
|
||||
);
|
||||
} else {
|
||||
Assert.ok(false, "Startup telemetry should have been recorded.");
|
||||
}
|
||||
|
|
|
@ -12,13 +12,16 @@ add_task(async () => {
|
|||
options: {
|
||||
startWithLastProfile: true,
|
||||
},
|
||||
profiles: [{
|
||||
name: "Profile1",
|
||||
path: "Path1",
|
||||
}, {
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "Profile1",
|
||||
path: "Path1",
|
||||
},
|
||||
{
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
let installs = {
|
||||
|
@ -39,6 +42,13 @@ add_task(async () => {
|
|||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.equal(profile.name, "Profile2", "Should have selected the right profile");
|
||||
Assert.ok(!service.createdAlternateProfile, "Should not have created an alternate profile.");
|
||||
Assert.equal(
|
||||
profile.name,
|
||||
"Profile2",
|
||||
"Should have selected the right profile"
|
||||
);
|
||||
Assert.ok(
|
||||
!service.createdAlternateProfile,
|
||||
"Should not have created an alternate profile."
|
||||
);
|
||||
});
|
||||
|
|
|
@ -12,11 +12,13 @@ add_task(async () => {
|
|||
writeCompatibilityIni(defaultProfile);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: "Foo",
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "Foo",
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
installs: {
|
||||
other: {
|
||||
default: defaultProfile.leafName,
|
||||
|
@ -29,17 +31,38 @@ add_task(async () => {
|
|||
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 2, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
2,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
let hash = xreDirProvider.getInstallHash();
|
||||
Assert.equal(Object.keys(profileData.installs).length, 2, "Should be two known installs.");
|
||||
Assert.notEqual(profileData.installs[hash].default, defaultProfile.leafName, "Should not have marked the original default profile as the default for this install.");
|
||||
Assert.ok(profileData.installs[hash].locked, "Should have locked as we created this profile for this install.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
2,
|
||||
"Should be two known installs."
|
||||
);
|
||||
Assert.notEqual(
|
||||
profileData.installs[hash].default,
|
||||
defaultProfile.leafName,
|
||||
"Should not have marked the original default profile as the default for this install."
|
||||
);
|
||||
Assert.ok(
|
||||
profileData.installs[hash].locked,
|
||||
"Should have locked as we created this profile for this install."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(didCreate, "Should have created a new profile.");
|
||||
Assert.ok(!selectedProfile.rootDir.equals(defaultProfile), "Should be using a different directory.");
|
||||
Assert.ok(
|
||||
!selectedProfile.rootDir.equals(defaultProfile),
|
||||
"Should be using a different directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, DEDICATED_NAME);
|
||||
});
|
||||
|
|
|
@ -22,35 +22,61 @@ add_task(async () => {
|
|||
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.equal(profileData.profiles.length, 1, "Should have the right number of profiles.");
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
1,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, "dedicated", "Should have the right name.");
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
// The new profile hasn't been marked as the default yet!
|
||||
Assert.equal(Object.keys(profileData.installs).length, 0, "Should be no defaults for installs yet.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
0,
|
||||
"Should be no defaults for installs yet."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(service.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.ok(
|
||||
service.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
service.startWithLastProfile = false;
|
||||
Assert.ok(!service.startWithLastProfile, "Should be set to not start with the last profile.");
|
||||
Assert.ok(
|
||||
!service.startWithLastProfile,
|
||||
"Should be set to not start with the last profile."
|
||||
);
|
||||
|
||||
service.defaultProfile = newProfile;
|
||||
service.flush();
|
||||
|
||||
profileData = readProfilesIni();
|
||||
|
||||
Assert.equal(profileData.profiles.length, 1, "Should have the right number of profiles.");
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
1,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, "dedicated", "Should have the right name.");
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
let hash = xreDirProvider.getInstallHash();
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should be only one known install.");
|
||||
Assert.equal(profileData.installs[hash].default, profileData.profiles[0].path, "Should have marked the new profile as the default for this install.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should be only one known install."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
profileData.profiles[0].path,
|
||||
"Should have marked the new profile as the default for this install."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
|
@ -61,7 +87,11 @@ add_task(async () => {
|
|||
|
||||
profileData = readProfilesIni();
|
||||
|
||||
Assert.equal(profileData.profiles.length, 2, "Should have the right number of profiles.");
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
2,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, "another", "Should have the right name.");
|
||||
|
@ -71,8 +101,16 @@ add_task(async () => {
|
|||
Assert.equal(profile.name, "dedicated", "Should have the right name.");
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should be only one known install.");
|
||||
Assert.equal(profileData.installs[hash].default, profileData.profiles[0].path, "Should have marked the new profile as the default for this install.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should be only one known install."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
profileData.profiles[0].path,
|
||||
"Should have marked the new profile as the default for this install."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
|
@ -81,14 +119,26 @@ add_task(async () => {
|
|||
|
||||
profileData = readProfilesIni();
|
||||
|
||||
Assert.equal(profileData.profiles.length, 1, "Should have the right number of profiles.");
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
1,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, "another", "Should have the right name.");
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should be only one known install.");
|
||||
Assert.equal(profileData.installs[hash].default, profileData.profiles[0].path, "Should have marked the new profile as the default for this install.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should be only one known install."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
profileData.profiles[0].path,
|
||||
"Should have marked the new profile as the default for this install."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
|
@ -97,11 +147,19 @@ add_task(async () => {
|
|||
|
||||
profileData = readProfilesIni();
|
||||
|
||||
Assert.equal(profileData.profiles.length, 0, "Should have the right number of profiles.");
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
0,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
// We leave a reference to the missing profile to stop us trying to steal the
|
||||
// old-style default profile on next startup.
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should be only one known install.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should be only one known install."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
});
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
*/
|
||||
|
||||
function check_unchanged(service) {
|
||||
Assert.ok(!service.isListOutdated, "Should not have detected a modification.");
|
||||
Assert.ok(
|
||||
!service.isListOutdated,
|
||||
"Should not have detected a modification."
|
||||
);
|
||||
try {
|
||||
service.flush();
|
||||
Assert.ok(true, "Should have flushed.");
|
||||
|
@ -22,7 +25,11 @@ function check_outdated(service) {
|
|||
service.flush();
|
||||
Assert.ok(false, "Should have failed to flush.");
|
||||
} catch (e) {
|
||||
Assert.equal(e.result, Cr.NS_ERROR_DATABASE_CHANGED, "Should have refused to flush.");
|
||||
Assert.equal(
|
||||
e.result,
|
||||
Cr.NS_ERROR_DATABASE_CHANGED,
|
||||
"Should have refused to flush."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
*/
|
||||
|
||||
function check_unchanged(service) {
|
||||
Assert.ok(!service.isListOutdated, "Should not have detected a modification.");
|
||||
Assert.ok(
|
||||
!service.isListOutdated,
|
||||
"Should not have detected a modification."
|
||||
);
|
||||
try {
|
||||
service.flush();
|
||||
Assert.ok(true, "Should have flushed.");
|
||||
|
@ -22,7 +25,11 @@ function check_outdated(service) {
|
|||
service.flush();
|
||||
Assert.ok(false, "Should have failed to flush.");
|
||||
} catch (e) {
|
||||
Assert.equal(e.result, Cr.NS_ERROR_DATABASE_CHANGED, "Should have refused to flush.");
|
||||
Assert.equal(
|
||||
e.result,
|
||||
Cr.NS_ERROR_DATABASE_CHANGED,
|
||||
"Should have refused to flush."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,30 @@ add_task(async () => {
|
|||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(didCreate, "Should have created a new profile.");
|
||||
Assert.equal(profile, service.defaultProfile, "Should now be the default profile.");
|
||||
Assert.equal(profile.name, DEDICATED_NAME, "Should have created a new profile with the right name.");
|
||||
Assert.ok(!service.createdAlternateProfile, "Should not have created an alternate profile.");
|
||||
Assert.equal(
|
||||
profile,
|
||||
service.defaultProfile,
|
||||
"Should now be the default profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profile.name,
|
||||
DEDICATED_NAME,
|
||||
"Should have created a new profile with the right name."
|
||||
);
|
||||
Assert.ok(
|
||||
!service.createdAlternateProfile,
|
||||
"Should not have created an alternate profile."
|
||||
);
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 2, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
2,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, "default", "Should have the right name.");
|
||||
|
@ -31,5 +49,8 @@ add_task(async () => {
|
|||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
let hash = xreDirProvider.getInstallHash();
|
||||
Assert.ok(profileData.installs[hash].locked, "Should have locked the profile");
|
||||
Assert.ok(
|
||||
profileData.installs[hash].locked,
|
||||
"Should have locked the profile"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -19,53 +19,95 @@ add_task(async () => {
|
|||
writeCompatibilityIni(defaultProfile);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}, {
|
||||
name: "dedicated",
|
||||
path: dedicatedProfile.leafName,
|
||||
}, {
|
||||
name: "dev-edition-default",
|
||||
path: devProfile.leafName,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "dedicated",
|
||||
path: dedicatedProfile.leafName,
|
||||
},
|
||||
{
|
||||
name: "dev-edition-default",
|
||||
path: devProfile.leafName,
|
||||
},
|
||||
],
|
||||
installs: {
|
||||
[legacyHash]: {
|
||||
default: dedicatedProfile.leafName,
|
||||
},
|
||||
"otherhash": {
|
||||
otherhash: {
|
||||
default: "foobar",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
let { profile: selectedProfile, didCreate } = selectStartupProfile([], false, legacyHash);
|
||||
let { profile: selectedProfile, didCreate } = selectStartupProfile(
|
||||
[],
|
||||
false,
|
||||
legacyHash
|
||||
);
|
||||
checkStartupReason("default");
|
||||
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 3, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
3,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, `dedicated`, "Should have the right name.");
|
||||
Assert.equal(profile.path, dedicatedProfile.leafName, "Should be the expected dedicated profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
dedicatedProfile.leafName,
|
||||
"Should be the expected dedicated profile."
|
||||
);
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
profile = profileData.profiles[1];
|
||||
Assert.equal(profile.name, "default", "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should be marked as the old-style default.");
|
||||
|
||||
Assert.equal(Object.keys(profileData.installs).length, 3, "Should be three known installs.");
|
||||
Assert.equal(profileData.installs[currentHash].default, dedicatedProfile.leafName, "Should have switched to the new install hash.");
|
||||
Assert.equal(profileData.installs[legacyHash].default, dedicatedProfile.leafName, "Should have kept the old install hash.");
|
||||
Assert.equal(profileData.installs.otherhash.default, "foobar", "Should have kept the default for the other install.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
3,
|
||||
"Should be three known installs."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[currentHash].default,
|
||||
dedicatedProfile.leafName,
|
||||
"Should have switched to the new install hash."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[legacyHash].default,
|
||||
dedicatedProfile.leafName,
|
||||
"Should have kept the old install hash."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs.otherhash.default,
|
||||
"foobar",
|
||||
"Should have kept the default for the other install."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.ok(selectedProfile.rootDir.equals(dedicatedProfile), "Should be using the right directory.");
|
||||
Assert.ok(
|
||||
selectedProfile.rootDir.equals(dedicatedProfile),
|
||||
"Should be using the right directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, "dedicated");
|
||||
});
|
||||
|
|
|
@ -19,17 +19,21 @@ add_task(async () => {
|
|||
writeCompatibilityIni(defaultProfile);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}, {
|
||||
name: "dedicated",
|
||||
path: dedicatedProfile.leafName,
|
||||
}, {
|
||||
name: "dev-edition-default",
|
||||
path: devProfile.leafName,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "dedicated",
|
||||
path: dedicatedProfile.leafName,
|
||||
},
|
||||
{
|
||||
name: "dev-edition-default",
|
||||
path: devProfile.leafName,
|
||||
},
|
||||
],
|
||||
installs: {
|
||||
[legacyHash]: {
|
||||
default: defaultProfile.leafName,
|
||||
|
@ -37,43 +41,89 @@ add_task(async () => {
|
|||
[currentHash]: {
|
||||
default: dedicatedProfile.leafName,
|
||||
},
|
||||
"otherhash": {
|
||||
otherhash: {
|
||||
default: "foobar",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
let { profile: selectedProfile, didCreate } = selectStartupProfile([], false, legacyHash);
|
||||
let { profile: selectedProfile, didCreate } = selectStartupProfile(
|
||||
[],
|
||||
false,
|
||||
legacyHash
|
||||
);
|
||||
checkStartupReason("default");
|
||||
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 3, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
3,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, `dedicated`, "Should have the right name.");
|
||||
Assert.equal(profile.path, dedicatedProfile.leafName, "Should be the expected dedicated profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
dedicatedProfile.leafName,
|
||||
"Should be the expected dedicated profile."
|
||||
);
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
profile = profileData.profiles[1];
|
||||
Assert.equal(profile.name, "default", "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should be marked as the old-style default.");
|
||||
|
||||
profile = profileData.profiles[2];
|
||||
Assert.equal(profile.name, "dev-edition-default", "Should have the right name.");
|
||||
Assert.equal(profile.path, devProfile.leafName, "Should not be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.name,
|
||||
"dev-edition-default",
|
||||
"Should have the right name."
|
||||
);
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
devProfile.leafName,
|
||||
"Should not be the original default profile."
|
||||
);
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
Assert.equal(Object.keys(profileData.installs).length, 3, "Should be three known installs.");
|
||||
Assert.equal(profileData.installs[currentHash].default, dedicatedProfile.leafName, "Should have switched to the new install hash.");
|
||||
Assert.equal(profileData.installs[legacyHash].default, defaultProfile.leafName, "Should have ignored old install hash.");
|
||||
Assert.equal(profileData.installs.otherhash.default, "foobar", "Should have kept the default for the other install.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
3,
|
||||
"Should be three known installs."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[currentHash].default,
|
||||
dedicatedProfile.leafName,
|
||||
"Should have switched to the new install hash."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[legacyHash].default,
|
||||
defaultProfile.leafName,
|
||||
"Should have ignored old install hash."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs.otherhash.default,
|
||||
"foobar",
|
||||
"Should have kept the default for the other install."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.ok(selectedProfile.rootDir.equals(dedicatedProfile), "Should be using the right directory.");
|
||||
Assert.ok(
|
||||
selectedProfile.rootDir.equals(dedicatedProfile),
|
||||
"Should be using the right directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, "dedicated");
|
||||
});
|
||||
|
|
|
@ -13,13 +13,16 @@ add_task(async () => {
|
|||
options: {
|
||||
startWithLastProfile: true,
|
||||
},
|
||||
profiles: [{
|
||||
name: "Profile1",
|
||||
path: "../data/test",
|
||||
}, {
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "Profile1",
|
||||
path: "../data/test",
|
||||
},
|
||||
{
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
},
|
||||
],
|
||||
installs: {
|
||||
[hash]: {
|
||||
default: "test",
|
||||
|
@ -35,10 +38,21 @@ add_task(async () => {
|
|||
let service = getProfileService();
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.equal(profile.name, "Profile1", "Should have selected the expected profile");
|
||||
Assert.ok(!service.createdAlternateProfile, "Should not have created an alternate profile.");
|
||||
Assert.equal(
|
||||
profile.name,
|
||||
"Profile1",
|
||||
"Should have selected the expected profile"
|
||||
);
|
||||
Assert.ok(
|
||||
!service.createdAlternateProfile,
|
||||
"Should not have created an alternate profile."
|
||||
);
|
||||
|
||||
Assert.equal(profile.name, service.defaultProfile.name, "Should have selected the right default.");
|
||||
Assert.equal(
|
||||
profile.name,
|
||||
service.defaultProfile.name,
|
||||
"Should have selected the right default."
|
||||
);
|
||||
|
||||
service.flush();
|
||||
checkProfileService();
|
||||
|
|
|
@ -13,7 +13,11 @@ add_task(async () => {
|
|||
checkStartupReason("firstrun-created-default");
|
||||
|
||||
Assert.ok(didCreate, "Should have created a new profile.");
|
||||
Assert.equal(profile.name, PROFILE_DEFAULT, "Should have used the normal name.");
|
||||
Assert.equal(
|
||||
profile.name,
|
||||
PROFILE_DEFAULT,
|
||||
"Should have used the normal name."
|
||||
);
|
||||
if (AppConstants.MOZ_DEV_EDITION) {
|
||||
Assert.equal(service.profileCount, 2, "Should be two profiles.");
|
||||
} else {
|
||||
|
|
|
@ -15,11 +15,13 @@ add_task(async () => {
|
|||
writeCompatibilityIni(defaultProfile, greDir, greDir);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
enableLegacyProfiles();
|
||||
|
@ -30,19 +32,36 @@ add_task(async () => {
|
|||
let profileData = readProfilesIni();
|
||||
let installsINI = gDataHome.clone();
|
||||
installsINI.append("installs.ini");
|
||||
Assert.ok(!installsINI.exists(), "Installs database should not have been created.");
|
||||
Assert.ok(
|
||||
!installsINI.exists(),
|
||||
"Installs database should not have been created."
|
||||
);
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 1, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
1,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, PROFILE_DEFAULT, "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should be marked as the old-style default.");
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.ok(selectedProfile.rootDir.equals(defaultProfile), "Should be using the right directory.");
|
||||
Assert.ok(
|
||||
selectedProfile.rootDir.equals(defaultProfile),
|
||||
"Should be using the right directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, PROFILE_DEFAULT);
|
||||
});
|
||||
|
|
|
@ -13,11 +13,13 @@ add_task(async () => {
|
|||
writeCompatibilityIni(defaultProfile);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
let { profile: selectedProfile, didCreate } = selectStartupProfile();
|
||||
|
@ -25,21 +27,46 @@ add_task(async () => {
|
|||
let hash = xreDirProvider.getInstallHash();
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 1, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
1,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, PROFILE_DEFAULT, "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should be marked as the old-style default.");
|
||||
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should be only one known install.");
|
||||
Assert.equal(profileData.installs[hash].default, defaultProfile.leafName, "Should have marked the original default profile as the default for this install.");
|
||||
Assert.ok(profileData.installs[hash].locked, "Should have locked as we're the default app.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should be only one known install."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
defaultProfile.leafName,
|
||||
"Should have marked the original default profile as the default for this install."
|
||||
);
|
||||
Assert.ok(
|
||||
profileData.installs[hash].locked,
|
||||
"Should have locked as we're the default app."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.ok(selectedProfile.rootDir.equals(defaultProfile), "Should be using the right directory.");
|
||||
Assert.ok(
|
||||
selectedProfile.rootDir.equals(defaultProfile),
|
||||
"Should be using the right directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, PROFILE_DEFAULT);
|
||||
});
|
||||
|
|
|
@ -28,13 +28,28 @@ add_task(async () => {
|
|||
|
||||
let service = getProfileService();
|
||||
Assert.ok(didCreate, "Should have created a new profile.");
|
||||
Assert.equal(profile.name, DEDICATED_NAME, "Should have created the right profile");
|
||||
Assert.ok(!service.createdAlternateProfile, "Should not have created an alternate profile.");
|
||||
Assert.equal(
|
||||
profile.name,
|
||||
DEDICATED_NAME,
|
||||
"Should have created the right profile"
|
||||
);
|
||||
Assert.ok(
|
||||
!service.createdAlternateProfile,
|
||||
"Should not have created an alternate profile."
|
||||
);
|
||||
|
||||
let profilesData = readProfilesIni();
|
||||
Assert.equal(Object.keys(profilesData.installs).length, 1, "Should be only one known install");
|
||||
Assert.equal(
|
||||
Object.keys(profilesData.installs).length,
|
||||
1,
|
||||
"Should be only one known install"
|
||||
);
|
||||
Assert.ok(hash in profilesData.installs, "Should be the expected install.");
|
||||
Assert.notEqual(profilesData.installs[hash].default, "Path2", "Didn't import the previous data.");
|
||||
Assert.notEqual(
|
||||
profilesData.installs[hash].default,
|
||||
"Path2",
|
||||
"Didn't import the previous data."
|
||||
);
|
||||
|
||||
checkProfileService(profilesData);
|
||||
});
|
||||
|
|
|
@ -15,17 +15,21 @@ add_task(async () => {
|
|||
writeCompatibilityIni(devDefaultProfile);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: "mydefault",
|
||||
path: mydefaultProfile.leafName,
|
||||
default: true,
|
||||
}, {
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
}, {
|
||||
name: "dev-edition-default",
|
||||
path: devDefaultProfile.leafName,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "mydefault",
|
||||
path: mydefaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
},
|
||||
{
|
||||
name: "dev-edition-default",
|
||||
path: devDefaultProfile.leafName,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
let service = getProfileService();
|
||||
|
@ -35,42 +39,89 @@ add_task(async () => {
|
|||
let hash = xreDirProvider.getInstallHash();
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 3, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
3,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, "default", "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original non-default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original non-default profile."
|
||||
);
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
profile = profileData.profiles[1];
|
||||
Assert.equal(profile.name, "dev-edition-default", "Should have the right name.");
|
||||
Assert.equal(profile.path, devDefaultProfile.leafName, "Should be the original dev default profile.");
|
||||
Assert.equal(
|
||||
profile.name,
|
||||
"dev-edition-default",
|
||||
"Should have the right name."
|
||||
);
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
devDefaultProfile.leafName,
|
||||
"Should be the original dev default profile."
|
||||
);
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
profile = profileData.profiles[2];
|
||||
Assert.equal(profile.name, "mydefault", "Should have the right name.");
|
||||
Assert.equal(profile.path, mydefaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
mydefaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should be marked as the old-style default.");
|
||||
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should be only one known install.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should be only one known install."
|
||||
);
|
||||
if (AppConstants.MOZ_DEV_EDITION) {
|
||||
Assert.equal(profileData.installs[hash].default, devDefaultProfile.leafName, "Should have marked the original dev default profile as the default for this install.");
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
devDefaultProfile.leafName,
|
||||
"Should have marked the original dev default profile as the default for this install."
|
||||
);
|
||||
} else {
|
||||
Assert.equal(profileData.installs[hash].default, mydefaultProfile.leafName, "Should have marked the original default profile as the default for this install.");
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
mydefaultProfile.leafName,
|
||||
"Should have marked the original default profile as the default for this install."
|
||||
);
|
||||
}
|
||||
|
||||
Assert.ok(!profileData.installs[hash].locked, "Should not be locked as we're not the default app.");
|
||||
Assert.ok(
|
||||
!profileData.installs[hash].locked,
|
||||
"Should not be locked as we're not the default app."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
if (AppConstants.MOZ_DEV_EDITION) {
|
||||
Assert.ok(selectedProfile.rootDir.equals(devDefaultProfile), "Should be using the right directory.");
|
||||
Assert.ok(
|
||||
selectedProfile.rootDir.equals(devDefaultProfile),
|
||||
"Should be using the right directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, "dev-edition-default");
|
||||
} else {
|
||||
Assert.ok(selectedProfile.rootDir.equals(mydefaultProfile), "Should be using the right directory.");
|
||||
Assert.ok(
|
||||
selectedProfile.rootDir.equals(mydefaultProfile),
|
||||
"Should be using the right directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, "mydefault");
|
||||
}
|
||||
Assert.ok(!service.createdAlternateProfile, "Should not have created an alternate profile.");
|
||||
Assert.ok(
|
||||
!service.createdAlternateProfile,
|
||||
"Should not have created an alternate profile."
|
||||
);
|
||||
});
|
||||
|
|
|
@ -14,11 +14,13 @@ add_task(async () => {
|
|||
writeCompatibilityIni(defaultProfile);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
installs: {
|
||||
[hash]: {
|
||||
default: "foobar",
|
||||
|
@ -31,17 +33,35 @@ add_task(async () => {
|
|||
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 1, "Should have the right number of profiles.");
|
||||
Assert.ok(!service.createdAlternateProfile, "Should not have created an alternate profile.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
1,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
Assert.ok(
|
||||
!service.createdAlternateProfile,
|
||||
"Should not have created an alternate profile."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, "default", "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should be marked as the old-style default.");
|
||||
|
||||
// We keep the data here so we don't steal on the next reboot...
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Still list the broken reference.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Still list the broken reference."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
});
|
||||
|
|
|
@ -17,8 +17,15 @@ add_task(async () => {
|
|||
let hash = xreDirProvider.getInstallHash();
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 2, "Should have the right number of profiles, ours and the old-style default.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
2,
|
||||
"Should have the right number of profiles, ours and the old-style default."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, "default", "Should have the right name.");
|
||||
|
@ -28,13 +35,31 @@ add_task(async () => {
|
|||
Assert.equal(profile.name, DEDICATED_NAME, "Should have the right name.");
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should only be one known installs.");
|
||||
Assert.equal(profileData.installs[hash].default, profile.path, "Should have taken the new profile as the default for the current install.");
|
||||
Assert.ok(profileData.installs[hash].locked, "Should have locked as we created this profile.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should only be one known installs."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
profile.path,
|
||||
"Should have taken the new profile as the default for the current install."
|
||||
);
|
||||
Assert.ok(
|
||||
profileData.installs[hash].locked,
|
||||
"Should have locked as we created this profile."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(didCreate, "Should have created a new profile.");
|
||||
Assert.ok(!service.createdAlternateProfile, "Should not have created an alternate profile.");
|
||||
Assert.equal(selectedProfile.name, profile.name, "Should be using the right profile.");
|
||||
Assert.ok(
|
||||
!service.createdAlternateProfile,
|
||||
"Should not have created an alternate profile."
|
||||
);
|
||||
Assert.equal(
|
||||
selectedProfile.name,
|
||||
profile.name,
|
||||
"Should be using the right profile."
|
||||
);
|
||||
});
|
||||
|
|
|
@ -6,22 +6,37 @@
|
|||
*/
|
||||
|
||||
function compareLists(service, knownProfiles) {
|
||||
Assert.equal(service.profileCount, knownProfiles.length, "profileCount should be correct.");
|
||||
Assert.equal(
|
||||
service.profileCount,
|
||||
knownProfiles.length,
|
||||
"profileCount should be correct."
|
||||
);
|
||||
let serviceProfiles = Array.from(service.profiles);
|
||||
Assert.equal(serviceProfiles.length, knownProfiles.length, "Enumerator length should be correct.");
|
||||
Assert.equal(
|
||||
serviceProfiles.length,
|
||||
knownProfiles.length,
|
||||
"Enumerator length should be correct."
|
||||
);
|
||||
|
||||
for (let i = 0; i < knownProfiles.length; i++) {
|
||||
// Cannot use strictEqual here, it attempts to print out a string
|
||||
// representation of the profile objects and on some platforms that recurses
|
||||
// infinitely.
|
||||
Assert.ok(serviceProfiles[i] === knownProfiles[i], `Should have the right profile in position ${i}.`);
|
||||
Assert.ok(
|
||||
serviceProfiles[i] === knownProfiles[i],
|
||||
`Should have the right profile in position ${i}.`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function removeProfile(profiles, position) {
|
||||
dump(`Removing profile in position ${position}.`);
|
||||
Assert.greaterOrEqual(position, 0, "Should be removing a valid position.");
|
||||
Assert.less(position, profiles.length, "Should be removing a valid position.");
|
||||
Assert.less(
|
||||
position,
|
||||
profiles.length,
|
||||
"Should be removing a valid position."
|
||||
);
|
||||
|
||||
let last = profiles.pop();
|
||||
|
||||
|
@ -71,12 +86,7 @@ add_task(async () => {
|
|||
removeProfile(profiles, 2);
|
||||
compareLists(service, profiles);
|
||||
|
||||
let expectedNames = [
|
||||
"profile9",
|
||||
"profile7",
|
||||
"profile5",
|
||||
"profile4",
|
||||
];
|
||||
let expectedNames = ["profile9", "profile7", "profile5", "profile4"];
|
||||
|
||||
let serviceProfiles = Array.from(service.profiles);
|
||||
for (let i = 0; i < expectedNames.length; i++) {
|
||||
|
|
|
@ -11,11 +11,13 @@ add_task(async () => {
|
|||
let defaultProfile = makeRandomProfileDir("default");
|
||||
|
||||
let profilesIni = {
|
||||
profiles: [{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
installs: {
|
||||
[hash]: {
|
||||
default: defaultProfile.leafName,
|
||||
|
@ -29,8 +31,16 @@ add_task(async () => {
|
|||
|
||||
let { profile, didCreate } = selectStartupProfile();
|
||||
Assert.ok(!didCreate, "Should have not created a new profile.");
|
||||
Assert.equal(profile.name, "default", "Should have selected the default profile.");
|
||||
Assert.equal(profile, service.defaultProfile, "Should have selected the default profile.");
|
||||
Assert.equal(
|
||||
profile.name,
|
||||
"default",
|
||||
"Should have selected the default profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profile,
|
||||
service.defaultProfile,
|
||||
"Should have selected the default profile."
|
||||
);
|
||||
|
||||
checkProfileService(profilesIni);
|
||||
|
||||
|
@ -40,7 +50,11 @@ add_task(async () => {
|
|||
profile.remove(false);
|
||||
|
||||
Assert.ok(!service.defaultProfile, "Should no longer be a default profile.");
|
||||
Assert.equal(profile, service.currentProfile, "Should still be the profile in use.");
|
||||
Assert.equal(
|
||||
profile,
|
||||
service.currentProfile,
|
||||
"Should still be the profile in use."
|
||||
);
|
||||
|
||||
// These are the modifications that should have been made.
|
||||
profilesIni.profiles.pop();
|
||||
|
@ -57,5 +71,9 @@ add_task(async () => {
|
|||
// checkProfileService doesn't differentiate between a blank default profile
|
||||
// for the install and a missing install.
|
||||
profilesIni = readProfilesIni();
|
||||
Assert.equal(profilesIni.installs[hash].default, "", "Should be a blank default profile.");
|
||||
Assert.equal(
|
||||
profilesIni.installs[hash].default,
|
||||
"",
|
||||
"Should be a blank default profile."
|
||||
);
|
||||
});
|
||||
|
|
|
@ -12,13 +12,16 @@ add_task(async () => {
|
|||
options: {
|
||||
startWithLastProfile: true,
|
||||
},
|
||||
profiles: [{
|
||||
name: "Profile1",
|
||||
path: "Path1",
|
||||
}, {
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "Profile1",
|
||||
path: "Path1",
|
||||
},
|
||||
{
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
},
|
||||
],
|
||||
installs: {
|
||||
[hash]: {
|
||||
default: "Path2",
|
||||
|
@ -27,14 +30,17 @@ add_task(async () => {
|
|||
};
|
||||
|
||||
if (AppConstants.MOZ_DEV_EDITION) {
|
||||
profileData.profiles.push({
|
||||
name: "default",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
}, {
|
||||
name: PROFILE_DEFAULT,
|
||||
path: "Path4",
|
||||
});
|
||||
profileData.profiles.push(
|
||||
{
|
||||
name: "default",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: "Path4",
|
||||
}
|
||||
);
|
||||
} else {
|
||||
profileData.profiles.push({
|
||||
name: PROFILE_DEFAULT,
|
||||
|
@ -52,7 +58,18 @@ add_task(async () => {
|
|||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.equal(profile, service.defaultProfile, "Should have returned the default profile.");
|
||||
Assert.equal(profile.name, "default", "Should have selected the right profile");
|
||||
Assert.ok(!service.createdAlternateProfile, "Should not have created an alternate profile.");
|
||||
Assert.equal(
|
||||
profile,
|
||||
service.defaultProfile,
|
||||
"Should have returned the default profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profile.name,
|
||||
"default",
|
||||
"Should have selected the right profile"
|
||||
);
|
||||
Assert.ok(
|
||||
!service.createdAlternateProfile,
|
||||
"Should not have created an alternate profile."
|
||||
);
|
||||
});
|
||||
|
|
|
@ -12,24 +12,29 @@ add_task(async () => {
|
|||
options: {
|
||||
startWithLastProfile: true,
|
||||
},
|
||||
profiles: [{
|
||||
name: "Profile1",
|
||||
path: dir.leafName,
|
||||
}, {
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
}, {
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "Profile1",
|
||||
path: dir.leafName,
|
||||
},
|
||||
{
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
writeProfilesIni(profileData);
|
||||
checkProfileService(profileData);
|
||||
|
||||
let env = Cc["@mozilla.org/process/environment;1"].
|
||||
getService(Ci.nsIEnvironment);
|
||||
let env = Cc["@mozilla.org/process/environment;1"].getService(
|
||||
Ci.nsIEnvironment
|
||||
);
|
||||
env.set("XRE_PROFILE_PATH", dir.path);
|
||||
env.set("XRE_PROFILE_LOCAL_PATH", dir.path);
|
||||
|
||||
|
|
|
@ -14,36 +14,51 @@ add_task(async () => {
|
|||
options: {
|
||||
startWithLastProfile: true,
|
||||
},
|
||||
profiles: [{
|
||||
name: "Profile1",
|
||||
path: root.leafName,
|
||||
}, {
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
}, {
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "Profile1",
|
||||
path: root.leafName,
|
||||
},
|
||||
{
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
writeProfilesIni(profileData);
|
||||
checkProfileService(profileData);
|
||||
|
||||
let env = Cc["@mozilla.org/process/environment;1"].
|
||||
getService(Ci.nsIEnvironment);
|
||||
let env = Cc["@mozilla.org/process/environment;1"].getService(
|
||||
Ci.nsIEnvironment
|
||||
);
|
||||
env.set("XRE_PROFILE_PATH", root.path);
|
||||
env.set("XRE_PROFILE_LOCAL_PATH", local.path);
|
||||
|
||||
let { rootDir, localDir, profile, didCreate } = selectStartupProfile(["-P", "Profile3"]);
|
||||
let { rootDir, localDir, profile, didCreate } = selectStartupProfile([
|
||||
"-P",
|
||||
"Profile3",
|
||||
]);
|
||||
checkStartupReason("restart");
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.ok(rootDir.equals(root), "Should have selected the right root dir.");
|
||||
Assert.ok(localDir.equals(local), "Should have selected the right local dir.");
|
||||
Assert.ok(
|
||||
localDir.equals(local),
|
||||
"Should have selected the right local dir."
|
||||
);
|
||||
Assert.ok(profile, "A named profile matches this.");
|
||||
Assert.equal(profile.name, "Profile1", "The right profile was matched.");
|
||||
|
||||
let service = getProfileService();
|
||||
Assert.notEqual(service.defaultProfile, profile, "Should not be the default profile.");
|
||||
Assert.notEqual(
|
||||
service.defaultProfile,
|
||||
profile,
|
||||
"Should not be the default profile."
|
||||
);
|
||||
});
|
||||
|
|
|
@ -10,17 +10,21 @@ add_task(async () => {
|
|||
options: {
|
||||
startWithLastProfile: true,
|
||||
},
|
||||
profiles: [{
|
||||
name: "Profile1",
|
||||
path: "Path1",
|
||||
}, {
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
}, {
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "Profile1",
|
||||
path: "Path1",
|
||||
},
|
||||
{
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
writeProfilesIni(profileData);
|
||||
|
|
|
@ -10,17 +10,21 @@ add_task(async () => {
|
|||
options: {
|
||||
startWithLastProfile: true,
|
||||
},
|
||||
profiles: [{
|
||||
name: "Profile1",
|
||||
path: "Path1",
|
||||
}, {
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
}, {
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "Profile1",
|
||||
path: "Path1",
|
||||
},
|
||||
{
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
writeProfilesIni(profileData);
|
||||
|
@ -31,5 +35,9 @@ add_task(async () => {
|
|||
checkStartupReason("argument-p");
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.equal(profile.name, "Profile1", "Should have chosen the right profile");
|
||||
Assert.equal(
|
||||
profile.name,
|
||||
"Profile1",
|
||||
"Should have chosen the right profile"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -11,17 +11,21 @@ add_task(async () => {
|
|||
options: {
|
||||
startWithLastProfile: true,
|
||||
},
|
||||
profiles: [{
|
||||
name: "Profile1",
|
||||
path: "Path1",
|
||||
}, {
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
}, {
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "Profile1",
|
||||
path: "Path1",
|
||||
},
|
||||
{
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
writeProfilesIni(profileData);
|
||||
|
|
|
@ -10,17 +10,21 @@ add_task(async () => {
|
|||
options: {
|
||||
startWithLastProfile: true,
|
||||
},
|
||||
profiles: [{
|
||||
name: "Profile1",
|
||||
path: "Path1",
|
||||
}, {
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
}, {
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "Profile1",
|
||||
path: "Path1",
|
||||
},
|
||||
{
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
writeProfilesIni(profileData);
|
||||
|
|
|
@ -13,11 +13,13 @@ add_task(async () => {
|
|||
writeCompatibilityIni(defaultProfile);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: false,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: false,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
let { profile: selectedProfile, didCreate } = selectStartupProfile();
|
||||
|
@ -26,23 +28,51 @@ add_task(async () => {
|
|||
let hash = xreDirProvider.getInstallHash();
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 1, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
1,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, "default", "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should be marked as the old-style default.");
|
||||
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should be only one known install.");
|
||||
Assert.equal(profileData.installs[hash].default, defaultProfile.leafName, "Should have marked the original default profile as the default for this install.");
|
||||
Assert.ok(!profileData.installs[hash].locked, "Should not have locked as we're not the default app.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should be only one known install."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
defaultProfile.leafName,
|
||||
"Should have marked the original default profile as the default for this install."
|
||||
);
|
||||
Assert.ok(
|
||||
!profileData.installs[hash].locked,
|
||||
"Should not have locked as we're not the default app."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
let service = getProfileService();
|
||||
Assert.ok(!service.createdAlternateProfile, "Should not have created an alternate profile.");
|
||||
Assert.ok(selectedProfile.rootDir.equals(defaultProfile), "Should be using the right directory.");
|
||||
Assert.ok(
|
||||
!service.createdAlternateProfile,
|
||||
"Should not have created an alternate profile."
|
||||
);
|
||||
Assert.ok(
|
||||
selectedProfile.rootDir.equals(defaultProfile),
|
||||
"Should be using the right directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, "default");
|
||||
});
|
||||
|
|
|
@ -16,23 +16,36 @@ add_task(async () => {
|
|||
writeCompatibilityIni(defaultProfile, greDir, greDir);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: false,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: false,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
let service = getProfileService();
|
||||
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 1, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
1,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, "default", "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
Assert.ok(!profileData.installs, "Should be no defaults for installs yet.");
|
||||
|
@ -42,15 +55,25 @@ add_task(async () => {
|
|||
let { profile: selectedProfile, didCreate } = selectStartupProfile();
|
||||
checkStartupReason("firstrun-skipped-default");
|
||||
Assert.ok(didCreate, "Should have created a new profile.");
|
||||
Assert.ok(service.createdAlternateProfile, "Should have created an alternate profile.");
|
||||
Assert.ok(!selectedProfile.rootDir.equals(defaultProfile), "Should be using the right directory.");
|
||||
Assert.ok(
|
||||
service.createdAlternateProfile,
|
||||
"Should have created an alternate profile."
|
||||
);
|
||||
Assert.ok(
|
||||
!selectedProfile.rootDir.equals(defaultProfile),
|
||||
"Should be using the right directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, DEDICATED_NAME);
|
||||
|
||||
profileData = readProfilesIni();
|
||||
|
||||
profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, "default", "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should now be marked as the old-style default.");
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
|
|
@ -18,17 +18,21 @@ add_task(async () => {
|
|||
options: {
|
||||
startWithLastProfile: true,
|
||||
},
|
||||
profiles: [{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: root.leafName,
|
||||
default: true,
|
||||
}, {
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
}, {
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: root.leafName,
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
},
|
||||
{
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
},
|
||||
],
|
||||
// Another install is using the profile and it is locked.
|
||||
installs: {
|
||||
otherinstall: {
|
||||
|
@ -41,8 +45,9 @@ add_task(async () => {
|
|||
writeProfilesIni(profileData);
|
||||
checkProfileService(profileData);
|
||||
|
||||
let env = Cc["@mozilla.org/process/environment;1"].
|
||||
getService(Ci.nsIEnvironment);
|
||||
let env = Cc["@mozilla.org/process/environment;1"].getService(
|
||||
Ci.nsIEnvironment
|
||||
);
|
||||
env.set("XRE_PROFILE_PATH", root.path);
|
||||
env.set("XRE_PROFILE_LOCAL_PATH", local.path);
|
||||
|
||||
|
@ -51,30 +56,79 @@ add_task(async () => {
|
|||
|
||||
// Since there is already a profile with the desired name on dev-edition, a
|
||||
// unique version will be used.
|
||||
let expectedName = AppConstants.MOZ_DEV_EDITION ? `${DEDICATED_NAME}-1` : DEDICATED_NAME;
|
||||
let expectedName = AppConstants.MOZ_DEV_EDITION
|
||||
? `${DEDICATED_NAME}-1`
|
||||
: DEDICATED_NAME;
|
||||
|
||||
Assert.ok(didCreate, "Should have created a new profile.");
|
||||
Assert.ok(!rootDir.equals(root), "Should have selected the right root dir.");
|
||||
Assert.ok(!localDir.equals(local), "Should have selected the right local dir.");
|
||||
Assert.ok(
|
||||
!localDir.equals(local),
|
||||
"Should have selected the right local dir."
|
||||
);
|
||||
Assert.ok(profile, "A named profile was returned.");
|
||||
Assert.equal(profile.name, expectedName, "The right profile name was used.");
|
||||
|
||||
let service = getProfileService();
|
||||
Assert.equal(service.defaultProfile, profile, "Should be the default profile.");
|
||||
Assert.equal(service.currentProfile, profile, "Should be the current profile.");
|
||||
Assert.equal(
|
||||
service.defaultProfile,
|
||||
profile,
|
||||
"Should be the default profile."
|
||||
);
|
||||
Assert.equal(
|
||||
service.currentProfile,
|
||||
profile,
|
||||
"Should be the current profile."
|
||||
);
|
||||
|
||||
profileData = readProfilesIni();
|
||||
|
||||
Assert.equal(profileData.profiles[0].name, PROFILE_DEFAULT, "Should be the right profile.");
|
||||
Assert.ok(profileData.profiles[0].default, "Should be the old default profile.");
|
||||
Assert.equal(profileData.profiles[0].path, root.leafName, "Should be the correct path.");
|
||||
Assert.equal(profileData.profiles[1].name, expectedName, "Should be the right profile.");
|
||||
Assert.ok(!profileData.profiles[1].default, "Should not be the old default profile.");
|
||||
Assert.equal(
|
||||
profileData.profiles[0].name,
|
||||
PROFILE_DEFAULT,
|
||||
"Should be the right profile."
|
||||
);
|
||||
Assert.ok(
|
||||
profileData.profiles[0].default,
|
||||
"Should be the old default profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles[0].path,
|
||||
root.leafName,
|
||||
"Should be the correct path."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles[1].name,
|
||||
expectedName,
|
||||
"Should be the right profile."
|
||||
);
|
||||
Assert.ok(
|
||||
!profileData.profiles[1].default,
|
||||
"Should not be the old default profile."
|
||||
);
|
||||
|
||||
let hash = xreDirProvider.getInstallHash();
|
||||
Assert.equal(Object.keys(profileData.installs).length, 2, "Should be one known install.");
|
||||
Assert.notEqual(profileData.installs[hash].default, root.leafName, "Should have marked the original default profile as the default for this install.");
|
||||
Assert.ok(profileData.installs[hash].locked, "Should have locked as we created the profile for this install.");
|
||||
Assert.equal(profileData.installs.otherinstall.default, root.leafName, "Should have left the other profile as the default for the other install.");
|
||||
Assert.ok(profileData.installs[hash].locked, "Should still be locked to the other install.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
2,
|
||||
"Should be one known install."
|
||||
);
|
||||
Assert.notEqual(
|
||||
profileData.installs[hash].default,
|
||||
root.leafName,
|
||||
"Should have marked the original default profile as the default for this install."
|
||||
);
|
||||
Assert.ok(
|
||||
profileData.installs[hash].locked,
|
||||
"Should have locked as we created the profile for this install."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs.otherinstall.default,
|
||||
root.leafName,
|
||||
"Should have left the other profile as the default for the other install."
|
||||
);
|
||||
Assert.ok(
|
||||
profileData.installs[hash].locked,
|
||||
"Should still be locked to the other install."
|
||||
);
|
||||
});
|
||||
|
|
|
@ -15,11 +15,13 @@ add_task(async () => {
|
|||
writeCompatibilityIni(defaultProfile, greDir, greDir);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
simulateSnapEnvironment();
|
||||
|
@ -30,19 +32,36 @@ add_task(async () => {
|
|||
let profileData = readProfilesIni();
|
||||
let installsINI = gDataHome.clone();
|
||||
installsINI.append("installs.ini");
|
||||
Assert.ok(!installsINI.exists(), "Installs database should not have been created.");
|
||||
Assert.ok(
|
||||
!installsINI.exists(),
|
||||
"Installs database should not have been created."
|
||||
);
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 1, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
1,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, PROFILE_DEFAULT, "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should be marked as the old-style default.");
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.ok(selectedProfile.rootDir.equals(defaultProfile), "Should be using the right directory.");
|
||||
Assert.ok(
|
||||
selectedProfile.rootDir.equals(defaultProfile),
|
||||
"Should be using the right directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, PROFILE_DEFAULT);
|
||||
});
|
||||
|
|
|
@ -13,7 +13,11 @@ add_task(async () => {
|
|||
checkStartupReason("firstrun-created-default");
|
||||
|
||||
Assert.ok(didCreate, "Should have created a new profile.");
|
||||
Assert.equal(profile.name, PROFILE_DEFAULT, "Should have used the normal name.");
|
||||
Assert.equal(
|
||||
profile.name,
|
||||
PROFILE_DEFAULT,
|
||||
"Should have used the normal name."
|
||||
);
|
||||
if (AppConstants.MOZ_DEV_EDITION) {
|
||||
Assert.equal(service.profileCount, 2, "Should be two profiles.");
|
||||
} else {
|
||||
|
|
|
@ -18,17 +18,21 @@ add_task(async () => {
|
|||
options: {
|
||||
startWithLastProfile: true,
|
||||
},
|
||||
profiles: [{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: root.leafName,
|
||||
default: true,
|
||||
}, {
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
}, {
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: root.leafName,
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
},
|
||||
{
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
},
|
||||
],
|
||||
// Another install is using the profile but it isn't locked.
|
||||
installs: {
|
||||
otherinstall: {
|
||||
|
@ -40,8 +44,9 @@ add_task(async () => {
|
|||
writeProfilesIni(profileData);
|
||||
checkProfileService(profileData);
|
||||
|
||||
let env = Cc["@mozilla.org/process/environment;1"].
|
||||
getService(Ci.nsIEnvironment);
|
||||
let env = Cc["@mozilla.org/process/environment;1"].getService(
|
||||
Ci.nsIEnvironment
|
||||
);
|
||||
env.set("XRE_PROFILE_PATH", root.path);
|
||||
env.set("XRE_PROFILE_LOCAL_PATH", local.path);
|
||||
|
||||
|
@ -50,21 +55,50 @@ add_task(async () => {
|
|||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.ok(rootDir.equals(root), "Should have selected the right root dir.");
|
||||
Assert.ok(localDir.equals(local), "Should have selected the right local dir.");
|
||||
Assert.ok(
|
||||
localDir.equals(local),
|
||||
"Should have selected the right local dir."
|
||||
);
|
||||
Assert.ok(profile, "A named profile matches this.");
|
||||
Assert.equal(profile.name, PROFILE_DEFAULT, "The right profile was matched.");
|
||||
|
||||
let service = getProfileService();
|
||||
Assert.equal(service.defaultProfile, profile, "Should be the default profile.");
|
||||
Assert.equal(service.currentProfile, profile, "Should be the current profile.");
|
||||
Assert.equal(
|
||||
service.defaultProfile,
|
||||
profile,
|
||||
"Should be the default profile."
|
||||
);
|
||||
Assert.equal(
|
||||
service.currentProfile,
|
||||
profile,
|
||||
"Should be the current profile."
|
||||
);
|
||||
|
||||
profileData = readProfilesIni();
|
||||
Assert.equal(profileData.profiles[0].name, PROFILE_DEFAULT, "Should be the right profile.");
|
||||
Assert.ok(profileData.profiles[0].default, "Should still be the old default profile.");
|
||||
Assert.equal(
|
||||
profileData.profiles[0].name,
|
||||
PROFILE_DEFAULT,
|
||||
"Should be the right profile."
|
||||
);
|
||||
Assert.ok(
|
||||
profileData.profiles[0].default,
|
||||
"Should still be the old default profile."
|
||||
);
|
||||
|
||||
let hash = xreDirProvider.getInstallHash();
|
||||
// The info about the other install will have been removed so it goes through first run on next startup.
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should be one known install.");
|
||||
Assert.equal(profileData.installs[hash].default, root.leafName, "Should have marked the original default profile as the default for this install.");
|
||||
Assert.ok(!profileData.installs[hash].locked, "Should not have locked as we're not the default app.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should be one known install."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
root.leafName,
|
||||
"Should have marked the original default profile as the default for this install."
|
||||
);
|
||||
Assert.ok(
|
||||
!profileData.installs[hash].locked,
|
||||
"Should not have locked as we're not the default app."
|
||||
);
|
||||
});
|
||||
|
|
|
@ -20,17 +20,21 @@ add_task(async () => {
|
|||
options: {
|
||||
startWithLastProfile: true,
|
||||
},
|
||||
profiles: [{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: root.leafName,
|
||||
default: true,
|
||||
}, {
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
}, {
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: root.leafName,
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "Profile2",
|
||||
path: "Path2",
|
||||
},
|
||||
{
|
||||
name: "Profile3",
|
||||
path: "Path3",
|
||||
},
|
||||
],
|
||||
// Another install is using the profile but it isn't locked.
|
||||
installs: {
|
||||
otherinstall: {
|
||||
|
@ -42,8 +46,9 @@ add_task(async () => {
|
|||
writeProfilesIni(profileData);
|
||||
checkProfileService(profileData);
|
||||
|
||||
let env = Cc["@mozilla.org/process/environment;1"].
|
||||
getService(Ci.nsIEnvironment);
|
||||
let env = Cc["@mozilla.org/process/environment;1"].getService(
|
||||
Ci.nsIEnvironment
|
||||
);
|
||||
env.set("XRE_PROFILE_PATH", root.path);
|
||||
env.set("XRE_PROFILE_LOCAL_PATH", local.path);
|
||||
|
||||
|
@ -52,21 +57,48 @@ add_task(async () => {
|
|||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.ok(rootDir.equals(root), "Should have selected the right root dir.");
|
||||
Assert.ok(localDir.equals(local), "Should have selected the right local dir.");
|
||||
Assert.ok(
|
||||
localDir.equals(local),
|
||||
"Should have selected the right local dir."
|
||||
);
|
||||
Assert.ok(!!profile, "A named profile matches this.");
|
||||
Assert.equal(profile.name, PROFILE_DEFAULT, "The right profile was matched.");
|
||||
|
||||
let service = getProfileService();
|
||||
Assert.ok(service.defaultProfile === profile, "Should be the default profile.");
|
||||
Assert.ok(service.currentProfile === profile, "Should be the current profile.");
|
||||
Assert.ok(
|
||||
service.defaultProfile === profile,
|
||||
"Should be the default profile."
|
||||
);
|
||||
Assert.ok(
|
||||
service.currentProfile === profile,
|
||||
"Should be the current profile."
|
||||
);
|
||||
|
||||
profileData = readProfilesIni();
|
||||
Assert.equal(profileData.profiles[0].name, PROFILE_DEFAULT, "Should be the right profile.");
|
||||
Assert.ok(profileData.profiles[0].default, "Should still be the old default profile.");
|
||||
Assert.equal(
|
||||
profileData.profiles[0].name,
|
||||
PROFILE_DEFAULT,
|
||||
"Should be the right profile."
|
||||
);
|
||||
Assert.ok(
|
||||
profileData.profiles[0].default,
|
||||
"Should still be the old default profile."
|
||||
);
|
||||
|
||||
let hash = xreDirProvider.getInstallHash();
|
||||
// The info about the other install will have been removed so it goes through first run on next startup.
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should be one known install.");
|
||||
Assert.equal(profileData.installs[hash].default, root.leafName, "Should have marked the original default profile as the default for this install.");
|
||||
Assert.ok(profileData.installs[hash].locked, "Should have locked as we're the default app.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should be one known install."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
root.leafName,
|
||||
"Should have marked the original default profile as the default for this install."
|
||||
);
|
||||
Assert.ok(
|
||||
profileData.installs[hash].locked,
|
||||
"Should have locked as we're the default app."
|
||||
);
|
||||
});
|
||||
|
|
|
@ -15,11 +15,13 @@ add_task(async () => {
|
|||
options: {
|
||||
startWithLastProfile: false,
|
||||
},
|
||||
profiles: [{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
testStartsProfileManager();
|
||||
|
|
|
@ -12,11 +12,13 @@ add_task(async () => {
|
|||
writeCompatibilityIni(defaultProfile);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
installs: {
|
||||
otherhash: {
|
||||
default: defaultProfile.leafName,
|
||||
|
@ -31,22 +33,50 @@ add_task(async () => {
|
|||
let hash = xreDirProvider.getInstallHash();
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 1, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
1,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, PROFILE_DEFAULT, "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should be marked as the old-style default.");
|
||||
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should only be one known installs.");
|
||||
Assert.equal(profileData.installs[hash].default, defaultProfile.leafName, "Should have taken the original default profile as the default for the current install.");
|
||||
Assert.ok(!profileData.installs[hash].locked, "Should not have locked as we're not the default app.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should only be one known installs."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
defaultProfile.leafName,
|
||||
"Should have taken the original default profile as the default for the current install."
|
||||
);
|
||||
Assert.ok(
|
||||
!profileData.installs[hash].locked,
|
||||
"Should not have locked as we're not the default app."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.ok(!service.createdAlternateProfile, "Should not have created an alternate profile.");
|
||||
Assert.ok(selectedProfile.rootDir.equals(defaultProfile), "Should be using the right directory.");
|
||||
Assert.ok(
|
||||
!service.createdAlternateProfile,
|
||||
"Should not have created an alternate profile."
|
||||
);
|
||||
Assert.ok(
|
||||
selectedProfile.rootDir.equals(defaultProfile),
|
||||
"Should be using the right directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, PROFILE_DEFAULT);
|
||||
});
|
||||
|
|
|
@ -12,11 +12,13 @@ add_task(async () => {
|
|||
writeCompatibilityIni(defaultProfile);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
let service = getProfileService();
|
||||
|
@ -26,22 +28,50 @@ add_task(async () => {
|
|||
let hash = xreDirProvider.getInstallHash();
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 1, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
1,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, PROFILE_DEFAULT, "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should be marked as the old-style default.");
|
||||
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should be only one known install.");
|
||||
Assert.equal(profileData.installs[hash].default, defaultProfile.leafName, "Should have marked the original default profile as the default for this install.");
|
||||
Assert.ok(!profileData.installs[hash].locked, "Should not have locked as we're not the default app.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should be only one known install."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
defaultProfile.leafName,
|
||||
"Should have marked the original default profile as the default for this install."
|
||||
);
|
||||
Assert.ok(
|
||||
!profileData.installs[hash].locked,
|
||||
"Should not have locked as we're not the default app."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.ok(!service.createdAlternateProfile, "Should not have created an alternate profile.");
|
||||
Assert.ok(selectedProfile.rootDir.equals(defaultProfile), "Should be using the right directory.");
|
||||
Assert.ok(
|
||||
!service.createdAlternateProfile,
|
||||
"Should not have created an alternate profile."
|
||||
);
|
||||
Assert.ok(
|
||||
selectedProfile.rootDir.equals(defaultProfile),
|
||||
"Should be using the right directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, PROFILE_DEFAULT);
|
||||
});
|
||||
|
|
|
@ -12,11 +12,13 @@ add_task(async () => {
|
|||
let defaultProfile = makeRandomProfileDir("default");
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
let service = getProfileService();
|
||||
|
@ -25,30 +27,64 @@ add_task(async () => {
|
|||
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 2, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
2,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
// Since there is already a profile with the desired name on dev-edition, a
|
||||
// unique version will be used.
|
||||
let expectedName = AppConstants.MOZ_DEV_EDITION ? `${DEDICATED_NAME}-1` : DEDICATED_NAME;
|
||||
let expectedName = AppConstants.MOZ_DEV_EDITION
|
||||
? `${DEDICATED_NAME}-1`
|
||||
: DEDICATED_NAME;
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, PROFILE_DEFAULT, "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should be marked as the old-style default.");
|
||||
profile = profileData.profiles[1];
|
||||
Assert.equal(profile.name, expectedName, "Should have the right name.");
|
||||
Assert.notEqual(profile.path, defaultProfile.leafName, "Should not be the original default profile.");
|
||||
Assert.notEqual(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should not be the original default profile."
|
||||
);
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should be a default for installs.");
|
||||
Assert.equal(profileData.installs[hash].default, profile.path, "Should have the right default profile.");
|
||||
Assert.ok(profileData.installs[hash].locked, "Should have locked as we created this profile for this install.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should be a default for installs."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
profile.path,
|
||||
"Should have the right default profile."
|
||||
);
|
||||
Assert.ok(
|
||||
profileData.installs[hash].locked,
|
||||
"Should have locked as we created this profile for this install."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(didCreate, "Should have created a new profile.");
|
||||
Assert.ok(!service.createdAlternateProfile, "Should not have created an alternate profile.");
|
||||
Assert.ok(!selectedProfile.rootDir.equals(defaultProfile), "Should not be using the old directory.");
|
||||
Assert.ok(
|
||||
!service.createdAlternateProfile,
|
||||
"Should not have created an alternate profile."
|
||||
);
|
||||
Assert.ok(
|
||||
!selectedProfile.rootDir.equals(defaultProfile),
|
||||
"Should not be using the old directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, expectedName);
|
||||
});
|
||||
|
|
|
@ -16,11 +16,13 @@ add_task(async () => {
|
|||
writeCompatibilityIni(defaultProfile, greDir, greDir);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: PROFILE_DEFAULT,
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
let service = getProfileService();
|
||||
|
@ -29,30 +31,64 @@ add_task(async () => {
|
|||
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 2, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
2,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
// Since there is already a profile with the desired name on dev-edition, a
|
||||
// unique version will be used.
|
||||
let expectedName = AppConstants.MOZ_DEV_EDITION ? `${DEDICATED_NAME}-1` : DEDICATED_NAME;
|
||||
let expectedName = AppConstants.MOZ_DEV_EDITION
|
||||
? `${DEDICATED_NAME}-1`
|
||||
: DEDICATED_NAME;
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, PROFILE_DEFAULT, "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should be marked as the old-style default.");
|
||||
profile = profileData.profiles[1];
|
||||
Assert.equal(profile.name, expectedName, "Should have the right name.");
|
||||
Assert.notEqual(profile.path, defaultProfile.leafName, "Should not be the original default profile.");
|
||||
Assert.notEqual(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should not be the original default profile."
|
||||
);
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
Assert.equal(Object.keys(profileData.installs).length, 1, "Should be a default for this install.");
|
||||
Assert.equal(profileData.installs[hash].default, profile.path, "Should have marked the new profile as the default for this install.");
|
||||
Assert.ok(profileData.installs[hash].locked, "Should have locked as we created this profile for this install.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
1,
|
||||
"Should be a default for this install."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
profile.path,
|
||||
"Should have marked the new profile as the default for this install."
|
||||
);
|
||||
Assert.ok(
|
||||
profileData.installs[hash].locked,
|
||||
"Should have locked as we created this profile for this install."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(didCreate, "Should have created a new profile.");
|
||||
Assert.ok(service.createdAlternateProfile, "Should have created an alternate profile.");
|
||||
Assert.ok(!selectedProfile.rootDir.equals(defaultProfile), "Should be using the right directory.");
|
||||
Assert.ok(
|
||||
service.createdAlternateProfile,
|
||||
"Should have created an alternate profile."
|
||||
);
|
||||
Assert.ok(
|
||||
!selectedProfile.rootDir.equals(defaultProfile),
|
||||
"Should be using the right directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, expectedName);
|
||||
});
|
||||
|
|
|
@ -15,22 +15,26 @@ add_task(async () => {
|
|||
writeCompatibilityIni(defaultProfile);
|
||||
|
||||
writeProfilesIni({
|
||||
profiles: [{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
}, {
|
||||
name: "dedicated",
|
||||
path: dedicatedProfile.leafName,
|
||||
}, {
|
||||
name: "dev-edition-default",
|
||||
path: devProfile.leafName,
|
||||
}],
|
||||
profiles: [
|
||||
{
|
||||
name: "default",
|
||||
path: defaultProfile.leafName,
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
name: "dedicated",
|
||||
path: dedicatedProfile.leafName,
|
||||
},
|
||||
{
|
||||
name: "dev-edition-default",
|
||||
path: devProfile.leafName,
|
||||
},
|
||||
],
|
||||
installs: {
|
||||
[hash]: {
|
||||
default: dedicatedProfile.leafName,
|
||||
},
|
||||
"otherhash": {
|
||||
otherhash: {
|
||||
default: "foobar",
|
||||
},
|
||||
},
|
||||
|
@ -41,26 +45,56 @@ add_task(async () => {
|
|||
|
||||
let profileData = readProfilesIni();
|
||||
|
||||
Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
|
||||
Assert.equal(profileData.profiles.length, 3, "Should have the right number of profiles.");
|
||||
Assert.ok(
|
||||
profileData.options.startWithLastProfile,
|
||||
"Should be set to start with the last profile."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.profiles.length,
|
||||
3,
|
||||
"Should have the right number of profiles."
|
||||
);
|
||||
|
||||
let profile = profileData.profiles[0];
|
||||
Assert.equal(profile.name, `dedicated`, "Should have the right name.");
|
||||
Assert.equal(profile.path, dedicatedProfile.leafName, "Should be the expected dedicated profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
dedicatedProfile.leafName,
|
||||
"Should be the expected dedicated profile."
|
||||
);
|
||||
Assert.ok(!profile.default, "Should not be marked as the old-style default.");
|
||||
|
||||
profile = profileData.profiles[1];
|
||||
Assert.equal(profile.name, "default", "Should have the right name.");
|
||||
Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
|
||||
Assert.equal(
|
||||
profile.path,
|
||||
defaultProfile.leafName,
|
||||
"Should be the original default profile."
|
||||
);
|
||||
Assert.ok(profile.default, "Should be marked as the old-style default.");
|
||||
|
||||
Assert.equal(Object.keys(profileData.installs).length, 2, "Should be two known installs.");
|
||||
Assert.equal(profileData.installs[hash].default, dedicatedProfile.leafName, "Should have kept the default for this install.");
|
||||
Assert.equal(profileData.installs.otherhash.default, "foobar", "Should have kept the default for the other install.");
|
||||
Assert.equal(
|
||||
Object.keys(profileData.installs).length,
|
||||
2,
|
||||
"Should be two known installs."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs[hash].default,
|
||||
dedicatedProfile.leafName,
|
||||
"Should have kept the default for this install."
|
||||
);
|
||||
Assert.equal(
|
||||
profileData.installs.otherhash.default,
|
||||
"foobar",
|
||||
"Should have kept the default for the other install."
|
||||
);
|
||||
|
||||
checkProfileService(profileData);
|
||||
|
||||
Assert.ok(!didCreate, "Should not have created a new profile.");
|
||||
Assert.ok(selectedProfile.rootDir.equals(dedicatedProfile), "Should be using the right directory.");
|
||||
Assert.ok(
|
||||
selectedProfile.rootDir.equals(dedicatedProfile),
|
||||
"Should be using the right directory."
|
||||
);
|
||||
Assert.equal(selectedProfile.name, "dedicated");
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче