From 97c97bc82f5ee1dc438c77dd2accce80dd75706d Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Fri, 11 Sep 2020 15:26:24 +0000 Subject: [PATCH] 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 --- .../test/static/browser_all_files_referenced.js | 7 ++++--- browser/components/BrowserGlue.jsm | 12 ++++++------ browser/themes/addons/alpenglow/manifest.json | 2 +- browser/themes/addons/alpenglow/moz.build | 11 ----------- browser/themes/addons/dark/manifest.json | 2 +- browser/themes/addons/dark/moz.build | 11 ----------- browser/themes/addons/jar.mn | 17 +++++++++++++++++ browser/themes/addons/light/manifest.json | 2 +- browser/themes/addons/light/moz.build | 11 ----------- .../themes/addons}/moz.build | 5 +---- browser/themes/moz.build | 4 +--- services/sync/tests/unit/test_prefs_store.js | 2 +- .../extensions/default-theme/manifest.json | 2 +- .../mozapps/extensions/internal/XPIInstall.jsm | 2 +- .../mozapps/extensions/internal/XPIProvider.jsm | 6 +++--- toolkit/mozapps/extensions/jar.mn | 4 ++++ toolkit/mozapps/extensions/moz.build | 1 - .../test/browser/browser_html_detail_view.js | 2 +- 18 files changed, 43 insertions(+), 60 deletions(-) delete mode 100644 browser/themes/addons/alpenglow/moz.build delete mode 100644 browser/themes/addons/dark/moz.build create mode 100644 browser/themes/addons/jar.mn delete mode 100644 browser/themes/addons/light/moz.build rename {toolkit/mozapps/extensions/default-theme => browser/themes/addons}/moz.build (78%) diff --git a/browser/base/content/test/static/browser_all_files_referenced.js b/browser/base/content/test/static/browser_all_files_referenced.js index 7bac69adec80..699479e6b6e3 100644 --- a/browser/base/content/test/static/browser_all_files_referenced.js +++ b/browser/base/content/test/static/browser_all_files_referenced.js @@ -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)); diff --git a/browser/components/BrowserGlue.jsm b/browser/components/BrowserGlue.jsm index a96b7158e7b8..734e50d704d1 100644 --- a/browser/components/BrowserGlue.jsm +++ b/browser/components/BrowserGlue.jsm @@ -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) { diff --git a/browser/themes/addons/alpenglow/manifest.json b/browser/themes/addons/alpenglow/manifest.json index cb4afd17208a..caa4c51f9922 100644 --- a/browser/themes/addons/alpenglow/manifest.json +++ b/browser/themes/addons/alpenglow/manifest.json @@ -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": { diff --git a/browser/themes/addons/alpenglow/moz.build b/browser/themes/addons/alpenglow/moz.build deleted file mode 100644 index 3fd253f9704c..000000000000 --- a/browser/themes/addons/alpenglow/moz.build +++ /dev/null @@ -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', -] - diff --git a/browser/themes/addons/dark/manifest.json b/browser/themes/addons/dark/manifest.json index 46a4d023bc2a..b246ec6a59cf 100644 --- a/browser/themes/addons/dark/manifest.json +++ b/browser/themes/addons/dark/manifest.json @@ -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"}, diff --git a/browser/themes/addons/dark/moz.build b/browser/themes/addons/dark/moz.build deleted file mode 100644 index 61bce0dadde8..000000000000 --- a/browser/themes/addons/dark/moz.build +++ /dev/null @@ -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', -] diff --git a/browser/themes/addons/jar.mn b/browser/themes/addons/jar.mn new file mode 100644 index 000000000000..5aa122b2ab38 --- /dev/null +++ b/browser/themes/addons/jar.mn @@ -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) diff --git a/browser/themes/addons/light/manifest.json b/browser/themes/addons/light/manifest.json index 0d8d7d592668..24ffe228d236 100644 --- a/browser/themes/addons/light/manifest.json +++ b/browser/themes/addons/light/manifest.json @@ -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"}, diff --git a/browser/themes/addons/light/moz.build b/browser/themes/addons/light/moz.build deleted file mode 100644 index 1dacec81422f..000000000000 --- a/browser/themes/addons/light/moz.build +++ /dev/null @@ -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', -] diff --git a/toolkit/mozapps/extensions/default-theme/moz.build b/browser/themes/addons/moz.build similarity index 78% rename from toolkit/mozapps/extensions/default-theme/moz.build rename to browser/themes/addons/moz.build index 220d214d661c..aac3a838c4c2 100644 --- a/toolkit/mozapps/extensions/default-theme/moz.build +++ b/browser/themes/addons/moz.build @@ -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'] diff --git a/browser/themes/moz.build b/browser/themes/moz.build index dd8a745796af..9ca868304245 100644 --- a/browser/themes/moz.build +++ b/browser/themes/moz.build @@ -17,9 +17,7 @@ else: DIRS += ['windows'] DIRS += [ - 'addons/alpenglow', - 'addons/dark', - 'addons/light', + 'addons', ] with Files('osx/**'): diff --git a/services/sync/tests/unit/test_prefs_store.js b/services/sync/tests/unit/test_prefs_store.js index 696889c79af4..6236b8e5da63 100644 --- a/services/sync/tests/unit/test_prefs_store.js +++ b/services/sync/tests/unit/test_prefs_store.js @@ -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"); diff --git a/toolkit/mozapps/extensions/default-theme/manifest.json b/toolkit/mozapps/extensions/default-theme/manifest.json index 8bb30977a6ab..05d6e0e19a76 100644 --- a/toolkit/mozapps/extensions/default-theme/manifest.json +++ b/toolkit/mozapps/extensions/default-theme/manifest.json @@ -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"}, diff --git a/toolkit/mozapps/extensions/internal/XPIInstall.jsm b/toolkit/mozapps/extensions/internal/XPIInstall.jsm index 4e172f89694a..70eff3f904dd 100644 --- a/toolkit/mozapps/extensions/internal/XPIInstall.jsm +++ b/toolkit/mozapps/extensions/internal/XPIInstall.jsm @@ -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"; diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index 14bbba2b39b9..7b4e3b4f119a 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -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)); diff --git a/toolkit/mozapps/extensions/jar.mn b/toolkit/mozapps/extensions/jar.mn index 26e8bf76fd84..a203524e23a7 100644 --- a/toolkit/mozapps/extensions/jar.mn +++ b/toolkit/mozapps/extensions/jar.mn @@ -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 diff --git a/toolkit/mozapps/extensions/moz.build b/toolkit/mozapps/extensions/moz.build index f16056dda359..efad4d7127d4 100644 --- a/toolkit/mozapps/extensions/moz.build +++ b/toolkit/mozapps/extensions/moz.build @@ -16,7 +16,6 @@ if CONFIG['MOZ_BUILD_APP'] == 'mobile/android': DEFINES['MOZ_FENNEC'] = True DIRS += [ - 'default-theme', 'internal', ] TEST_DIRS += ['test'] diff --git a/toolkit/mozapps/extensions/test/browser/browser_html_detail_view.js b/toolkit/mozapps/extensions/test/browser/browser_html_detail_view.js index d38e92cb3177..817edc628856 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_html_detail_view.js +++ b/toolkit/mozapps/extensions/test/browser/browser_html_detail_view.js @@ -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();