Bug 1660557 - stop using js_modules to pack builtin and default themes, r=glandium,zombie

This is ultimately less build magic and makes for more meaningful URIs.

This patch paves the way for the second patch in this stack which fixes bug 1655456.

Differential Revision: https://phabricator.services.mozilla.com/D89130
This commit is contained in:
Gijs Kruitbosch 2020-09-11 15:26:24 +00:00
parent ba85e30cc9
commit 97c97bc82f
18 changed files with 43 additions and 60 deletions

View File

@ -391,9 +391,10 @@ function parseManifest(manifestUri) {
});
}
// If the given URI is a webextension manifest, extract the scripts
// for any embedded APIs. Returns the passed in URI if the manifest
// is not a webextension manifest, null otherwise.
// If the given URI is a webextension manifest, extract files used by
// any of its APIs (scripts, icons, style sheets, theme images).
// Returns the passed in URI if the manifest is not a webextension
// manifest, null otherwise.
async function parseJsonManifest(uri) {
uri = Services.io.newURI(convertToCodeURI(uri.spec));

View File

@ -1354,18 +1354,18 @@ BrowserGlue.prototype = {
AddonManager.maybeInstallBuiltinAddon(
"firefox-compact-light@mozilla.org",
"1.0",
"resource:///modules/themes/light/"
"1.1",
"resource://builtin-themes/light/"
);
AddonManager.maybeInstallBuiltinAddon(
"firefox-compact-dark@mozilla.org",
"1.0",
"resource:///modules/themes/dark/"
"1.1",
"resource://builtin-themes/dark/"
);
AddonManager.maybeInstallBuiltinAddon(
"firefox-alpenglow@mozilla.org",
"1.0",
"resource:///modules/themes/alpenglow/"
"1.1",
"resource://builtin-themes/alpenglow/"
);
if (AppConstants.MOZ_NORMANDY) {

View File

@ -9,7 +9,7 @@
"name": "Firefox Alpenglow",
"description": "Use a colorful appearance for buttons, menus, and windows.",
"version": "1.0",
"version": "1.1",
"icons": { "32": "icon.svg" },
"theme": {

View File

@ -1,11 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
FINAL_TARGET_FILES.modules['themes']['alpenglow'] += [
'*.svg',
'manifest.json',
]

View File

@ -10,7 +10,7 @@
"name": "Dark",
"description": "A theme with a dark color scheme.",
"author": "Mozilla",
"version": "1.0",
"version": "1.1",
"icons": {"32": "icon.svg"},

View File

@ -1,11 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
EXTRA_JS_MODULES.themes['dark'] += [
'experiment.css',
'icon.svg',
'manifest.json',
]

View File

@ -0,0 +1,17 @@
# 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/.
browser.jar:
% resource builtin-themes %content/builtin-themes/
content/builtin-themes/alpenglow (alpenglow/*.svg)
content/builtin-themes/alpenglow/manifest.json (alpenglow/manifest.json)
content/builtin-themes/dark (dark/*.svg)
content/builtin-themes/dark (dark/*.css)
content/builtin-themes/dark/manifest.json (dark/manifest.json)
content/builtin-themes/light (light/*.svg)
content/builtin-themes/light (light/*.css)
content/builtin-themes/light/manifest.json (light/manifest.json)

View File

@ -10,7 +10,7 @@
"name": "Light",
"description": "A theme with a light color scheme.",
"author": "Mozilla",
"version": "1.0",
"version": "1.1",
"icons": {"32": "icon.svg"},

View File

@ -1,11 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
EXTRA_JS_MODULES.themes['light'] += [
'experiment.css',
'icon.svg',
'manifest.json',
]

View File

@ -4,7 +4,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/.
EXTRA_JS_MODULES.themes['default'] += [
'icon.svg',
'manifest.json',
]
JAR_MANIFESTS += ['jar.mn']

View File

@ -17,9 +17,7 @@ else:
DIRS += ['windows']
DIRS += [
'addons/alpenglow',
'addons/dark',
'addons/light',
'addons',
]
with Files('osx/**'):

View File

@ -41,7 +41,7 @@ add_task(async function run_test() {
await AddonTestUtils.promiseStartupManager();
// Install another built-in theme.
await AddonManager.installBuiltinAddon("resource:///modules/themes/light/");
await AddonManager.installBuiltinAddon("resource://builtin-themes/light/");
const defaultThemeAddon = await AddonManager.getAddonByID(DEFAULT_THEME_ID);
ok(defaultThemeAddon, "Got an addon wrapper for the default theme");

View File

@ -10,7 +10,7 @@
"name": "Default",
"description": "A theme with the operating system color scheme.",
"author": "Mozilla",
"version": "1.0",
"version": "1.1",
"icons": {"32": "icon.svg"},

View File

@ -113,7 +113,7 @@ const PREF_XPI_DIRECT_WHITELISTED = "xpinstall.whitelist.directRequest";
const PREF_XPI_FILE_WHITELISTED = "xpinstall.whitelist.fileRequest";
const PREF_XPI_WHITELIST_REQUIRED = "xpinstall.whitelist.required";
const PREF_SELECTED_LWT = "lightweightThemes.selectedThemeID";
const PREF_SELECTED_LWT = "extensions.activeThemeID";
const TOOLKIT_ID = "toolkit@mozilla.org";

View File

@ -128,7 +128,7 @@ const XPI_PERMISSION = "install";
const XPI_SIGNATURE_CHECK_PERIOD = 24 * 60 * 60;
const DB_SCHEMA = 32;
const DB_SCHEMA = 33;
XPCOMUtils.defineLazyPreferenceGetter(
this,
@ -2460,8 +2460,8 @@ var XPIProvider = {
this.maybeInstallBuiltinAddon(
"default-theme@mozilla.org",
"1.0",
"resource://gre/modules/themes/default/"
"1.1",
"resource://default-theme/"
);
resolveProviderReady(Promise.all(this.startupPromises));

View File

@ -33,4 +33,8 @@ toolkit.jar:
content/mozapps/extensions/rating-star.css (content/rating-star.css)
content/mozapps/extensions/shortcuts.css (content/shortcuts.css)
content/mozapps/extensions/shortcuts.js (content/shortcuts.js)
% resource default-theme %content/mozapps/extensions/default-theme/
content/mozapps/extensions/default-theme/icon.svg (default-theme/icon.svg)
content/mozapps/extensions/default-theme/manifest.json (default-theme/manifest.json)
#endif

View File

@ -16,7 +16,6 @@ if CONFIG['MOZ_BUILD_APP'] == 'mobile/android':
DEFINES['MOZ_FENNEC'] = True
DIRS += [
'default-theme',
'internal',
]
TEST_DIRS += ['test']

View File

@ -731,7 +731,7 @@ add_task(async function testDefaultTheme() {
// Version.
let version = rows.shift();
checkLabel(version, "version");
is(version.lastChild.textContent, "1.0", "It's always version 1.0");
is(version.lastChild.textContent, "1.1", "It's always version 1.1");
// Last updated.
let lastUpdated = rows.shift();