Backed out changeset 101063793364 (bug 1894239) for causing mochitests failures in browser_sentence_case_strings.js. CLOSED TREE
This commit is contained in:
@@ -21,8 +21,7 @@ var gProfiles = {
|
|||||||
"PROFILES_ENABLED",
|
"PROFILES_ENABLED",
|
||||||
"browser.profiles.enabled",
|
"browser.profiles.enabled",
|
||||||
false,
|
false,
|
||||||
this.toggleProfileButtonVisibility.bind(this),
|
this.toggleProfileButtonVisibility.bind(this)
|
||||||
() => SelectableProfileService?.isEnabled
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!this.PROFILES_ENABLED) {
|
if (!this.PROFILES_ENABLED) {
|
||||||
|
|||||||
@@ -73,9 +73,7 @@ add_task(async function () {
|
|||||||
async function openSubViewsRecursively(currentView) {
|
async function openSubViewsRecursively(currentView) {
|
||||||
let navButtons = Array.from(
|
let navButtons = Array.from(
|
||||||
// Ensure that only enabled buttons are tested
|
// Ensure that only enabled buttons are tested
|
||||||
currentView.querySelectorAll(
|
currentView.querySelectorAll(".subviewbutton-nav:not([disabled])")
|
||||||
".subviewbutton-nav:not([disabled]):not([hidden])"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
if (!navButtons) {
|
if (!navButtons) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -100,9 +100,6 @@ var gExceptionPaths = [
|
|||||||
|
|
||||||
// The ONNX runtime picks files to run programmaticaly
|
// The ONNX runtime picks files to run programmaticaly
|
||||||
"chrome://global/content/ml/",
|
"chrome://global/content/ml/",
|
||||||
|
|
||||||
// The profile avatars are directly referenced.
|
|
||||||
"chrome://browser/content/profiles/assets/",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// These are not part of the omni.ja file, so we find them only when running
|
// These are not part of the omni.ja file, so we find them only when running
|
||||||
|
|||||||
@@ -1957,7 +1957,10 @@ BrowserGlue.prototype = {
|
|||||||
|
|
||||||
lazy.DoHController.init();
|
lazy.DoHController.init();
|
||||||
|
|
||||||
if (AppConstants.MOZ_SELECTABLE_PROFILES) {
|
if (
|
||||||
|
AppConstants.MOZ_SELECTABLE_PROFILES &&
|
||||||
|
Services.prefs.getBoolPref("browser.profiles.enabled", false)
|
||||||
|
) {
|
||||||
lazy.SelectableProfileService.init().catch(console.error);
|
lazy.SelectableProfileService.init().catch(console.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -588,9 +588,9 @@ const TargetingGetters = {
|
|||||||
},
|
},
|
||||||
get canCreateSelectableProfiles() {
|
get canCreateSelectableProfiles() {
|
||||||
if (!AppConstants.MOZ_SELECTABLE_PROFILES) {
|
if (!AppConstants.MOZ_SELECTABLE_PROFILES) {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
return lazy.SelectableProfileService?.isEnabled ?? false;
|
return !!lazy.SelectableProfileService?.groupToolkitProfile;
|
||||||
},
|
},
|
||||||
get hasSelectableProfiles() {
|
get hasSelectableProfiles() {
|
||||||
return !!lazy.profileStoreID;
|
return !!lazy.profileStoreID;
|
||||||
|
|||||||
@@ -219,16 +219,6 @@ add_task(async function check_canCreateSelectableProfiles() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
is(
|
|
||||||
await ASRouterTargeting.Environment.canCreateSelectableProfiles,
|
|
||||||
false,
|
|
||||||
"The new profiles feature doesn't support standalone profiles which are used in automation."
|
|
||||||
);
|
|
||||||
|
|
||||||
// We have to fake there being a real profile available and enable the profiles feature
|
|
||||||
await pushPrefs(["browser.profiles.enabled", "someValue"]);
|
|
||||||
await SelectableProfileService.resetProfileService({ currentProfile: {} });
|
|
||||||
|
|
||||||
is(
|
is(
|
||||||
await ASRouterTargeting.Environment.canCreateSelectableProfiles,
|
await ASRouterTargeting.Environment.canCreateSelectableProfiles,
|
||||||
true,
|
true,
|
||||||
@@ -241,8 +231,6 @@ add_task(async function check_canCreateSelectableProfiles() {
|
|||||||
message,
|
message,
|
||||||
"should select correct item by canCreateSelectableProfiles"
|
"should select correct item by canCreateSelectableProfiles"
|
||||||
);
|
);
|
||||||
|
|
||||||
await SelectableProfileService.resetProfileService(null);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(async function check_hasSelectableProfiles() {
|
add_task(async function check_hasSelectableProfiles() {
|
||||||
|
|||||||
@@ -118,13 +118,6 @@ class SelectableProfileServiceClass {
|
|||||||
this.#asyncShutdownBlocker = () => this.uninit();
|
this.#asyncShutdownBlocker = () => this.uninit();
|
||||||
}
|
}
|
||||||
|
|
||||||
get isEnabled() {
|
|
||||||
return (
|
|
||||||
Services.prefs.getBoolPref("browser.profiles.enabled", false) &&
|
|
||||||
!!(this.#storeID || this.#groupToolkitProfile)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For use in testing only, override the profile service with a mock version
|
* For use in testing only, override the profile service with a mock version
|
||||||
* and reset state accordingly.
|
* and reset state accordingly.
|
||||||
@@ -265,10 +258,6 @@ class SelectableProfileServiceClass {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the storeID doesn't exist, we don't want to create the db until we
|
// If the storeID doesn't exist, we don't want to create the db until we
|
||||||
// need to so we early return.
|
// need to so we early return.
|
||||||
if (!this.storeID) {
|
if (!this.storeID) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
:host {
|
:host {
|
||||||
--header-avatar-size: 80px;
|
--header-avatar-size: 80px;
|
||||||
|
--header-avatar-img-size: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
html,
|
html,
|
||||||
|
|||||||
@@ -52,9 +52,8 @@ moz-card {
|
|||||||
padding-inline-start: var(--space-medium);
|
padding-inline-start: var(--space-medium);
|
||||||
padding-block: var(--space-small);
|
padding-block: var(--space-small);
|
||||||
|
|
||||||
border-inline-width: var(--theme-card-border-width);
|
border-width: var(--theme-card-border-width);
|
||||||
border-block-end-width: var(--theme-card-border-width);
|
border-top: var(--card-border);
|
||||||
border-block-start: var(--card-border);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:host([selected]) .theme-card {
|
:host([selected]) .theme-card {
|
||||||
|
|||||||
@@ -6,6 +6,13 @@
|
|||||||
const NEW_PROFILE_NAME = "This is a new profile name";
|
const NEW_PROFILE_NAME = "This is a new profile name";
|
||||||
|
|
||||||
add_task(async function test_create_profile_name() {
|
add_task(async function test_create_profile_name() {
|
||||||
|
if (!AppConstants.MOZ_SELECTABLE_PROFILES) {
|
||||||
|
// `mochitest-browser` suite `add_task` does not yet support
|
||||||
|
// `properties.skip_if`.
|
||||||
|
ok(true, "Skipping because !AppConstants.MOZ_SELECTABLE_PROFILES");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await SpecialPowers.pushPrefEnv({
|
await SpecialPowers.pushPrefEnv({
|
||||||
set: [["browser.profiles.profile-name.updated", false]],
|
set: [["browser.profiles.profile-name.updated", false]],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,6 +6,13 @@
|
|||||||
const NEW_PROFILE_NAME = "This is a new profile name";
|
const NEW_PROFILE_NAME = "This is a new profile name";
|
||||||
|
|
||||||
add_task(async function test_edit_profile_name() {
|
add_task(async function test_edit_profile_name() {
|
||||||
|
if (!AppConstants.MOZ_SELECTABLE_PROFILES) {
|
||||||
|
// `mochitest-browser` suite `add_task` does not yet support
|
||||||
|
// `properties.skip_if`.
|
||||||
|
ok(true, "Skipping because !AppConstants.MOZ_SELECTABLE_PROFILES");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await initGroupDatabase();
|
await initGroupDatabase();
|
||||||
let profile = SelectableProfileService.currentProfile;
|
let profile = SelectableProfileService.currentProfile;
|
||||||
Assert.ok(profile, "Should have a profile now");
|
Assert.ok(profile, "Should have a profile now");
|
||||||
|
|||||||
@@ -4,6 +4,13 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
add_task(async function test_dbLazilyCreated() {
|
add_task(async function test_dbLazilyCreated() {
|
||||||
|
if (!AppConstants.MOZ_SELECTABLE_PROFILES) {
|
||||||
|
// `mochitest-browser` suite `add_task` does not yet support
|
||||||
|
// `properties.skip_if`.
|
||||||
|
ok(true, "Skipping because !AppConstants.MOZ_SELECTABLE_PROFILES");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Assert.ok(
|
Assert.ok(
|
||||||
!SelectableProfileService.initialized,
|
!SelectableProfileService.initialized,
|
||||||
`Selectable Profile Service should not be initialized because the default profile has no storeID`
|
`Selectable Profile Service should not be initialized because the default profile has no storeID`
|
||||||
|
|||||||
@@ -4,6 +4,13 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
add_task(async function test_selector_window() {
|
add_task(async function test_selector_window() {
|
||||||
|
if (!AppConstants.MOZ_SELECTABLE_PROFILES) {
|
||||||
|
// `mochitest-browser` suite `add_task` does not yet support
|
||||||
|
// `properties.skip_if`.
|
||||||
|
ok(true, "Skipping because !AppConstants.MOZ_SELECTABLE_PROFILES");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await initGroupDatabase();
|
await initGroupDatabase();
|
||||||
let profile = SelectableProfileService.currentProfile;
|
let profile = SelectableProfileService.currentProfile;
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ const { SelectableProfile } = ChromeUtils.importESModule(
|
|||||||
);
|
);
|
||||||
|
|
||||||
add_task(async function test_updateDefaultProfileOnWindowSwitch() {
|
add_task(async function test_updateDefaultProfileOnWindowSwitch() {
|
||||||
|
if (!AppConstants.MOZ_SELECTABLE_PROFILES) {
|
||||||
|
// `mochitest-browser` suite `add_task` does not yet support
|
||||||
|
// `properties.skip_if`.
|
||||||
|
ok(true, "Skipping because !AppConstants.MOZ_SELECTABLE_PROFILES");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await initGroupDatabase();
|
await initGroupDatabase();
|
||||||
let currentProfile = SelectableProfileService.currentProfile;
|
let currentProfile = SelectableProfileService.currentProfile;
|
||||||
let profileRootDir = await currentProfile.rootDir;
|
let profileRootDir = await currentProfile.rootDir;
|
||||||
|
|||||||
@@ -3,27 +3,32 @@ https://creativecommons.org/publicdomain/zero/1.0/ */
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
add_task(async function test_recover_storeID() {
|
add_task(
|
||||||
startProfileService();
|
{
|
||||||
Services.prefs.setCharPref("toolkit.profiles.storeID", "foobar");
|
skip_if: () => !AppConstants.MOZ_SELECTABLE_PROFILES,
|
||||||
|
},
|
||||||
|
async function test_recover_storeID() {
|
||||||
|
startProfileService();
|
||||||
|
Services.prefs.setCharPref("toolkit.profiles.storeID", "foobar");
|
||||||
|
|
||||||
const SelectableProfileService = getSelectableProfileService();
|
const SelectableProfileService = getSelectableProfileService();
|
||||||
await SelectableProfileService.init();
|
await SelectableProfileService.init();
|
||||||
Assert.ok(
|
Assert.ok(
|
||||||
!SelectableProfileService.initialized,
|
!SelectableProfileService.initialized,
|
||||||
"Didn't initialize the service"
|
"Didn't initialize the service"
|
||||||
);
|
);
|
||||||
|
|
||||||
let profile = SelectableProfileService.currentProfile;
|
let profile = SelectableProfileService.currentProfile;
|
||||||
Assert.ok(!profile, "Should not have a current profile");
|
Assert.ok(!profile, "Should not have a current profile");
|
||||||
Assert.equal(
|
Assert.equal(
|
||||||
getProfileService().currentProfile.storeID,
|
getProfileService().currentProfile.storeID,
|
||||||
null,
|
null,
|
||||||
"Should not have updated the store ID on the profile"
|
"Should not have updated the store ID on the profile"
|
||||||
);
|
);
|
||||||
|
|
||||||
Assert.ok(
|
Assert.ok(
|
||||||
!Services.prefs.prefHasUserValue("toolkit.profiles.storeID"),
|
!Services.prefs.prefHasUserValue("toolkit.profiles.storeID"),
|
||||||
"Should have cleared the storeID pref"
|
"Should have cleared the storeID pref"
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|||||||
@@ -7,27 +7,33 @@ const { Sqlite } = ChromeUtils.importESModule(
|
|||||||
"resource://gre/modules/Sqlite.sys.mjs"
|
"resource://gre/modules/Sqlite.sys.mjs"
|
||||||
);
|
);
|
||||||
|
|
||||||
add_task(async function test_recover_storeID() {
|
add_task(
|
||||||
startProfileService();
|
{
|
||||||
Services.prefs.setCharPref("toolkit.profiles.storeID", "foobar");
|
skip_if: () => !AppConstants.MOZ_SELECTABLE_PROFILES,
|
||||||
|
},
|
||||||
|
async function test_recover_storeID() {
|
||||||
|
startProfileService();
|
||||||
|
Services.prefs.setCharPref("toolkit.profiles.storeID", "foobar");
|
||||||
|
|
||||||
// The database needs to exist already
|
// The database needs to exist already
|
||||||
let groupsPath = PathUtils.join(
|
let groupsPath = PathUtils.join(
|
||||||
Services.dirsvc.get("UAppData", Ci.nsIFile).path,
|
Services.dirsvc.get("UAppData", Ci.nsIFile).path,
|
||||||
"Profile Groups"
|
"Profile Groups"
|
||||||
);
|
);
|
||||||
|
|
||||||
await IOUtils.makeDirectory(groupsPath);
|
await IOUtils.makeDirectory(groupsPath);
|
||||||
let dbFile = PathUtils.join(groupsPath, "foobar.sqlite");
|
let dbFile = PathUtils.join(groupsPath, "foobar.sqlite");
|
||||||
let db = await Sqlite.openConnection({
|
let db = await Sqlite.openConnection({
|
||||||
path: dbFile,
|
path: dbFile,
|
||||||
openNotExclusive: true,
|
openNotExclusive: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
let path = getRelativeProfilePath(getProfileService().currentProfile.rootDir);
|
let path = getRelativeProfilePath(
|
||||||
|
getProfileService().currentProfile.rootDir
|
||||||
|
);
|
||||||
|
|
||||||
// Slightly annoying we have to replicate this...
|
// Slightly annoying we have to replicate this...
|
||||||
await db.execute(`CREATE TABLE IF NOT EXISTS "Profiles" (
|
await db.execute(`CREATE TABLE IF NOT EXISTS "Profiles" (
|
||||||
id INTEGER NOT NULL,
|
id INTEGER NOT NULL,
|
||||||
path TEXT NOT NULL UNIQUE,
|
path TEXT NOT NULL UNIQUE,
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
@@ -37,30 +43,34 @@ add_task(async function test_recover_storeID() {
|
|||||||
themeBg TEXT NOT NULL,
|
themeBg TEXT NOT NULL,
|
||||||
PRIMARY KEY(id)
|
PRIMARY KEY(id)
|
||||||
);`);
|
);`);
|
||||||
await db.execute(
|
await db.execute(
|
||||||
`INSERT INTO Profiles VALUES (NULL, :path, :name, :avatar, :themeL10nId, :themeFg, :themeBg);`,
|
`INSERT INTO Profiles VALUES (NULL, :path, :name, :avatar, :themeL10nId, :themeFg, :themeBg);`,
|
||||||
{
|
{
|
||||||
path,
|
path,
|
||||||
name: "Fake Profile",
|
name: "Fake Profile",
|
||||||
avatar: "book",
|
avatar: "book",
|
||||||
themeL10nId: "default",
|
themeL10nId: "default",
|
||||||
themeFg: "",
|
themeFg: "",
|
||||||
themeBg: "",
|
themeBg: "",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
await db.close();
|
await db.close();
|
||||||
|
|
||||||
const SelectableProfileService = getSelectableProfileService();
|
const SelectableProfileService = getSelectableProfileService();
|
||||||
await SelectableProfileService.init();
|
await SelectableProfileService.init();
|
||||||
Assert.ok(SelectableProfileService.initialized, "Did initialize the service");
|
Assert.ok(
|
||||||
|
SelectableProfileService.initialized,
|
||||||
|
"Did initialize the service"
|
||||||
|
);
|
||||||
|
|
||||||
let profile = SelectableProfileService.currentProfile;
|
let profile = SelectableProfileService.currentProfile;
|
||||||
Assert.ok(profile, "Should have a current profile");
|
Assert.ok(profile, "Should have a current profile");
|
||||||
Assert.equal(profile.name, "Fake Profile");
|
Assert.equal(profile.name, "Fake Profile");
|
||||||
Assert.equal(
|
Assert.equal(
|
||||||
getProfileService().currentProfile.storeID,
|
getProfileService().currentProfile.storeID,
|
||||||
"foobar",
|
"foobar",
|
||||||
"Should have updated the store ID on the profile"
|
"Should have updated the store ID on the profile"
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|||||||
@@ -5,30 +5,35 @@ https://creativecommons.org/publicdomain/zero/1.0/ */
|
|||||||
|
|
||||||
add_setup(initSelectableProfileService);
|
add_setup(initSelectableProfileService);
|
||||||
|
|
||||||
add_task(async function test_launcher() {
|
add_task(
|
||||||
// mock() returns an object with a fake `runw` method that, when
|
{
|
||||||
// called, records its arguments.
|
skip_if: () => !AppConstants.MOZ_SELECTABLE_PROFILES,
|
||||||
let input = [];
|
},
|
||||||
let mock = () => {
|
async function test_launcher() {
|
||||||
return {
|
// mock() returns an object with a fake `runw` method that, when
|
||||||
runw: (...args) => {
|
// called, records its arguments.
|
||||||
input = args;
|
let input = [];
|
||||||
},
|
let mock = () => {
|
||||||
|
return {
|
||||||
|
runw: (...args) => {
|
||||||
|
input = args;
|
||||||
|
},
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
let profile = await createTestProfile();
|
let profile = await createTestProfile();
|
||||||
|
|
||||||
const SelectableProfileService = getSelectableProfileService();
|
const SelectableProfileService = getSelectableProfileService();
|
||||||
SelectableProfileService.getExecutableProcess = mock;
|
SelectableProfileService.getExecutableProcess = mock;
|
||||||
SelectableProfileService.launchInstance(profile);
|
SelectableProfileService.launchInstance(profile);
|
||||||
|
|
||||||
let expected;
|
let expected;
|
||||||
if (Services.appinfo.OS == "Darwin") {
|
if (Services.appinfo.OS == "Darwin") {
|
||||||
expected = ["-foreground", "--profile", profile.path];
|
expected = ["-foreground", "--profile", profile.path];
|
||||||
} else {
|
} else {
|
||||||
expected = ["--profile", profile.path];
|
expected = ["--profile", profile.path];
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.deepEqual(expected, input[1], "Expected runw arguments");
|
||||||
}
|
}
|
||||||
|
);
|
||||||
Assert.deepEqual(expected, input[1], "Expected runw arguments");
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -3,14 +3,19 @@ https://creativecommons.org/publicdomain/zero/1.0/ */
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
add_task(async function test_SelectableProfileAndServiceExist() {
|
add_task(
|
||||||
const { SelectableProfile } = ChromeUtils.importESModule(
|
{
|
||||||
"resource:///modules/profiles/SelectableProfile.sys.mjs"
|
skip_if: () => !AppConstants.MOZ_SELECTABLE_PROFILES,
|
||||||
);
|
},
|
||||||
const { SelectableProfileService } = ChromeUtils.importESModule(
|
async function test_SelectableProfileAndServiceExist() {
|
||||||
"resource:///modules/profiles/SelectableProfileService.sys.mjs"
|
const { SelectableProfile } = ChromeUtils.importESModule(
|
||||||
);
|
"resource:///modules/profiles/SelectableProfile.sys.mjs"
|
||||||
|
);
|
||||||
|
const { SelectableProfileService } = ChromeUtils.importESModule(
|
||||||
|
"resource:///modules/profiles/SelectableProfileService.sys.mjs"
|
||||||
|
);
|
||||||
|
|
||||||
ok(SelectableProfile, "SelectableProfile exists");
|
ok(SelectableProfile, "SelectableProfile exists");
|
||||||
ok(SelectableProfileService, "SelectableProfileService exists");
|
ok(SelectableProfileService, "SelectableProfileService exists");
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|||||||
@@ -3,116 +3,110 @@ https://creativecommons.org/publicdomain/zero/1.0/ */
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
add_task(async function test_SelectableProfileLifecycle() {
|
add_task(
|
||||||
startProfileService();
|
{
|
||||||
const SelectableProfileService = getSelectableProfileService();
|
skip_if: () => !AppConstants.MOZ_SELECTABLE_PROFILES,
|
||||||
|
},
|
||||||
|
async function test_SelectableProfileLifecycle() {
|
||||||
|
startProfileService();
|
||||||
|
const SelectableProfileService = getSelectableProfileService();
|
||||||
|
await SelectableProfileService.init();
|
||||||
|
|
||||||
Services.prefs.setBoolPref("browser.profiles.enabled", false);
|
let profiles = await SelectableProfileService.getAllProfiles();
|
||||||
await SelectableProfileService.init();
|
|
||||||
Assert.ok(
|
|
||||||
!SelectableProfileService.isEnabled,
|
|
||||||
"Service should not be enabled"
|
|
||||||
);
|
|
||||||
|
|
||||||
Services.prefs.setBoolPref("browser.profiles.enabled", true);
|
Assert.ok(!profiles.length, "No selectable profiles exist yet");
|
||||||
await SelectableProfileService.init();
|
|
||||||
Assert.ok(
|
|
||||||
SelectableProfileService.isEnabled,
|
|
||||||
"Service should now be enabled"
|
|
||||||
);
|
|
||||||
|
|
||||||
let profiles = await SelectableProfileService.getAllProfiles();
|
await SelectableProfileService.maybeSetupDataStore();
|
||||||
|
let currentProfile = SelectableProfileService.currentProfile;
|
||||||
|
|
||||||
Assert.ok(!profiles.length, "No selectable profiles exist yet");
|
const leafName = (await currentProfile.rootDir).leafName;
|
||||||
|
|
||||||
await SelectableProfileService.maybeSetupDataStore();
|
const profilePath = PathUtils.join(
|
||||||
let currentProfile = SelectableProfileService.currentProfile;
|
Services.dirsvc.get("DefProfRt", Ci.nsIFile).path,
|
||||||
|
leafName
|
||||||
const leafName = (await currentProfile.rootDir).leafName;
|
|
||||||
|
|
||||||
const profilePath = PathUtils.join(
|
|
||||||
Services.dirsvc.get("DefProfRt", Ci.nsIFile).path,
|
|
||||||
leafName
|
|
||||||
);
|
|
||||||
|
|
||||||
let profileDirExists = await IOUtils.exists(profilePath);
|
|
||||||
const profileLocalPath = PathUtils.join(
|
|
||||||
Services.dirsvc.get("DefProfLRt", Ci.nsIFile).path,
|
|
||||||
leafName
|
|
||||||
);
|
|
||||||
let profileLocalDirExists = await IOUtils.exists(profileLocalPath);
|
|
||||||
|
|
||||||
Assert.ok(
|
|
||||||
profileDirExists,
|
|
||||||
`Profile dir was successfully created at ${profilePath}`
|
|
||||||
);
|
|
||||||
Assert.ok(
|
|
||||||
profileLocalDirExists,
|
|
||||||
`Profile local dir was successfully created at ${profileLocalPath}`
|
|
||||||
);
|
|
||||||
|
|
||||||
profiles = await SelectableProfileService.getAllProfiles();
|
|
||||||
|
|
||||||
Assert.equal(profiles.length, 1, "One selectable profile exists");
|
|
||||||
|
|
||||||
let selectableProfile = profiles[0];
|
|
||||||
|
|
||||||
let profile = await SelectableProfileService.getProfile(selectableProfile.id);
|
|
||||||
|
|
||||||
for (let attr of ["id", "name", "path"]) {
|
|
||||||
Assert.equal(
|
|
||||||
profile[attr],
|
|
||||||
currentProfile[attr],
|
|
||||||
`We got the correct profile ${attr}`
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let profileDirExists = await IOUtils.exists(profilePath);
|
||||||
|
const profileLocalPath = PathUtils.join(
|
||||||
|
Services.dirsvc.get("DefProfLRt", Ci.nsIFile).path,
|
||||||
|
leafName
|
||||||
|
);
|
||||||
|
let profileLocalDirExists = await IOUtils.exists(profileLocalPath);
|
||||||
|
|
||||||
|
Assert.ok(
|
||||||
|
profileDirExists,
|
||||||
|
`Profile dir was successfully created at ${profilePath}`
|
||||||
|
);
|
||||||
|
Assert.ok(
|
||||||
|
profileLocalDirExists,
|
||||||
|
`Profile local dir was successfully created at ${profileLocalPath}`
|
||||||
|
);
|
||||||
|
|
||||||
|
profiles = await SelectableProfileService.getAllProfiles();
|
||||||
|
|
||||||
|
Assert.equal(profiles.length, 1, "One selectable profile exists");
|
||||||
|
|
||||||
|
let selectableProfile = profiles[0];
|
||||||
|
|
||||||
|
let profile = await SelectableProfileService.getProfile(
|
||||||
|
selectableProfile.id
|
||||||
|
);
|
||||||
|
|
||||||
|
for (let attr of ["id", "name", "path"]) {
|
||||||
|
Assert.equal(
|
||||||
|
profile[attr],
|
||||||
|
currentProfile[attr],
|
||||||
|
`We got the correct profile ${attr}`
|
||||||
|
);
|
||||||
|
|
||||||
|
Assert.equal(
|
||||||
|
selectableProfile[attr],
|
||||||
|
currentProfile[attr],
|
||||||
|
`We got the correct profile ${attr}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectableProfile.name = "updatedTestProfile";
|
||||||
|
|
||||||
|
await SelectableProfileService.updateProfile(selectableProfile);
|
||||||
|
|
||||||
|
profile = await SelectableProfileService.getProfile(selectableProfile.id);
|
||||||
|
|
||||||
Assert.equal(
|
Assert.equal(
|
||||||
selectableProfile[attr],
|
profile.name,
|
||||||
currentProfile[attr],
|
"updatedTestProfile",
|
||||||
`We got the correct profile ${attr}`
|
"We got the correct profile name: updatedTestProfile"
|
||||||
|
);
|
||||||
|
|
||||||
|
let newProfile = await createTestProfile({ name: "New profile" });
|
||||||
|
let rootDir = await newProfile.rootDir;
|
||||||
|
let localDir = PathUtils.join(
|
||||||
|
Services.dirsvc.get("DefProfLRt", Ci.nsIFile).path,
|
||||||
|
rootDir.leafName
|
||||||
|
);
|
||||||
|
|
||||||
|
profileDirExists = await IOUtils.exists(rootDir.path);
|
||||||
|
profileLocalDirExists = await IOUtils.exists(localDir);
|
||||||
|
Assert.ok(profileDirExists, "Profile dir was successfully created");
|
||||||
|
Assert.ok(
|
||||||
|
profileLocalDirExists,
|
||||||
|
"Profile local dir was successfully created"
|
||||||
|
);
|
||||||
|
|
||||||
|
profiles = await SelectableProfileService.getAllProfiles();
|
||||||
|
Assert.equal(profiles.length, 2, "Should now be two profiles.");
|
||||||
|
|
||||||
|
await SelectableProfileService.deleteProfile(newProfile);
|
||||||
|
|
||||||
|
profiles = await SelectableProfileService.getAllProfiles();
|
||||||
|
Assert.equal(profiles.length, 1, "Should now be one profiles.");
|
||||||
|
|
||||||
|
profileDirExists = await IOUtils.exists(rootDir.path);
|
||||||
|
profileLocalDirExists = await IOUtils.exists(localDir);
|
||||||
|
Assert.ok(!profileDirExists, "Profile dir was successfully removed");
|
||||||
|
Assert.ok(
|
||||||
|
!profileLocalDirExists,
|
||||||
|
"Profile local dir was successfully removed"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
);
|
||||||
selectableProfile.name = "updatedTestProfile";
|
|
||||||
|
|
||||||
await SelectableProfileService.updateProfile(selectableProfile);
|
|
||||||
|
|
||||||
profile = await SelectableProfileService.getProfile(selectableProfile.id);
|
|
||||||
|
|
||||||
Assert.equal(
|
|
||||||
profile.name,
|
|
||||||
"updatedTestProfile",
|
|
||||||
"We got the correct profile name: updatedTestProfile"
|
|
||||||
);
|
|
||||||
|
|
||||||
let newProfile = await createTestProfile({ name: "New profile" });
|
|
||||||
let rootDir = await newProfile.rootDir;
|
|
||||||
let localDir = PathUtils.join(
|
|
||||||
Services.dirsvc.get("DefProfLRt", Ci.nsIFile).path,
|
|
||||||
rootDir.leafName
|
|
||||||
);
|
|
||||||
|
|
||||||
profileDirExists = await IOUtils.exists(rootDir.path);
|
|
||||||
profileLocalDirExists = await IOUtils.exists(localDir);
|
|
||||||
Assert.ok(profileDirExists, "Profile dir was successfully created");
|
|
||||||
Assert.ok(
|
|
||||||
profileLocalDirExists,
|
|
||||||
"Profile local dir was successfully created"
|
|
||||||
);
|
|
||||||
|
|
||||||
profiles = await SelectableProfileService.getAllProfiles();
|
|
||||||
Assert.equal(profiles.length, 2, "Should now be two profiles.");
|
|
||||||
|
|
||||||
await SelectableProfileService.deleteProfile(newProfile);
|
|
||||||
|
|
||||||
profiles = await SelectableProfileService.getAllProfiles();
|
|
||||||
Assert.equal(profiles.length, 1, "Should now be one profiles.");
|
|
||||||
|
|
||||||
profileDirExists = await IOUtils.exists(rootDir.path);
|
|
||||||
profileLocalDirExists = await IOUtils.exists(localDir);
|
|
||||||
Assert.ok(!profileDirExists, "Profile dir was successfully removed");
|
|
||||||
Assert.ok(
|
|
||||||
!profileLocalDirExists,
|
|
||||||
"Profile local dir was successfully removed"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -5,64 +5,69 @@ https://creativecommons.org/publicdomain/zero/1.0/ */
|
|||||||
|
|
||||||
add_setup(initSelectableProfileService);
|
add_setup(initSelectableProfileService);
|
||||||
|
|
||||||
add_task(async function test_SharedPrefsLifecycle() {
|
add_task(
|
||||||
const SelectableProfileService = getSelectableProfileService();
|
{
|
||||||
let prefs = await SelectableProfileService.getAllPrefs();
|
skip_if: () => !AppConstants.MOZ_SELECTABLE_PROFILES,
|
||||||
|
},
|
||||||
|
async function test_SharedPrefsLifecycle() {
|
||||||
|
const SelectableProfileService = getSelectableProfileService();
|
||||||
|
let prefs = await SelectableProfileService.getAllPrefs();
|
||||||
|
|
||||||
Assert.equal(prefs.length, 3, "The default shared prefs exist");
|
Assert.equal(prefs.length, 3, "The default shared prefs exist");
|
||||||
|
|
||||||
await SelectableProfileService.setIntPref("testPrefInt0", 0);
|
await SelectableProfileService.setIntPref("testPrefInt0", 0);
|
||||||
await SelectableProfileService.setIntPref("testPrefInt1", 1);
|
await SelectableProfileService.setIntPref("testPrefInt1", 1);
|
||||||
await SelectableProfileService.setPref("testPrefInt2", 2);
|
await SelectableProfileService.setPref("testPrefInt2", 2);
|
||||||
|
|
||||||
await SelectableProfileService.setStringPref(
|
await SelectableProfileService.setStringPref(
|
||||||
"testPrefString0",
|
"testPrefString0",
|
||||||
"Hello world!"
|
"Hello world!"
|
||||||
);
|
);
|
||||||
await SelectableProfileService.setPref("testPrefString1", "Hello world 2!");
|
await SelectableProfileService.setPref("testPrefString1", "Hello world 2!");
|
||||||
|
|
||||||
await SelectableProfileService.setBoolPref("testPrefBoolTrue", true);
|
await SelectableProfileService.setBoolPref("testPrefBoolTrue", true);
|
||||||
await SelectableProfileService.setPref("testPrefBoolFalse", false);
|
await SelectableProfileService.setPref("testPrefBoolFalse", false);
|
||||||
|
|
||||||
prefs = await SelectableProfileService.getAllPrefs();
|
prefs = await SelectableProfileService.getAllPrefs();
|
||||||
|
|
||||||
Assert.equal(prefs.length, 10, "10 shared prefs exist");
|
Assert.equal(prefs.length, 10, "10 shared prefs exist");
|
||||||
|
|
||||||
Assert.equal(
|
Assert.equal(
|
||||||
await SelectableProfileService.getIntPref("testPrefInt0"),
|
await SelectableProfileService.getIntPref("testPrefInt0"),
|
||||||
0,
|
0,
|
||||||
"testPrefInt0 value is 0"
|
"testPrefInt0 value is 0"
|
||||||
);
|
);
|
||||||
Assert.equal(
|
Assert.equal(
|
||||||
await SelectableProfileService.getIntPref("testPrefInt1"),
|
await SelectableProfileService.getIntPref("testPrefInt1"),
|
||||||
1,
|
1,
|
||||||
"testPrefInt1 value is 1"
|
"testPrefInt1 value is 1"
|
||||||
);
|
);
|
||||||
Assert.equal(
|
Assert.equal(
|
||||||
await SelectableProfileService.getPref("testPrefInt2"),
|
await SelectableProfileService.getPref("testPrefInt2"),
|
||||||
2,
|
2,
|
||||||
"testPrefInt2 value is 2"
|
"testPrefInt2 value is 2"
|
||||||
);
|
);
|
||||||
Assert.equal(
|
Assert.equal(
|
||||||
await SelectableProfileService.getStringPref("testPrefString0"),
|
await SelectableProfileService.getStringPref("testPrefString0"),
|
||||||
"Hello world!",
|
"Hello world!",
|
||||||
'testPrefString0 value is "Hello world!"'
|
'testPrefString0 value is "Hello world!"'
|
||||||
);
|
);
|
||||||
Assert.equal(
|
Assert.equal(
|
||||||
await SelectableProfileService.getPref("testPrefString1"),
|
await SelectableProfileService.getPref("testPrefString1"),
|
||||||
"Hello world 2!",
|
"Hello world 2!",
|
||||||
'testPrefString1 value is "Hello world 2!"'
|
'testPrefString1 value is "Hello world 2!"'
|
||||||
);
|
);
|
||||||
Assert.equal(
|
Assert.equal(
|
||||||
await SelectableProfileService.getBoolPref("testPrefBoolTrue"),
|
await SelectableProfileService.getBoolPref("testPrefBoolTrue"),
|
||||||
true,
|
true,
|
||||||
"testPrefBoolTrue value is true"
|
"testPrefBoolTrue value is true"
|
||||||
);
|
);
|
||||||
Assert.equal(
|
Assert.equal(
|
||||||
await SelectableProfileService.getPref("testPrefBoolFalse"),
|
await SelectableProfileService.getPref("testPrefBoolFalse"),
|
||||||
false,
|
false,
|
||||||
"testPrefBoolFalse value is false"
|
"testPrefBoolFalse value is false"
|
||||||
);
|
);
|
||||||
|
|
||||||
await SelectableProfileService.deleteProfileGroup();
|
await SelectableProfileService.deleteProfileGroup();
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|||||||
@@ -2,10 +2,6 @@
|
|||||||
head = "../../../../../toolkit/profile/test/xpcshell/head.js head.js"
|
head = "../../../../../toolkit/profile/test/xpcshell/head.js head.js"
|
||||||
firefox-appdir = "browser"
|
firefox-appdir = "browser"
|
||||||
|
|
||||||
prefs = [
|
|
||||||
"browser.profiles.enabled=true",
|
|
||||||
]
|
|
||||||
|
|
||||||
["test_fail_recover_storeID.js"]
|
["test_fail_recover_storeID.js"]
|
||||||
|
|
||||||
["test_recover_storeID.js"]
|
["test_recover_storeID.js"]
|
||||||
|
|||||||
@@ -107,10 +107,6 @@ nsresult nsDBusRemoteClient::DoSendDBusCommandLine(const char* aProfile,
|
|||||||
int aLength) {
|
int aLength) {
|
||||||
LOG("nsDBusRemoteClient::DoSendDBusCommandLine()");
|
LOG("nsDBusRemoteClient::DoSendDBusCommandLine()");
|
||||||
|
|
||||||
if (!gAppData) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoCString appName;
|
nsAutoCString appName;
|
||||||
gAppData->GetDBusAppName(appName);
|
gAppData->GetDBusAppName(appName);
|
||||||
|
|
||||||
|
|||||||
@@ -1092,10 +1092,16 @@ with only_when(target_is_osx):
|
|||||||
|
|
||||||
# Profile Management
|
# Profile Management
|
||||||
# ==============================================================
|
# ==============================================================
|
||||||
# Selectable profiles are enabled by default.
|
# Selectable profiles are temporarily gated behind a build flag
|
||||||
|
# while we build and stabilize the backend (bug 1893315).
|
||||||
|
|
||||||
set_define("MOZ_SELECTABLE_PROFILES", True)
|
option(
|
||||||
set_config("MOZ_SELECTABLE_PROFILES", True)
|
env="MOZ_SELECTABLE_PROFILES",
|
||||||
|
help="Enable experimental and unstable profile groups",
|
||||||
|
)
|
||||||
|
|
||||||
|
set_define("MOZ_SELECTABLE_PROFILES", True, when="MOZ_SELECTABLE_PROFILES")
|
||||||
|
set_config("MOZ_SELECTABLE_PROFILES", True, when="MOZ_SELECTABLE_PROFILES")
|
||||||
|
|
||||||
project_flag(
|
project_flag(
|
||||||
"MOZ_DEDICATED_PROFILES",
|
"MOZ_DEDICATED_PROFILES",
|
||||||
|
|||||||
@@ -33,12 +33,10 @@ xreDirProvider.setUserDataDirectory(gDataHome, false);
|
|||||||
xreDirProvider.setUserDataDirectory(gDataHomeLocal, true);
|
xreDirProvider.setUserDataDirectory(gDataHomeLocal, true);
|
||||||
Services.dirsvc.set("UAppData", gDataHome);
|
Services.dirsvc.set("UAppData", gDataHome);
|
||||||
let gProfilesRoot = gDataHome.clone();
|
let gProfilesRoot = gDataHome.clone();
|
||||||
let gProfilesTemp = gDataHomeLocal.clone();
|
gProfilesRoot.append("profiles");
|
||||||
if (!AppConstants.XP_UNIX || AppConstants.platform == "macosx") {
|
|
||||||
gProfilesRoot.append("Profiles");
|
|
||||||
gProfilesTemp.append("Profiles");
|
|
||||||
}
|
|
||||||
Services.dirsvc.set("DefProfRt", gProfilesRoot);
|
Services.dirsvc.set("DefProfRt", gProfilesRoot);
|
||||||
|
let gProfilesTemp = gDataHomeLocal.clone();
|
||||||
|
gProfilesTemp.append("profiles");
|
||||||
Services.dirsvc.set("DefProfLRt", gProfilesTemp);
|
Services.dirsvc.set("DefProfLRt", gProfilesTemp);
|
||||||
|
|
||||||
let gIsDefaultApp = false;
|
let gIsDefaultApp = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user