From f46e5461c2cbea032bbb1e9e2380ad08daf6de9a Mon Sep 17 00:00:00 2001 From: Cristian Tuns Date: Wed, 22 May 2024 10:52:26 -0400 Subject: [PATCH] Backed out 2 changesets (bug 1897208, bug 1893693) for causing bc failures in browser_newtab_userTypedValue.js and browser_blanking.js CLOSED TREE Backed out changeset 4069a89be22a (bug 1893693) Backed out changeset 33190b27bb47 (bug 1897208) --- browser/components/moz.build | 3 +- .../components/profiles/ProfilesChild.sys.mjs | 2 +- .../profiles/SelectableProfile.sys.mjs | 117 ------------ .../profiles/SelectableProfileService.sys.mjs | 166 ------------------ browser/components/profiles/moz.build | 9 +- .../test_selectable_profile_service_exists.js | 24 --- .../profiles/tests/unit/xpcshell.toml | 4 - toolkit/moz.configure | 2 +- 8 files changed, 4 insertions(+), 323 deletions(-) delete mode 100644 browser/components/profiles/SelectableProfile.sys.mjs delete mode 100644 browser/components/profiles/SelectableProfileService.sys.mjs delete mode 100644 browser/components/profiles/tests/unit/test_selectable_profile_service_exists.js delete mode 100644 browser/components/profiles/tests/unit/xpcshell.toml diff --git a/browser/components/moz.build b/browser/components/moz.build index a354dc7e73e8..de70b60eb667 100644 --- a/browser/components/moz.build +++ b/browser/components/moz.build @@ -51,6 +51,7 @@ DIRS += [ "pocket", "preferences", "privatebrowsing", + "profiles", "prompts", "protections", "protocolhandler", @@ -74,8 +75,6 @@ DIRS += [ DIRS += ["build"] -if CONFIG["MOZ_SELECTABLE_PROFILES"]: - DIRS += ["profiles"] if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": DIRS += ["touchbar"] diff --git a/browser/components/profiles/ProfilesChild.sys.mjs b/browser/components/profiles/ProfilesChild.sys.mjs index 3436176b0617..5ea9ceaa2764 100644 --- a/browser/components/profiles/ProfilesChild.sys.mjs +++ b/browser/components/profiles/ProfilesChild.sys.mjs @@ -2,4 +2,4 @@ * 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/. */ -export class ProfilesChild extends JSWindowActorChild {} +export class ProfilesChild extends JSWindowActorParent {} diff --git a/browser/components/profiles/SelectableProfile.sys.mjs b/browser/components/profiles/SelectableProfile.sys.mjs deleted file mode 100644 index 1a82894ee984..000000000000 --- a/browser/components/profiles/SelectableProfile.sys.mjs +++ /dev/null @@ -1,117 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -/** - * The selectable profile - */ -export class SelectableProfile { - // DB internal autoincremented integer ID. - // eslint-disable-next-line no-unused-private-class-members - #id; - - // Path to profile on disk. - #path; - - // The user-editable name - #name; - - // Name of the user's chosen avatar, which corresponds to a list of built-in - // SVG avatars. - #avatar; - - // Cached theme properties, used to allow displaying a SelectableProfile - // without loading the AddonManager to get theme info. - #themeL10nID; - #themeFG; - #themeBG; - - // Note: setters update the object, then ask the SelectableProfileService to save it. - - /** - * Get the user-editable name for the profile. - * - * @returns {string} Name of profile - */ - get name() { - return this.#name; - } - - /** - * Update the user-editable name for the profile, then trigger saving the profile, - * which will notify() other running instances. - * - * @param {string} aName The new name of the profile - */ - set name(aName) { - this.#name = aName; - - this.saveUpdatesToDB(); - } - - /** - * Get the path to the profile on disk. - * - * @returns {string} Path of profile - */ - get path() { - return this.#path; - } - - /** - * Get the name of the avatar for the profile. - * - * @returns {string} Name of the avatar - */ - get avatar() { - return this.#avatar; - } - - /** - * Update the avatar, then trigger saving the profile, which will notify() - * other running instances. - * - * @param {string} aAvatar Name of the avatar - */ - set avatar(aAvatar) { - this.avatar = aAvatar; - - this.saveUpdatesToDB(); - } - - // Note, theme properties are set and returned as a group. - - /** - * Get the theme l10n-id as a string, like "theme-foo-name". - * the theme foreground color as CSS style string, like "rgb(1,1,1)", - * the theme background color as CSS style string, like "rgb(0,0,0)". - * - * @returns {object} an object of the form { l10nID, fgColor, bgColor }. - */ - get theme() { - return { - l10nID: this.#themeL10nID, - fgColor: this.#themeFG, - bgColor: this.#themeBG, - }; - } - - /** - * Update the theme (all three properties are required), then trigger saving - * the profile, which will notify() other running instances. - * - * @param {object} param0 The theme object - * @param {string} param0.l10nID L10n id of the theme - * @param {string} param0.fgColor Foreground color of theme as CSS style string, like "rgb(1,1,1)", - * @param {string} param0.bgColor Background color of theme as CSS style string, like "rgb(0,0,0)". - */ - set theme({ l10nID, fgColor, bgColor }) { - this.#themeL10nID = l10nID; - this.#themeFG = fgColor; - this.#themeBG = bgColor; - - this.saveUpdatesToDB(); - } - - saveUpdatesToDB() {} -} diff --git a/browser/components/profiles/SelectableProfileService.sys.mjs b/browser/components/profiles/SelectableProfileService.sys.mjs deleted file mode 100644 index 3405a87c5bcc..000000000000 --- a/browser/components/profiles/SelectableProfileService.sys.mjs +++ /dev/null @@ -1,166 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -// TDOD: Remove this line once methods are updated. See bug 1896727 -/* eslint-disable no-unused-vars */ - -/** - * The service that manages selectable profiles - */ -export class SelectableProfileService { - /** - * At startup, store the nsToolkitProfile for the group. - * Get the groupDBPath from the nsToolkitProfile, and connect to it. - * - * @param {nsToolkitProfile} groupProfile The current toolkit profile - */ - init(groupProfile) {} - - /** - * Create the SQLite DB for the profile group. - * Init shared prefs for the group and add to DB. - * Create the Group DB path to aNamedProfile entry in profiles.ini. - * Import aNamedProfile into DB. - * - * @param {nsToolkitProfile} groupProfile The current toolkit profile - */ - createProfileGroup(groupProfile) {} - - /** - * When the last selectable profile in a group is deleted, - * also remove the profile group's named profile entry from profiles.ini - * and delete the group DB. - */ - deleteProfileGroup() {} - - // App session lifecycle methods and multi-process support - - /** - * When the group DB has been updated, either changes to prefs or profiles, - * ask the remoting service to notify other running instances that they should - * check for updates and refresh their UI accordingly. - */ - notify() {} - - /** - * Invoked when the remoting service has notified this instance that another - * instance has updated the database. Triggers refreshProfiles() and refreshPrefs(). - */ - observe() {} - - /** - * Init or update the current SelectableProfiles from the DB. - */ - refreshProfiles() {} - - /** - * Fetch all prefs from the DB and write to the current instance. - */ - refreshPrefs() {} - - /** - * Update the current default profile by setting its path as the Path - * of the nsToolkitProfile for the group. - * - * @param {SelectableProfile} aSelectableProfile The new default SelectableProfile - */ - setDefault(aSelectableProfile) {} - - /** - * Update whether to show the selectable profile selector window at startup. - * Set on the nsToolkitProfile instance for the group. - * - * @param {boolean} shouldShow Whether or not we should show the profile selector - */ - setShowProfileChooser(shouldShow) {} - - /** - * Update the path to the group DB. Set on the nsToolkitProfile instance - * for the group. - * - * @param {string} aPath The path to the group DB - */ - setGroupDBPath(aPath) {} - - // SelectableProfile lifecycle - - /** - * Create an empty SelectableProfile and add it to the group DB. - * This is an unmanaged profile from the nsToolkitProfile perspective. - */ - createProfile() {} - - /** - * Delete a SelectableProfile from the group DB. - * If it was the last profile in the group, also call deleteProfileGroup(). - */ - deleteProfile() {} - - /** - * Schedule deletion of the current SelectableProfile as a background task, then exit. - */ - deleteCurrentProfile() {} - - /** - * Write an updated profile to the DB. - * - * @param {SelectableProfile} aSelectableProfile The SelectableProfile to be update - */ - updateProfile(aSelectableProfile) {} - - /** - * Get the complete list of profiles in the group. - */ - getProfiles() {} - - /** - * Get a specific profile by its internal ID. - * - * @param {number} aProfileID The internal id of the profile - */ - getProfile(aProfileID) {} - - // Shared Prefs management - - /** - * Get all shared prefs as a list. - */ - getAllPrefs() {} - - /** - * Get the value of a specific shared pref. - * - * @param {string} aPrefName The name of the pref to get - */ - getPref(aPrefName) {} - - /** - * Insert or update a pref value, then notify() other running instances. - * - * @param {string} aPrefName The name of the pref - * @param {string} aPrefType The type of the pref - * @param {any} aPrefValue The value of the pref - */ - createOrUpdatePref(aPrefName, aPrefType, aPrefValue) {} - - /** - * Remove a shared pref, then notify() other running instances. - * - * @param {string} aPrefName The name of the pref to delete - */ - deletePref(aPrefName) {} - - // DB lifecycle - - /** - * Create the SQLite DB for the profile group at groupDBPath. - * Init shared prefs for the group and add to DB. - */ - createGroupDB() {} - - /** - * Delete the SQLite DB when the last selectable profile is deleted. - */ - deleteGroupDB() {} -} diff --git a/browser/components/profiles/moz.build b/browser/components/profiles/moz.build index fb4fbabd941a..8e9e82db2c2d 100644 --- a/browser/components/profiles/moz.build +++ b/browser/components/profiles/moz.build @@ -4,8 +4,6 @@ # 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/. -XPCSHELL_TESTS_MANIFESTS += ["tests/unit/xpcshell.toml"] - JAR_MANIFESTS += ["jar.mn"] FINAL_TARGET_FILES.actors += [ @@ -13,10 +11,5 @@ FINAL_TARGET_FILES.actors += [ "ProfilesParent.sys.mjs", ] -EXTRA_JS_MODULES.profiles += [ - "SelectableProfile.sys.mjs", - "SelectableProfileService.sys.mjs", -] - with Files("**"): - BUG_COMPONENT = ("Toolkit", "Startup and Profile System") + BUG_COMPONENT = ("Firefox", "Profiles") diff --git a/browser/components/profiles/tests/unit/test_selectable_profile_service_exists.js b/browser/components/profiles/tests/unit/test_selectable_profile_service_exists.js deleted file mode 100644 index f6a205d0d6ee..000000000000 --- a/browser/components/profiles/tests/unit/test_selectable_profile_service_exists.js +++ /dev/null @@ -1,24 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. -https://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -const { AppConstants } = ChromeUtils.importESModule( - "resource://gre/modules/AppConstants.sys.mjs" -); -const { SelectableProfile } = ChromeUtils.importESModule( - "resource:///modules/profiles/SelectableProfile.sys.mjs" -); -const { SelectableProfileService } = ChromeUtils.importESModule( - "resource:///modules/profiles/SelectableProfileService.sys.mjs" -); - -add_task( - { - skip_if: () => !AppConstants.MOZ_SELECTABLE_PROFILES, - }, - async function test_SelectableProfileAndServiceExist() { - ok(SelectableProfile, "SelectableProfile exists"); - ok(SelectableProfileService, "SelectableProfileService exists"); - } -); diff --git a/browser/components/profiles/tests/unit/xpcshell.toml b/browser/components/profiles/tests/unit/xpcshell.toml deleted file mode 100644 index 504c9990ff1b..000000000000 --- a/browser/components/profiles/tests/unit/xpcshell.toml +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -firefox-appdir = "browser" - -["test_selectable_profile_service_exists.js"] diff --git a/toolkit/moz.configure b/toolkit/moz.configure index 6884cc0ad4d8..6d8c898b059b 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -985,8 +985,8 @@ option( 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",