зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1659871 - Clean up tests + manifest parsing, add an Alpenglow test, r=pdahiya,florian
Differential Revision: https://phabricator.services.mozilla.com/D89005
This commit is contained in:
Родитель
202f4a23fc
Коммит
f852bf592b
|
@ -22,7 +22,6 @@ var isDevtools = SimpleTest.harnessParameters.subsuite == "devtools";
|
|||
// If you need to whitelist specific files, please use the 'whitelist' object.
|
||||
var gExceptionPaths = [
|
||||
"chrome://browser/content/defaultthemes/",
|
||||
"resource://app/modules/themes/alpenglow/",
|
||||
"resource://app/defaults/settings/blocklists/",
|
||||
"resource://app/defaults/settings/security-state/",
|
||||
"resource://app/defaults/settings/main/",
|
||||
|
@ -431,6 +430,14 @@ async function parseJsonManifest(uri) {
|
|||
gReferencesFromCode.set(stylesheet, null);
|
||||
}
|
||||
|
||||
for (let themeKey of ["theme", "dark_theme"]) {
|
||||
if (data?.[themeKey]?.images?.additional_backgrounds) {
|
||||
for (let background of data[themeKey].images.additional_backgrounds) {
|
||||
gReferencesFromCode.set(uri.resolve(background), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["CustomizeMode"];
|
||||
var EXPORTED_SYMBOLS = ["CustomizeMode", "_defaultImportantThemes"];
|
||||
|
||||
const kPrefCustomizationDebug = "browser.uiCustomization.debug";
|
||||
const kPaletteId = "customization-palette";
|
||||
|
@ -88,6 +88,18 @@ XPCOMUtils.defineLazyGetter(this, "log", () => {
|
|||
return new scope.ConsoleAPI(consoleOptions);
|
||||
});
|
||||
|
||||
const DEFAULT_THEME_ID = "default-theme@mozilla.org";
|
||||
const LIGHT_THEME_ID = "firefox-compact-light@mozilla.org";
|
||||
const DARK_THEME_ID = "firefox-compact-dark@mozilla.org";
|
||||
const ALPENGLOW_THEME_ID = "firefox-alpenglow@mozilla.org";
|
||||
|
||||
const _defaultImportantThemes = [
|
||||
DEFAULT_THEME_ID,
|
||||
LIGHT_THEME_ID,
|
||||
DARK_THEME_ID,
|
||||
ALPENGLOW_THEME_ID,
|
||||
];
|
||||
|
||||
var gDraggingInToolbars;
|
||||
|
||||
var gTab;
|
||||
|
@ -1462,10 +1474,6 @@ CustomizeMode.prototype = {
|
|||
},
|
||||
|
||||
async onThemesMenuShowing(aEvent) {
|
||||
const DEFAULT_THEME_ID = "default-theme@mozilla.org";
|
||||
const LIGHT_THEME_ID = "firefox-compact-light@mozilla.org";
|
||||
const DARK_THEME_ID = "firefox-compact-dark@mozilla.org";
|
||||
const ALPENGLOW_THEME_ID = "firefox-alpenglow@mozilla.org";
|
||||
const MAX_THEME_COUNT = 6;
|
||||
|
||||
this._clearThemesMenu(aEvent.target);
|
||||
|
@ -1505,13 +1513,8 @@ CustomizeMode.prototype = {
|
|||
let themes = await AddonManager.getAddonsByTypes(["theme"]);
|
||||
let currentTheme = themes.find(theme => theme.isActive);
|
||||
|
||||
// Move the current theme (if any) and the light/dark themes to the start:
|
||||
let importantThemes = new Set([
|
||||
DEFAULT_THEME_ID,
|
||||
LIGHT_THEME_ID,
|
||||
DARK_THEME_ID,
|
||||
ALPENGLOW_THEME_ID,
|
||||
]);
|
||||
// Move the current theme (if any) and the default themes to the start:
|
||||
let importantThemes = new Set(_defaultImportantThemes);
|
||||
if (currentTheme) {
|
||||
importantThemes.add(currentTheme.id);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,14 @@
|
|||
const DEFAULT_THEME_ID = "default-theme@mozilla.org";
|
||||
const LIGHT_THEME_ID = "firefox-compact-light@mozilla.org";
|
||||
const DARK_THEME_ID = "firefox-compact-dark@mozilla.org";
|
||||
const ALPENGLOW_THEME_ID = "firefox-alpenglow@mozilla.org";
|
||||
|
||||
const MAX_THEME_COUNT = 6; // Not exposed from CustomizeMode.jsm
|
||||
|
||||
const { _defaultImportantThemes } = ChromeUtils.import(
|
||||
"resource:///modules/CustomizeMode.jsm"
|
||||
);
|
||||
|
||||
async function installTheme(id) {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
|
@ -72,28 +78,40 @@ add_task(async function() {
|
|||
|
||||
let header = document.getElementById("customization-lwtheme-menu-header");
|
||||
let footer = document.getElementById("customization-lwtheme-menu-footer");
|
||||
let menu = document.getElementById("customization-lwtheme-menu");
|
||||
let themeMenuItems = menu.querySelectorAll(
|
||||
"toolbarbutton.customization-lwtheme-menu-theme"
|
||||
);
|
||||
|
||||
is(
|
||||
header.nextElementSibling.nextElementSibling.nextElementSibling
|
||||
.nextElementSibling.nextElementSibling,
|
||||
footer,
|
||||
themeMenuItems.length,
|
||||
_defaultImportantThemes.length,
|
||||
"There should only be four themes (default, light, dark, alpenglow) in the 'My Themes' section by default"
|
||||
);
|
||||
// Note that we use our own theme ID constants in the
|
||||
// following tests because we want to test things are
|
||||
// displayed in the proper order, not just in the order
|
||||
// that constants in the code happens to be in.
|
||||
is(
|
||||
header.nextElementSibling.theme.id,
|
||||
themeMenuItems[0].theme.id,
|
||||
DEFAULT_THEME_ID,
|
||||
"The first theme should be the default theme"
|
||||
);
|
||||
is(
|
||||
header.nextElementSibling.nextElementSibling.theme.id,
|
||||
themeMenuItems[1].theme.id,
|
||||
LIGHT_THEME_ID,
|
||||
"The second theme should be the light theme"
|
||||
);
|
||||
is(
|
||||
header.nextElementSibling.nextElementSibling.nextElementSibling.theme.id,
|
||||
themeMenuItems[2].theme.id,
|
||||
DARK_THEME_ID,
|
||||
"The third theme should be the dark theme"
|
||||
);
|
||||
is(
|
||||
themeMenuItems[3].theme.id,
|
||||
ALPENGLOW_THEME_ID,
|
||||
"The fourth theme should be the alpenglow theme"
|
||||
);
|
||||
|
||||
let themeChangedPromise = promiseObserverNotified(
|
||||
"lightweight-theme-styling-update"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# 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/.
|
||||
|
||||
EXTRA_JS_MODULES.themes['alpenglow'] += [
|
||||
FINAL_TARGET_FILES.modules['themes']['alpenglow'] += [
|
||||
'*.svg',
|
||||
'manifest.json',
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче