Backed out changeset 101063793364 (bug 1894239) for causing mochitests failures in browser_sentence_case_strings.js. CLOSED TREE

This commit is contained in:
Stanca Serban
2024-11-04 20:39:11 +02:00
parent 3faf1220e7
commit 7bfaea64ba
24 changed files with 332 additions and 303 deletions

View File

@@ -21,8 +21,7 @@ var gProfiles = {
"PROFILES_ENABLED",
"browser.profiles.enabled",
false,
this.toggleProfileButtonVisibility.bind(this),
() => SelectableProfileService?.isEnabled
this.toggleProfileButtonVisibility.bind(this)
);
if (!this.PROFILES_ENABLED) {

View File

@@ -73,9 +73,7 @@ add_task(async function () {
async function openSubViewsRecursively(currentView) {
let navButtons = Array.from(
// Ensure that only enabled buttons are tested
currentView.querySelectorAll(
".subviewbutton-nav:not([disabled]):not([hidden])"
)
currentView.querySelectorAll(".subviewbutton-nav:not([disabled])")
);
if (!navButtons) {
return;

View File

@@ -100,9 +100,6 @@ var gExceptionPaths = [
// The ONNX runtime picks files to run programmaticaly
"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

View File

@@ -1957,7 +1957,10 @@ BrowserGlue.prototype = {
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);
}

View File

@@ -588,9 +588,9 @@ const TargetingGetters = {
},
get canCreateSelectableProfiles() {
if (!AppConstants.MOZ_SELECTABLE_PROFILES) {
return false;
return null;
}
return lazy.SelectableProfileService?.isEnabled ?? false;
return !!lazy.SelectableProfileService?.groupToolkitProfile;
},
get hasSelectableProfiles() {
return !!lazy.profileStoreID;

View File

@@ -219,16 +219,6 @@ add_task(async function check_canCreateSelectableProfiles() {
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(
await ASRouterTargeting.Environment.canCreateSelectableProfiles,
true,
@@ -241,8 +231,6 @@ add_task(async function check_canCreateSelectableProfiles() {
message,
"should select correct item by canCreateSelectableProfiles"
);
await SelectableProfileService.resetProfileService(null);
});
add_task(async function check_hasSelectableProfiles() {

View File

@@ -118,13 +118,6 @@ class SelectableProfileServiceClass {
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
* 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
// need to so we early return.
if (!this.storeID) {

View File

@@ -4,6 +4,7 @@
:host {
--header-avatar-size: 80px;
--header-avatar-img-size: 40px;
}
html,

View File

@@ -52,9 +52,8 @@ moz-card {
padding-inline-start: var(--space-medium);
padding-block: var(--space-small);
border-inline-width: var(--theme-card-border-width);
border-block-end-width: var(--theme-card-border-width);
border-block-start: var(--card-border);
border-width: var(--theme-card-border-width);
border-top: var(--card-border);
}
:host([selected]) .theme-card {

View File

@@ -6,6 +6,13 @@
const NEW_PROFILE_NAME = "This is a new 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({
set: [["browser.profiles.profile-name.updated", false]],
});

View File

@@ -6,6 +6,13 @@
const NEW_PROFILE_NAME = "This is a new 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();
let profile = SelectableProfileService.currentProfile;
Assert.ok(profile, "Should have a profile now");

View File

@@ -4,6 +4,13 @@
"use strict";
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(
!SelectableProfileService.initialized,
`Selectable Profile Service should not be initialized because the default profile has no storeID`

View File

@@ -4,6 +4,13 @@
"use strict";
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();
let profile = SelectableProfileService.currentProfile;

View File

@@ -8,6 +8,13 @@ const { SelectableProfile } = ChromeUtils.importESModule(
);
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();
let currentProfile = SelectableProfileService.currentProfile;
let profileRootDir = await currentProfile.rootDir;

View File

@@ -3,7 +3,11 @@ https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_recover_storeID() {
add_task(
{
skip_if: () => !AppConstants.MOZ_SELECTABLE_PROFILES,
},
async function test_recover_storeID() {
startProfileService();
Services.prefs.setCharPref("toolkit.profiles.storeID", "foobar");
@@ -26,4 +30,5 @@ add_task(async function test_recover_storeID() {
!Services.prefs.prefHasUserValue("toolkit.profiles.storeID"),
"Should have cleared the storeID pref"
);
});
}
);

View File

@@ -7,7 +7,11 @@ const { Sqlite } = ChromeUtils.importESModule(
"resource://gre/modules/Sqlite.sys.mjs"
);
add_task(async function test_recover_storeID() {
add_task(
{
skip_if: () => !AppConstants.MOZ_SELECTABLE_PROFILES,
},
async function test_recover_storeID() {
startProfileService();
Services.prefs.setCharPref("toolkit.profiles.storeID", "foobar");
@@ -24,7 +28,9 @@ add_task(async function test_recover_storeID() {
openNotExclusive: true,
});
let path = getRelativeProfilePath(getProfileService().currentProfile.rootDir);
let path = getRelativeProfilePath(
getProfileService().currentProfile.rootDir
);
// Slightly annoying we have to replicate this...
await db.execute(`CREATE TABLE IF NOT EXISTS "Profiles" (
@@ -53,7 +59,10 @@ add_task(async function test_recover_storeID() {
const SelectableProfileService = getSelectableProfileService();
await SelectableProfileService.init();
Assert.ok(SelectableProfileService.initialized, "Did initialize the service");
Assert.ok(
SelectableProfileService.initialized,
"Did initialize the service"
);
let profile = SelectableProfileService.currentProfile;
Assert.ok(profile, "Should have a current profile");
@@ -63,4 +72,5 @@ add_task(async function test_recover_storeID() {
"foobar",
"Should have updated the store ID on the profile"
);
});
}
);

View File

@@ -5,7 +5,11 @@ https://creativecommons.org/publicdomain/zero/1.0/ */
add_setup(initSelectableProfileService);
add_task(async function test_launcher() {
add_task(
{
skip_if: () => !AppConstants.MOZ_SELECTABLE_PROFILES,
},
async function test_launcher() {
// mock() returns an object with a fake `runw` method that, when
// called, records its arguments.
let input = [];
@@ -31,4 +35,5 @@ add_task(async function test_launcher() {
}
Assert.deepEqual(expected, input[1], "Expected runw arguments");
});
}
);

View File

@@ -3,7 +3,11 @@ https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_SelectableProfileAndServiceExist() {
add_task(
{
skip_if: () => !AppConstants.MOZ_SELECTABLE_PROFILES,
},
async function test_SelectableProfileAndServiceExist() {
const { SelectableProfile } = ChromeUtils.importESModule(
"resource:///modules/profiles/SelectableProfile.sys.mjs"
);
@@ -13,4 +17,5 @@ add_task(async function test_SelectableProfileAndServiceExist() {
ok(SelectableProfile, "SelectableProfile exists");
ok(SelectableProfileService, "SelectableProfileService exists");
});
}
);

View File

@@ -3,23 +3,14 @@ https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_SelectableProfileLifecycle() {
add_task(
{
skip_if: () => !AppConstants.MOZ_SELECTABLE_PROFILES,
},
async function test_SelectableProfileLifecycle() {
startProfileService();
const SelectableProfileService = getSelectableProfileService();
Services.prefs.setBoolPref("browser.profiles.enabled", false);
await SelectableProfileService.init();
Assert.ok(
!SelectableProfileService.isEnabled,
"Service should not be enabled"
);
Services.prefs.setBoolPref("browser.profiles.enabled", true);
await SelectableProfileService.init();
Assert.ok(
SelectableProfileService.isEnabled,
"Service should now be enabled"
);
let profiles = await SelectableProfileService.getAllProfiles();
@@ -57,7 +48,9 @@ add_task(async function test_SelectableProfileLifecycle() {
let selectableProfile = profiles[0];
let profile = await SelectableProfileService.getProfile(selectableProfile.id);
let profile = await SelectableProfileService.getProfile(
selectableProfile.id
);
for (let attr of ["id", "name", "path"]) {
Assert.equal(
@@ -115,4 +108,5 @@ add_task(async function test_SelectableProfileLifecycle() {
!profileLocalDirExists,
"Profile local dir was successfully removed"
);
});
}
);

View File

@@ -5,7 +5,11 @@ https://creativecommons.org/publicdomain/zero/1.0/ */
add_setup(initSelectableProfileService);
add_task(async function test_SharedPrefsLifecycle() {
add_task(
{
skip_if: () => !AppConstants.MOZ_SELECTABLE_PROFILES,
},
async function test_SharedPrefsLifecycle() {
const SelectableProfileService = getSelectableProfileService();
let prefs = await SelectableProfileService.getAllPrefs();
@@ -65,4 +69,5 @@ add_task(async function test_SharedPrefsLifecycle() {
);
await SelectableProfileService.deleteProfileGroup();
});
}
);

View File

@@ -2,10 +2,6 @@
head = "../../../../../toolkit/profile/test/xpcshell/head.js head.js"
firefox-appdir = "browser"
prefs = [
"browser.profiles.enabled=true",
]
["test_fail_recover_storeID.js"]
["test_recover_storeID.js"]

View File

@@ -107,10 +107,6 @@ nsresult nsDBusRemoteClient::DoSendDBusCommandLine(const char* aProfile,
int aLength) {
LOG("nsDBusRemoteClient::DoSendDBusCommandLine()");
if (!gAppData) {
return NS_ERROR_FAILURE;
}
nsAutoCString appName;
gAppData->GetDBusAppName(appName);

View File

@@ -1092,10 +1092,16 @@ with only_when(target_is_osx):
# 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)
set_config("MOZ_SELECTABLE_PROFILES", True)
option(
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(
"MOZ_DEDICATED_PROFILES",

View File

@@ -33,12 +33,10 @@ xreDirProvider.setUserDataDirectory(gDataHome, false);
xreDirProvider.setUserDataDirectory(gDataHomeLocal, true);
Services.dirsvc.set("UAppData", gDataHome);
let gProfilesRoot = gDataHome.clone();
let gProfilesTemp = gDataHomeLocal.clone();
if (!AppConstants.XP_UNIX || AppConstants.platform == "macosx") {
gProfilesRoot.append("Profiles");
gProfilesTemp.append("Profiles");
}
gProfilesRoot.append("profiles");
Services.dirsvc.set("DefProfRt", gProfilesRoot);
let gProfilesTemp = gDataHomeLocal.clone();
gProfilesTemp.append("profiles");
Services.dirsvc.set("DefProfLRt", gProfilesTemp);
let gIsDefaultApp = false;