Skip to content

Commit 7224cd0

Browse files
author
Norisz Fay
committed
Revert "Bug 1957460 - Update themes on about:editprofile. r=profiles-reviewers,fluent-reviewers,bolsson,tbersentes" for causing bc failures browser_edit_profile_test.js and browser_create_profile_page_test.js
This reverts commit 07a28b4.
1 parent ebb178d commit 7224cd0

File tree

6 files changed

+109
-211
lines changed

6 files changed

+109
-211
lines changed

browser/components/profiles/ProfilesParent.sys.mjs

Lines changed: 72 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -11,218 +11,136 @@ const PROFILE_THEMES_MAP = new Map([
1111
[
1212
"firefox-compact-light@mozilla.org",
1313
{
14-
dataL10nId: "profiles-gray-theme",
14+
dataL10nId: "profiles-light-theme",
1515
colors: {
16-
light: {
17-
chromeColor: "rgb(234, 234, 237)", // frame
18-
toolbarColor: "rgb(255, 255, 255)", // sidebar?
19-
contentColor: "#F9F9FB", // ntp_background
20-
},
16+
chromeColor: "#F0F0F4",
17+
toolbarColor: "#F9F9FB",
18+
contentColor: "#FFFFFF",
2119
},
2220
isDark: false,
2321
useInAutomation: true,
2422
},
2523
],
2624
[
27-
"firefox-compact-dark@mozilla.org",
28-
{
29-
dataL10nId: "profiles-gray-theme",
30-
colors: {
31-
dark: {
32-
chromeColor: "rgb(28, 27, 34)",
33-
toolbarColor: "rgb(28, 27, 34)",
34-
contentColor: "rgb(43, 42, 51)",
35-
},
36-
},
37-
isDark: true,
38-
useInAutomation: true,
39-
},
40-
],
41-
[
42-
"{cd6791f7-4b6d-47b4-8877-1d4c82c6699d}",
43-
{
44-
dataL10nId: "profiles-yellow-theme",
45-
downloadURL:
46-
"https://addons.mozilla.org/firefox/downloads/file/4552782/profiles_yellow-1.0.xpi",
47-
colors: {
48-
light: {
49-
chromeColor: "rgb(255, 230, 153)",
50-
toolbarColor: "rgb(255, 255, 255)",
51-
contentColor: "rgb(255, 244, 208)",
52-
},
53-
dark: {
54-
chromeColor: "rgb(39, 16, 0)",
55-
toolbarColor: "rgb(22, 22, 22)",
56-
contentColor: "rgb(66, 27, 0)",
57-
},
58-
},
59-
},
60-
],
61-
[
62-
"{7a301b7b-c3e2-40bf-a06b-6d517bbf138b}",
25+
"{b90acfd0-f0fc-4add-9195-f6306d25cdfa}",
6326
{
64-
dataL10nId: "profiles-orange-theme",
27+
dataL10nId: "profiles-marigold-theme-2",
6528
downloadURL:
66-
"https://addons.mozilla.org/firefox/downloads/file/4552788/profiles_orange-1.0.xpi",
29+
"https://addons.mozilla.org/firefox/downloads/file/4381985/marigold-1.9.xpi",
6730
colors: {
68-
light: {
69-
chromeColor: "rgb(255, 205, 158)",
70-
toolbarColor: "rgb(255, 255, 255)",
71-
contentColor: "rgb(255, 237, 214)",
72-
},
73-
dark: {
74-
chromeColor: "rgb(39, 15, 0)",
75-
toolbarColor: "rgb(22, 22, 22)",
76-
contentColor: "rgb(72, 18, 0)",
77-
},
31+
chromeColor: "#F1CA52",
32+
toolbarColor: "#FBDF8C",
33+
contentColor: "#FEF7E0",
7834
},
35+
isDark: false,
7936
},
8037
],
8138
[
82-
"{8de5f8c3-bfc2-443b-9913-7bbadbd1ba0d}",
39+
"{388d9fae-8a28-4f9f-9aad-fb9e84e4f3c3}",
8340
{
84-
dataL10nId: "profiles-red-theme",
41+
dataL10nId: "profiles-lichen-theme-2",
8542
downloadURL:
86-
"https://addons.mozilla.org/firefox/downloads/file/4552785/profiles_red-1.0.xpi",
43+
"https://addons.mozilla.org/firefox/downloads/file/4381979/lichen_soft-1.3.xpi",
8744
colors: {
88-
light: {
89-
chromeColor: "rgb(255, 195, 201)",
90-
toolbarColor: "rgb(255, 255, 255)",
91-
contentColor: "rgb(255, 232, 234)",
92-
},
93-
dark: {
94-
chromeColor: "rgb(41, 11, 15)",
95-
toolbarColor: "rgb(22, 22, 22)",
96-
contentColor: "rgb(76, 5, 22)",
97-
},
45+
chromeColor: "#D2E4DA",
46+
toolbarColor: "#E9F2EC",
47+
contentColor: "#F5F9F7",
9848
},
49+
isDark: false,
9950
},
10051
],
10152
[
102-
"{2b0fadbf-238d-43db-aa9d-e06c9a7e000b}",
53+
"{3ac3b0d7-f017-40e1-b142-a26f794e7015}",
10354
{
104-
dataL10nId: "profiles-pink-theme",
55+
dataL10nId: "profiles-magnolia-theme-2",
10556
downloadURL:
106-
"https://addons.mozilla.org/firefox/downloads/file/4552787/profiles_pink-1.0.xpi",
57+
"https://addons.mozilla.org/firefox/downloads/file/4381978/magnolia-1.1.xpi",
10758
colors: {
108-
light: {
109-
chromeColor: "rgb(255, 194, 219)",
110-
toolbarColor: "rgb(255, 255, 255)",
111-
contentColor: "rgb(255, 232, 244)",
112-
},
113-
dark: {
114-
chromeColor: "rgb(39, 11, 21)",
115-
toolbarColor: "rgb(22, 22, 22)",
116-
contentColor: "rgb(73, 6, 36)",
117-
},
59+
chromeColor: "#FB5B9E",
60+
toolbarColor: "#F986B6",
61+
contentColor: "#FBE0ED",
11862
},
63+
isDark: false,
11964
},
12065
],
12166
[
122-
"{1d73a1eb-128d-4e9e-83f8-c0c51f8c5fd3}",
67+
"{ba48d251-0732-45c2-9f2f-39c68e82d047}",
12368
{
124-
dataL10nId: "profiles-purple-theme",
69+
dataL10nId: "profiles-lavender-theme-2",
12570
downloadURL:
126-
"https://addons.mozilla.org/firefox/downloads/file/4552786/profiles_purple-1.0.xpi",
71+
"https://addons.mozilla.org/firefox/downloads/file/4381983/lavender_soft-1.2.xpi",
12772
colors: {
128-
light: {
129-
chromeColor: "rgb(247, 202, 255)",
130-
toolbarColor: "rgb(255, 255, 255)",
131-
contentColor: "rgb(255, 236, 255)",
132-
},
133-
dark: {
134-
chromeColor: "rgb(30, 14, 37)",
135-
toolbarColor: "rgb(22, 22, 22)",
136-
contentColor: "rgb(56, 17, 71)",
137-
},
73+
chromeColor: "#CDC1EA",
74+
toolbarColor: "#EBE4FA",
75+
contentColor: "#F4F0FD",
13876
},
77+
isDark: false,
13978
},
14079
],
14180
[
142-
"{aab1adac-5449-47fd-b836-c2f43dc28f3f}",
81+
"firefox-compact-dark@mozilla.org",
14382
{
144-
dataL10nId: "profiles-violet-theme",
145-
downloadURL:
146-
"https://addons.mozilla.org/firefox/downloads/file/4552784/profiles_violet-1.0.xpi",
83+
dataL10nId: "profiles-dark-theme",
14784
colors: {
148-
light: {
149-
chromeColor: "rgb(221, 207, 255)",
150-
toolbarColor: "rgb(255, 255, 255)",
151-
contentColor: "rgb(244, 240, 255)",
152-
},
153-
dark: {
154-
chromeColor: "rgb(22, 17, 43)",
155-
toolbarColor: "rgb(22, 22, 22)",
156-
contentColor: "rgb(40, 25, 83)",
157-
},
85+
chromeColor: "#1C1B22",
86+
toolbarColor: "#2B2A33",
87+
contentColor: "#42414D",
15888
},
89+
isDark: true,
90+
useInAutomation: true,
15991
},
16092
],
16193
[
162-
"{4223a94a-d3f9-40e9-95dd-99aca80ea04b}",
94+
"{750fa518-b61f-4068-9974-330dcf45442f}",
16395
{
164-
dataL10nId: "profiles-blue-theme",
96+
dataL10nId: "profiles-ocean-theme-2",
16597
downloadURL:
166-
"https://addons.mozilla.org/firefox/downloads/file/4551961/profiles_blue-1.0.xpi",
98+
"https://addons.mozilla.org/firefox/downloads/file/4381977/ocean_dark-1.1.xpi",
16799
colors: {
168-
light: {
169-
chromeColor: "rgb(171, 223, 255)",
170-
toolbarColor: "rgb(255, 255, 255)",
171-
contentColor: "rgb(226, 247, 255)",
172-
},
173-
dark: {
174-
chromeColor: "rgb(8, 21, 44)",
175-
toolbarColor: "rgb(22, 22, 22)",
176-
contentColor: "rgb(4, 35, 86)",
177-
},
100+
chromeColor: "#080D33",
101+
toolbarColor: "#050D5B",
102+
contentColor: "#000511",
178103
},
104+
isDark: true,
179105
},
180106
],
181107
[
182-
"{7063abff-a690-4b87-a548-fc32d3ce5708}",
108+
"{25b5a343-4238-4bae-b1f9-93a33f258167}",
183109
{
184-
dataL10nId: "profiles-green-theme",
110+
dataL10nId: "profiles-terracotta-theme-2",
185111
downloadURL:
186-
"https://addons.mozilla.org/firefox/downloads/file/4552789/profiles_green-1.0.xpi",
112+
"https://addons.mozilla.org/firefox/downloads/file/4381976/terracotta_dark-1.1.xpi",
187113
colors: {
188-
light: {
189-
chromeColor: "rgb(181, 240, 181)",
190-
toolbarColor: "rgb(255, 255, 255)",
191-
contentColor: "rgb(225, 255, 225)",
192-
},
193-
dark: {
194-
chromeColor: "rgb(5, 28, 7)",
195-
toolbarColor: "rgb(22, 22, 22)",
196-
contentColor: "rgb(0, 50, 0)",
197-
},
114+
chromeColor: "#591305",
115+
toolbarColor: "#98240B",
116+
contentColor: "#060100",
198117
},
118+
isDark: true,
199119
},
200120
],
201121
[
202-
"{0683b144-0d4a-4815-963e-55a8ec8d386b}",
122+
"{f9261f02-c03c-4352-92ee-78dd8b41ca98}",
203123
{
204-
dataL10nId: "profiles-cyan-theme",
124+
dataL10nId: "profiles-moss-theme-2",
205125
downloadURL:
206-
"https://addons.mozilla.org/firefox/downloads/file/4552790/profiles_cyan-1.0.xpi",
126+
"https://addons.mozilla.org/firefox/downloads/file/4381975/moss_dark-1.1.xpi",
207127
colors: {
208-
light: {
209-
chromeColor: "rgb(166, 236, 244)",
210-
toolbarColor: "rgb(255, 255, 255)",
211-
contentColor: "rgb(207, 255, 255)",
212-
},
213-
dark: {
214-
chromeColor: "rgb(0, 31, 43)",
215-
toolbarColor: "rgb(22, 22, 22)",
216-
contentColor: "rgb(0, 50, 61)",
217-
},
128+
chromeColor: "#405948",
129+
toolbarColor: "#5B7B65",
130+
contentColor: "#323433",
218131
},
132+
isDark: true,
219133
},
220134
],
221135
[
222136
"default-theme@mozilla.org",
223137
{
224138
dataL10nId: "profiles-system-theme",
225-
colors: {},
139+
colors: {
140+
chromeColor: "#1C1B22",
141+
toolbarColor: "#2B2A33",
142+
contentColor: "#42414D",
143+
},
226144
},
227145
],
228146
]);
@@ -258,12 +176,12 @@ export class ProfilesParent extends JSWindowActorParent {
258176
favicon.classList.remove("profiles-tab");
259177
}
260178

261-
async #getProfileContent(isDark) {
179+
async #getProfileContent() {
262180
// Make sure SelectableProfileService is initialized
263181
await SelectableProfileService.init();
264182
let currentProfile = SelectableProfileService.currentProfile;
265183
let profiles = await SelectableProfileService.getAllProfiles();
266-
let themes = await this.getSafeForContentThemes(isDark);
184+
let themes = await this.getSafeForContentThemes();
267185
return {
268186
currentProfile: await currentProfile.toContentSafeObject(),
269187
profiles: await Promise.all(profiles.map(p => p.toContentSafeObject())),
@@ -318,17 +236,11 @@ export class ProfilesParent extends JSWindowActorParent {
318236
}
319237
case "Profiles:GetNewProfileContent": {
320238
Glean.profilesNew.displayed.record();
321-
let isDark = gBrowser.selectedBrowser.ownerGlobal.matchMedia(
322-
"(-moz-system-dark-theme)"
323-
).matches;
324-
return this.#getProfileContent(isDark);
239+
return this.#getProfileContent();
325240
}
326241
case "Profiles:GetEditProfileContent": {
327242
Glean.profilesExisting.displayed.record();
328-
let isDark = gBrowser.selectedBrowser.ownerGlobal.matchMedia(
329-
"(-moz-system-dark-theme)"
330-
).matches;
331-
return this.#getProfileContent(isDark);
243+
return this.#getProfileContent();
332244
}
333245
case "Profiles:MoreThemes": {
334246
if (message.data.source === "about:editprofile") {
@@ -482,20 +394,16 @@ export class ProfilesParent extends JSWindowActorParent {
482394
await theme.enable();
483395
}
484396

485-
async getSafeForContentThemes(isDark) {
486-
let lightDark = isDark ? "dark" : "light";
397+
async getSafeForContentThemes() {
487398
let themes = [];
488399
for (let [themeId, themeObj] of PROFILE_THEMES_MAP) {
489-
if (Object.hasOwn(themeObj, "isDark") && themeObj.isDark !== isDark) {
490-
continue;
491-
}
492-
493400
let theme = await lazy.AddonManager.getAddonByID(themeId);
494401
themes.push({
495402
id: themeId,
496403
dataL10nId: themeObj.dataL10nId,
497404
isActive: theme?.isActive ?? false,
498-
...themeObj.colors[lightDark],
405+
...themeObj.colors,
406+
isDark: themeObj.isDark,
499407
useInAutomation: themeObj?.useInAutomation,
500408
});
501409
}

browser/components/profiles/content/new-profile-card.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ export class NewProfileCard extends EditProfileCard {
4848
return;
4949
}
5050

51-
let possibleThemes = this.themes;
51+
let isDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
52+
let possibleThemes = this.themes.filter(t => t.isDark === isDark);
5253
if (isInAutomation) {
5354
possibleThemes = possibleThemes.filter(t => t.useInAutomation);
5455
}

browser/components/profiles/tests/browser/browser_create_profile_page_test.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ add_task(async function test_new_profile_theme() {
277277
);
278278
await lightTheme.enable();
279279

280-
let expectedThemeId = "default-theme@mozilla.org";
280+
let expectedThemeId = "firefox-compact-dark@mozilla.org";
281281

282282
is(
283283
null,
@@ -305,19 +305,17 @@ add_task(async function test_new_profile_theme() {
305305
// Fill in the input so we don't hit the beforeunload warning
306306
newProfileCard.nameInput.value = "test";
307307

308-
let defaultThemeCard = newProfileCard.themesPicker.querySelector(
309-
"moz-visual-picker-item[value='default-theme@mozilla.org']"
310-
);
308+
let darkThemeCard = newProfileCard.themeCards[5];
311309

312310
Assert.ok(
313-
!defaultThemeCard.checked,
314-
"Default theme chip should not be selected"
311+
!darkThemeCard.checked,
312+
"Dark theme chip should not be selected"
315313
);
316-
EventUtils.synthesizeMouseAtCenter(defaultThemeCard, {}, content);
314+
EventUtils.synthesizeMouseAtCenter(darkThemeCard, {}, content);
317315

318316
await newProfileCard.updateComplete;
319317
await ContentTaskUtils.waitForCondition(
320-
() => defaultThemeCard.checked,
318+
() => darkThemeCard.checked,
321319
"Waiting for the new theme chip to be selected"
322320
);
323321

0 commit comments

Comments
 (0)