Bug 1372694 - Stop making the default theme a heavyweight theme. r=kmag,aswan

MozReview-Commit-ID: 30wMauuc9oo

--HG--
rename : browser/base/content/default-theme-icon.svg => toolkit/mozapps/extensions/content/default-theme-icon.svg
extra : rebase_source : 5e4cf784135f4a8e40a2ed8357ba651e7fce9728
This commit is contained in:
Tim Nguyen 2018-04-01 13:53:31 +02:00
parent ba14455b5f
commit 92c9a958e1
53 changed files with 240 additions and 664 deletions

View File

@ -24,16 +24,11 @@ with Files("moz.build"):
with Files("Makefile.in"):
BUG_COMPONENT = ("Firefox Build System", "General")
with Files("profile/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/**"):
BUG_COMPONENT = ("Firefox", "Theme")
with Files("profile/channel-prefs.js"):
BUG_COMPONENT = ("Firefox", "Installer")
with Files("profile/firefox.js"):
BUG_COMPONENT = ("Firefox", "General")
DIRS += ['profile/extensions']
GeckoProgram(CONFIG['MOZ_APP_NAME'])
SOURCES += [

View File

@ -1,7 +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/.
DIRS += ['{972ce4c6-7e08-4474-a285-3208198ce6fd}']

View File

@ -1,42 +0,0 @@
<?xml version="1.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/. -->
#filter substitution
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>{972ce4c6-7e08-4474-a285-3208198ce6fd}</em:id>
<em:version>@FIREFOX_VERSION@</em:version>
<!-- Target Application this theme can install into,
with minimum and maximum supported versions. -->
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>@FIREFOX_VERSION@</em:minVersion>
<em:maxVersion>@FIREFOX_VERSION@</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Default</em:name>
<em:description>The default theme.</em:description>
<!-- Front End Integration Hooks (used by Theme Manager)-->
<em:creator>Mozilla</em:creator>
<em:contributor>Mozilla Contributors</em:contributor>
<!-- Allow lightweight themes to apply to this theme -->
<em:skinnable>true</em:skinnable>
<em:internalName>classic/1.0</em:internalName>
<em:iconURL>chrome://browser/content/default-theme-icon.svg</em:iconURL>
</Description>
</RDF>

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 = 'dist/bin/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}'
FINAL_TARGET_PP_FILES += [
'install.rdf.in',
]

View File

@ -81,7 +81,7 @@ pref("extensions.webextensions.remote", true);
#endif
// Extensions that should not be flagged as legacy in about:addons
pref("extensions.legacy.exceptions", "{972ce4c6-7e08-4474-a285-3208198ce6fd},testpilot@cliqz.com,@testpilot-containers,jid1-NeEaf3sAHdKHPA@jetpack,@activity-streams,pulse@mozilla.com,@testpilot-addon,@min-vid,tabcentertest1@mozilla.com,snoozetabs@mozilla.com,speaktome@mozilla.com,hoverpad@mozilla.com");
pref("extensions.legacy.exceptions", "testpilot@cliqz.com,@testpilot-containers,jid1-NeEaf3sAHdKHPA@jetpack,@activity-streams,pulse@mozilla.com,@testpilot-addon,@min-vid,tabcentertest1@mozilla.com,snoozetabs@mozilla.com,speaktome@mozilla.com,hoverpad@mozilla.com");
// Require signed add-ons by default
pref("extensions.langpacks.signatures.required", true);
@ -190,9 +190,6 @@ pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla
pref("extensions.update.interval", 86400); // Check for updates to Extensions and
// Themes every day
pref("extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.name", "chrome://browser/locale/browser.properties");
pref("extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.description", "chrome://browser/locale/browser.properties");
pref("extensions.webextensions.themes.enabled", true);
pref("extensions.webextensions.themes.icons.buttons", "back,forward,reload,stop,bookmark_star,bookmark_menu,downloads,home,app_menu,cut,copy,paste,new_window,new_private_window,save_page,print,history,full_screen,find,options,addons,developer,synced_tabs,open_file,sidebars,share_page,subscribe,text_encoding,email_link,forget,pocket");
@ -1257,7 +1254,7 @@ pref("services.sync.syncedTabs.showRemoteIcons", true);
pref("lightweightThemes.selectedThemeID", "firefox-compact-dark@mozilla.org",
sticky);
#else
pref("lightweightThemes.selectedThemeID", "", sticky);
pref("lightweightThemes.selectedThemeID", "default-theme@mozilla.org", sticky);
#endif
// Whether the character encoding menu is under the main Firefox button. This

View File

@ -146,9 +146,6 @@ with Files("browser-tabPreviews.xml"):
with Files("contentSearch*"):
BUG_COMPONENT = ("Firefox", "Search")
with Files("*.svg"):
BUG_COMPONENT = ("Firefox", "Theme")
with Files("hiddenWindow.xul"):
BUG_COMPONENT = ("Firefox", "Device Permissions")

View File

@ -78,7 +78,6 @@ support-files =
!/image/test/mochitest/blue.png
!/toolkit/content/tests/browser/common/mockTransfer.js
!/toolkit/modules/tests/browser/metadata_*.html
!/toolkit/mozapps/extensions/test/xpinstall/theme.xpi
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_addKeywordSearch.js]
@ -211,8 +210,6 @@ skip-if = toolkit != "cocoa" # Because of tests for supporting pasting from Serv
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_bug585830.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_bug592338.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_bug594131.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_bug596687.js]

View File

@ -1,117 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const TESTROOT = "http://example.com/browser/toolkit/mozapps/extensions/test/xpinstall/";
const {LightweightThemeManager} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
/**
* Wait for the given PopupNotification to display
*
* @param {string} name
* The name of the notification to wait for.
*
* @returns {Promise}
* Resolves with the notification window.
*/
function promisePopupNotificationShown(name) {
return new Promise(resolve => {
function popupshown() {
let notification = PopupNotifications.getNotification(name);
if (!notification) { return; }
ok(notification, `${name} notification shown`);
ok(PopupNotifications.isPanelOpen, "notification panel open");
PopupNotifications.panel.removeEventListener("popupshown", popupshown);
resolve(PopupNotifications.panel.firstChild);
}
PopupNotifications.panel.addEventListener("popupshown", popupshown);
});
}
var TESTS = [
function test_install_http() {
is(LightweightThemeManager.currentTheme, null, "Should be no lightweight theme selected");
var pm = Services.perms;
pm.add(makeURI("http://example.org/"), "install", pm.ALLOW_ACTION);
// NB: Not https so no installs allowed.
const URL = "http://example.org/browser/browser/base/content/test/general/bug592338.html";
BrowserTestUtils.openNewForegroundTab({ gBrowser, url: URL }).then(async function() {
let prompted = promisePopupNotificationShown("addon-webext-permissions");
BrowserTestUtils.synthesizeMouse("#theme-install", 2, 2, {}, gBrowser.selectedBrowser);
await prompted;
is(LightweightThemeManager.currentTheme, null, "Should not have installed the test theme");
gBrowser.removeTab(gBrowser.selectedTab);
pm.remove(makeURI("http://example.org/"), "install");
runNextTest();
});
},
function test_install_lwtheme() {
is(LightweightThemeManager.currentTheme, null, "Should be no lightweight theme selected");
var pm = Services.perms;
pm.add(makeURI("https://example.com/"), "install", pm.ALLOW_ACTION);
const URL = "https://example.com/browser/browser/base/content/test/general/bug592338.html";
BrowserTestUtils.openNewForegroundTab({ gBrowser, url: URL }).then(() => {
let promise = promisePopupNotificationShown("addon-installed");
BrowserTestUtils.synthesizeMouse("#theme-install", 2, 2, {}, gBrowser.selectedBrowser);
promise.then(() => {
is(LightweightThemeManager.currentTheme.id, "test", "Should have installed the test theme");
LightweightThemeManager.currentTheme = null;
gBrowser.removeTab(gBrowser.selectedTab);
Services.perms.remove(makeURI("http://example.com/"), "install");
runNextTest();
});
});
}
];
async function runNextTest() {
let aInstalls = await AddonManager.getAllInstalls();
is(aInstalls.length, 0, "Should be no active installs");
if (TESTS.length == 0) {
let aAddon = await AddonManager.getAddonByID("theme-xpi@tests.mozilla.org");
aAddon.uninstall();
Services.prefs.setBoolPref("extensions.logging.enabled", false);
finish();
return;
}
info("Running " + TESTS[0].name);
TESTS.shift()();
}
async function test() {
waitForExplicitFinish();
Services.prefs.setBoolPref("extensions.logging.enabled", true);
let aInstall = await AddonManager.getInstallForURL(TESTROOT + "theme.xpi", "application/x-xpinstall");
aInstall.addListener({
async onInstallEnded() {
let aAddon = await AddonManager.getAddonByID("theme-xpi@tests.mozilla.org");
isnot(aAddon, null, "Should have installed the test theme.");
runNextTest();
}
});
aInstall.install();
}

View File

@ -76,7 +76,6 @@ browser.jar:
content/browser/browser-webrender.js (content/browser-webrender.js)
content/browser/tab-content.js (content/tab-content.js)
content/browser/content.js (content/content.js)
content/browser/default-theme-icon.svg (content/default-theme-icon.svg)
content/browser/defaultthemes/1.header.jpg (content/defaultthemes/1.header.jpg)
content/browser/defaultthemes/1.icon.jpg (content/defaultthemes/1.icon.jpg)
content/browser/defaultthemes/1.preview.jpg (content/defaultthemes/1.preview.jpg)
@ -92,8 +91,8 @@ browser.jar:
content/browser/defaultthemes/5.header.png (content/defaultthemes/5.header.png)
content/browser/defaultthemes/5.icon.jpg (content/defaultthemes/5.icon.jpg)
content/browser/defaultthemes/5.preview.jpg (content/defaultthemes/5.preview.jpg)
content/browser/defaultthemes/dark.icon.svg (content/defaultthemes/dark.icon.svg)
content/browser/defaultthemes/light.icon.svg (content/defaultthemes/light.icon.svg)
content/browser/defaultthemes/dark.icon.svg (content/defaultthemes/dark.icon.svg)
content/browser/defaultthemes/light.icon.svg (content/defaultthemes/light.icon.svg)
* content/browser/pageinfo/pageInfo.xul (content/pageinfo/pageInfo.xul)
content/browser/pageinfo/pageInfo.js (content/pageinfo/pageInfo.js)
content/browser/pageinfo/pageInfo.css (content/pageinfo/pageInfo.css)

View File

@ -2905,7 +2905,8 @@ var CustomizableUIInternal = {
return false;
}
if (LightweightThemeManager.currentTheme) {
if (LightweightThemeManager.currentTheme &&
LightweightThemeManager.currentTheme.id != "default-theme@mozilla.org") {
log.debug(LightweightThemeManager.currentTheme + " theme is non-default");
return false;
}

View File

@ -1339,8 +1339,8 @@ CustomizeMode.prototype = {
this._onUIChange();
},
async onLWThemesMenuShowing(aEvent) {
const DEFAULT_THEME_ID = "{972ce4c6-7e08-4474-a285-3208198ce6fd}";
onLWThemesMenuShowing(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 MAX_THEME_COUNT = 6;
@ -1363,21 +1363,13 @@ CustomizeMode.prototype = {
panel.hidePopup();
};
let aDefaultTheme = await AddonManager.getAddonByID(DEFAULT_THEME_ID);
let doc = this.window.document;
function buildToolbarButton(aTheme) {
let tbb = doc.createElement("toolbarbutton");
tbb.theme = aTheme;
tbb.setAttribute("label", aTheme.name);
if (aDefaultTheme == aTheme) {
// The actual icon is set up so it looks nice in about:addons, but
// we'd like the version that's correct for the OS we're on, so we set
// an attribute that our styling will then use to display the icon.
tbb.setAttribute("defaulttheme", "true");
} else {
tbb.setAttribute("image", aTheme.iconURL);
}
tbb.setAttribute("image", aTheme.iconURL);
if (aTheme.description)
tbb.setAttribute("tooltiptext", aTheme.description);
tbb.setAttribute("tabindex", "0");
@ -1396,14 +1388,14 @@ CustomizeMode.prototype = {
return tbb;
}
let themes = [aDefaultTheme];
let themes = [];
let lwts = LightweightThemeManager.usedThemes;
let currentLwt = LightweightThemeManager.currentTheme;
let activeThemeID = currentLwt ? currentLwt.id : DEFAULT_THEME_ID;
// Move the current theme (if any) and the light/dark themes to the start:
let importantThemes = [LIGHT_THEME_ID, DARK_THEME_ID];
let importantThemes = [DEFAULT_THEME_ID, LIGHT_THEME_ID, DARK_THEME_ID];
if (currentLwt && !importantThemes.includes(currentLwt.id)) {
importantThemes.push(currentLwt.id);
}

View File

@ -4,7 +4,7 @@
"use strict";
const DEFAULT_THEME_ID = "{972ce4c6-7e08-4474-a285-3208198ce6fd}";
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 {LightweightThemeManager} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
@ -95,7 +95,8 @@ add_task(async function() {
let defaultTheme = header.nextSibling;
defaultTheme.doCommand();
is(Services.prefs.getCharPref("lightweightThemes.selectedThemeID"), "", "No lwtheme should be selected");
is(Services.prefs.getCharPref("lightweightThemes.selectedThemeID"),
DEFAULT_THEME_ID, "Default theme should be selected");
// ensure current theme isn't set to "Default"
popupShownPromise = popupShown(popup);
@ -111,7 +112,7 @@ add_task(async function() {
// check that "Restore Defaults" button resets theme
await gCustomizeMode.reset();
is(LightweightThemeManager.currentTheme, null, "Current theme reset to default");
is(LightweightThemeManager.currentTheme.id, DEFAULT_THEME_ID, "Current theme reset to default");
await endCustomizing();
Services.prefs.setCharPref("lightweightThemes.usedThemes", "[]");

View File

@ -37,7 +37,7 @@ add_task(async function() {
ok(CustomizableUI.inDefaultState, "In default state after reset");
is(undoResetButton.hidden, false, "The undo button is visible after reset");
is(LightweightThemeManager.currentTheme, null, "Theme reset to default");
is(LightweightThemeManager.currentTheme.id, "default-theme@mozilla.org", "Theme reset to default");
await gCustomizeMode.undoReset();

View File

@ -81,7 +81,6 @@ browser/chrome/pdfjs/content/web/images/findbarButton-previous-rtl.png
browser/chrome/pdfjs/content/web/images/findbarButton-previous-rtl@2x.png
browser/chrome/pdfjs/content/web/images/findbarButton-previous.png
browser/chrome/pdfjs/content/web/images/findbarButton-previous@2x.png
browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/icon.png
browser/features/firefox@getpocket.com/chrome/skin/linux/menuPanel.png
browser/features/firefox@getpocket.com/chrome/skin/linux/menuPanel@2x.png
browser/features/firefox@getpocket.com/chrome/skin/windows/menuPanel.png

View File

@ -404,8 +404,6 @@
@RESPATH@/browser/chrome/browser.manifest
@RESPATH@/browser/chrome/pdfjs.manifest
@RESPATH@/browser/chrome/pdfjs/*
@RESPATH@/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/chrome.manifest
@RESPATH@/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf
@RESPATH@/chrome/toolkit@JAREXT@
@RESPATH@/chrome/toolkit.manifest
@RESPATH@/chrome/recording.manifest

View File

@ -625,9 +625,6 @@ ctrlTab.listAllTabs.label=;List All #1 Tabs
# Used as the bookmark name when saving a keyword for a search field.
addKeywordTitleAutoFill=Search %S
extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.name=Default
extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.description=The default theme.
# safeModeRestart
safeModeRestartPromptTitle=Restart with Add-ons Disabled
safeModeRestartPromptMessage=Are you sure you want to disable all add-ons and restart?

View File

@ -50,7 +50,6 @@ browser.jar:
skin/classic/browser/e10s-64@2x.png (../shared/e10s-64@2x.png)
[extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
% override chrome://browser/skin/feeds/audioFeedIcon.png chrome://browser/skin/feeds/feedIcon.png
% override chrome://browser/skin/feeds/audioFeedIcon16.png chrome://browser/skin/feeds/feedIcon16.png
% override chrome://browser/skin/feeds/videoFeedIcon.png chrome://browser/skin/feeds/feedIcon.png

View File

@ -61,7 +61,6 @@ browser.jar:
skin/classic/browser/tabbrowser/tabDragIndicator@2x.png (tabbrowser/tabDragIndicator@2x.png)
skin/classic/browser/e10s-64@2x.png (../shared/e10s-64@2x.png)
[extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
% override chrome://browser/skin/feeds/audioFeedIcon.png chrome://browser/skin/feeds/feedIcon.png
% override chrome://browser/skin/feeds/audioFeedIcon16.png chrome://browser/skin/feeds/feedIcon16.png
% override chrome://browser/skin/feeds/videoFeedIcon.png chrome://browser/skin/feeds/feedIcon.png

View File

@ -158,7 +158,7 @@
}
#customization-lwtheme-button > .box-inherit > .box-inherit > .button-icon {
background-image: url("chrome://browser/content/default-theme-icon.svg");
background-image: url("chrome://mozapps/content/extensions/default-theme-icon.svg");
}
#customization-uidensity-button > .box-inherit > .box-inherit > .button-icon {
@ -334,10 +334,6 @@ toolbarpaletteitem[place=toolbar] > toolbarspring {
color: inherit;
}
.customization-lwtheme-menu-theme[defaulttheme] {
list-style-image: url(chrome://browser/content/default-theme-icon.svg);
}
#customization-uidensity-menuitem-normal {
list-style-image: url("chrome://browser/skin/customizableui/density-normal.svg");
}

View File

@ -61,7 +61,6 @@ browser.jar:
skin/classic/browser/window-controls/restore-themes.svg (window-controls/restore-themes.svg)
skin/classic/browser/e10s-64@2x.png (../shared/e10s-64@2x.png)
[extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
% override chrome://browser/skin/page-livemarks.png chrome://browser/skin/feeds/feedIcon16.png
% override chrome://browser/skin/feeds/audioFeedIcon.png chrome://browser/skin/feeds/feedIcon.png
% override chrome://browser/skin/feeds/audioFeedIcon16.png chrome://browser/skin/feeds/feedIcon16.png

View File

@ -1,6 +1,7 @@
[DEFAULT]
head = head_psm.js
tags = psm
firefox-appdir = browser
support-files =
bad_certs/**
ocsp_certs/**

View File

@ -109,8 +109,7 @@ add_task(async function run_test() {
// Ensure we don't go to the network to fetch personas and end up leaking
// stuff.
Services.io.offline = true;
Assert.ok(!prefs.get("lightweightThemes.selectedThemeID"));
Assert.equal(LightweightThemeManager.currentTheme, null);
Assert.equal(LightweightThemeManager.currentTheme.id, "default-theme@mozilla.org");
let persona1 = makePersona();
let persona2 = makePersona();
@ -130,8 +129,7 @@ add_task(async function run_test() {
"lightweightThemes.usedThemes": usedThemes
};
await store.update(record);
Assert.ok(!prefs.get("lightweightThemes.selectedThemeID"));
Assert.equal(LightweightThemeManager.currentTheme, null);
Assert.equal(LightweightThemeManager.currentTheme.id, "default-theme@mozilla.org");
_("Only the current app's preferences are applied.");
record = new PrefRec("prefs", "some-fake-app");

View File

@ -124,7 +124,6 @@ add_task(async function test_management_themes() {
accentcolor: Math.random().toString(),
};
is(await extension.awaitMessage("onInstalled"), "Bling", "LWT installed");
is(await extension.awaitMessage("onDisabled"), "Default", "default disabled");
is(await extension.awaitMessage("onEnabled"), "Bling", "LWT enabled");
await theme.startup();

View File

@ -34,7 +34,7 @@ add_task(async function test_management_getAll() {
});
let addons = await browser.management.getAll();
browser.test.assertEq(addons.length, 2, "management.getAll returned two extensions.");
browser.test.assertEq(addons.length, 3, "management.getAll returned three add-ons.");
browser.test.sendMessage("addons", addons);
}

View File

@ -11,7 +11,6 @@ support-files =
engine.xml
system.xpi
restartless.xpi
theme.xpi
testUnicodePDB32.dll
testNoPDB32.dll
testUnicodePDB64.dll
@ -22,7 +21,6 @@ generated-files =
experiment.xpi
system.xpi
restartless.xpi
theme.xpi
[test_MigratePendingPings.js]
[test_TelemetryHistograms.js]

View File

@ -37,3 +37,8 @@ newTabControlled.learnMore = Learn more
#LOCALIZATION NOTE (homepageControlled.message) %S is the icon and name of the extension which updated the homepage.
homepageControlled.message = An extension, %S, changed what you see when you open your homepage and new windows.
homepageControlled.learnMore = Learn more
# LOCALIZATION NOTE (defaultTheme.name): This is displayed in about:addons -> Appearance
defaultTheme.name=Default
defaultTheme.description=The default theme.

View File

@ -45,6 +45,8 @@ const KEY_PROFILEDIR = "ProfD";
const KEY_APPDIR = "XCurProcD";
const FILE_BLOCKLIST = "blocklist.xml";
const DEFAULT_THEME_ID = "default-theme@mozilla.org";
const BRANCH_REGEXP = /^([^\.]+\.[0-9]+[a-z]*).*/gi;
const PREF_EM_CHECK_COMPATIBILITY_BASE = "extensions.checkCompatibility";
var PREF_EM_CHECK_COMPATIBILITY = MOZ_COMPATIBILITY_NIGHTLY ?
@ -70,6 +72,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
AddonRepository: "resource://gre/modules/addons/AddonRepository.jsm",
Extension: "resource://gre/modules/Extension.jsm",
FileUtils: "resource://gre/modules/FileUtils.jsm",
LightweightThemeManager: "resource://gre/modules/LightweightThemeManager.jsm",
PromptUtils: "resource://gre/modules/SharedPromptUtils.jsm",
});
@ -838,6 +841,27 @@ var AddonManagerInternal = {
AddonManagerPrivate.recordException("AMI", "startup failed", e);
}
let brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
let extensionsBundle = Services.strings.createBundle(
"chrome://global/locale/extensions.properties");
// When running in xpcshell tests, the default theme may already
// exist.
if (!LightweightThemeManager._builtInThemes.has(DEFAULT_THEME_ID)) {
let author = "Mozilla";
try {
author = brandBundle.GetStringFromName("vendorShortName");
} catch (e) {}
LightweightThemeManager.addBuiltInTheme({
id: DEFAULT_THEME_ID,
name: extensionsBundle.GetStringFromName("defaultTheme.name"),
description: extensionsBundle.GetStringFromName("defaultTheme.description"),
iconURL: "chrome://mozapps/content/extensions/default-theme-icon.svg",
author,
});
}
logger.debug("Completed startup sequence");
this.callManagerListeners("onStartup");
},

View File

@ -12,12 +12,12 @@ ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const ID_SUFFIX = "@personas.mozilla.org";
const PREF_LWTHEME_TO_SELECT = "extensions.lwThemeToSelect";
const ADDON_TYPE = "theme";
const ADDON_TYPE_WEBEXT = "webextension-theme";
const URI_EXTENSION_STRINGS = "chrome://mozapps/locale/extensions/extensions.properties";
const DEFAULT_THEME_ID = "default-theme@mozilla.org";
const DEFAULT_MAX_USED_THEMES_COUNT = 30;
const MAX_PREVIEW_SECONDS = 30;
@ -120,7 +120,7 @@ var LightweightThemeManager = {
},
get currentTheme() {
let selectedThemeID = _prefs.getCharPref("selectedThemeID", "");
let selectedThemeID = _prefs.getStringPref("selectedThemeID", DEFAULT_THEME_ID);
let data = null;
if (selectedThemeID) {
@ -131,7 +131,7 @@ var LightweightThemeManager = {
get currentThemeForDisplay() {
var data = this.currentTheme;
if (!data && _fallbackThemeData)
if ((!data || data.id == DEFAULT_THEME_ID) && _fallbackThemeData)
data = _fallbackThemeData;
if (data && PERSIST_ENABLED) {
@ -189,7 +189,7 @@ var LightweightThemeManager = {
this._builtInThemes.set(theme.id, theme);
if (_prefs.getCharPref("selectedThemeID") == theme.id) {
if (_prefs.getStringPref("selectedThemeID", DEFAULT_THEME_ID) == theme.id) {
this.currentTheme = theme;
}
},
@ -323,15 +323,6 @@ var LightweightThemeManager = {
* necessary.
*/
startup() {
if (Services.prefs.prefHasUserValue(PREF_LWTHEME_TO_SELECT)) {
let id = Services.prefs.getCharPref(PREF_LWTHEME_TO_SELECT);
if (id)
this.themeChanged(this.getUsedTheme(id));
else
this.themeChanged(null);
Services.prefs.clearUserPref(PREF_LWTHEME_TO_SELECT);
}
_prefs.addObserver("", _prefObserver);
},
@ -350,47 +341,29 @@ var LightweightThemeManager = {
* The ID of the newly enabled add-on
* @param aType
* The type of the newly enabled add-on
* @param aPendingRestart
* true if the newly enabled add-on will only become enabled after a
* restart
*/
addonChanged(aId, aType, aPendingRestart) {
addonChanged(aId, aType) {
if (aType != ADDON_TYPE && aType != ADDON_TYPE_WEBEXT)
return;
let id = _getInternalID(aId);
let current = this.currentTheme;
try {
let next = Services.prefs.getCharPref(PREF_LWTHEME_TO_SELECT);
if (id == next && aPendingRestart)
return;
Services.prefs.clearUserPref(PREF_LWTHEME_TO_SELECT);
if (next) {
AddonManagerPrivate.callAddonListeners("onOperationCancelled",
new AddonWrapper(this.getUsedTheme(next)));
} else if (id == current.id) {
AddonManagerPrivate.callAddonListeners("onOperationCancelled",
new AddonWrapper(current));
return;
}
} catch (e) {
if (current && id == current.id) {
AddonManagerPrivate.callAddonListeners("onOperationCancelled",
new AddonWrapper(current));
return;
}
if (current) {
if (current.id == id)
if (current.id == id || (!aId && current.id == DEFAULT_THEME_ID))
return;
_themeIDBeingDisabled = current.id;
let wrapper = new AddonWrapper(current);
if (aPendingRestart) {
Services.prefs.setCharPref(PREF_LWTHEME_TO_SELECT, "");
AddonManagerPrivate.callAddonListeners("onDisabling", wrapper, true);
} else {
AddonManagerPrivate.callAddonListeners("onDisabling", wrapper, false);
this.themeChanged(null);
AddonManagerPrivate.callAddonListeners("onDisabled", wrapper);
}
AddonManagerPrivate.callAddonListeners("onDisabling", wrapper, false);
this.themeChanged(null);
AddonManagerPrivate.callAddonListeners("onDisabled", wrapper);
_themeIDBeingDisabled = null;
}
@ -401,17 +374,11 @@ var LightweightThemeManager = {
return;
_themeIDBeingEnabled = id;
let wrapper = new AddonWrapper(theme);
if (aPendingRestart) {
AddonManagerPrivate.callAddonListeners("onEnabling", wrapper, true);
Services.prefs.setCharPref(PREF_LWTHEME_TO_SELECT, id);
// Flush the preferences to disk so they survive any crash
Services.prefs.savePrefFile(null);
} else {
AddonManagerPrivate.callAddonListeners("onEnabling", wrapper, false);
this.themeChanged(theme);
AddonManagerPrivate.callAddonListeners("onEnabled", wrapper);
}
AddonManagerPrivate.callAddonListeners("onEnabling", wrapper, false);
this.themeChanged(theme);
AddonManagerPrivate.callAddonListeners("onEnabled", wrapper);
_themeIDBeingEnabled = null;
}
},
@ -464,7 +431,7 @@ function AddonWrapper(aTheme) {
AddonWrapper.prototype = {
get id() {
return themeFor(this).id + ID_SUFFIX;
return _getExternalID(themeFor(this).id);
},
get type() {
@ -522,7 +489,7 @@ AddonWrapper.prototype = {
permissions = AddonManager.PERM_CAN_UNINSTALL;
if (this.userDisabled)
permissions |= AddonManager.PERM_CAN_ENABLE;
else
else if (themeFor(this).id != DEFAULT_THEME_ID)
permissions |= AddonManager.PERM_CAN_DISABLE;
return permissions;
},
@ -534,13 +501,8 @@ AddonWrapper.prototype = {
if (_themeIDBeingDisabled == id)
return true;
try {
let toSelect = Services.prefs.getCharPref(PREF_LWTHEME_TO_SELECT);
return id != toSelect;
} catch (e) {
let current = LightweightThemeManager.currentTheme;
return !current || current.id != id;
}
let current = LightweightThemeManager.currentTheme;
return !current || current.id != id;
},
set userDisabled(val) {
@ -638,12 +600,20 @@ AddonWrapper.prototype = {
function _getInternalID(id) {
if (!id)
return null;
if (id == DEFAULT_THEME_ID)
return id;
let len = id.length - ID_SUFFIX.length;
if (len > 0 && id.substring(len) == ID_SUFFIX)
return id.substring(0, len);
return null;
}
function _getExternalID(id) {
if (id == DEFAULT_THEME_ID)
return id;
return id + ID_SUFFIX;
}
function _setCurrentTheme(aData, aLocal) {
aData = _sanitizeTheme(aData, null, aLocal);
@ -691,7 +661,7 @@ function _setCurrentTheme(aData, aLocal) {
return null;
if (notify) {
AddonManagerPrivate.notifyAddonChanged(aData ? aData.id + ID_SUFFIX : null,
AddonManagerPrivate.notifyAddonChanged(aData ? _getExternalID(aData.id) : null,
ADDON_TYPE, false);
}

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -245,7 +245,8 @@ function isLegacyExtension(addon) {
// themes so explicitly check for new style themes (for which
// isWebExtension is true) or lightweight themes (which have
// ids that end with @personas.mozilla.org)
legacy = !(addon.isWebExtension || addon.id.endsWith("@personas.mozilla.org"));
legacy = !(addon.isWebExtension || addon.id.endsWith("@personas.mozilla.org") ||
addon.id == "default-theme@mozilla.org");
}
if (legacy && (addon.hidden || addon.signedState == AddonManager.SIGNEDSTATE_PRIVILEGED)) {

View File

@ -959,6 +959,8 @@ var AddonTestUtils = {
var zipW = ZipWriter(zipFile, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | flags);
for (let [path, data] of Object.entries(files)) {
if (typeof data === "object" && ChromeUtils.getClassName(data) === "Object")
data = JSON.stringify(data);
if (!(data instanceof ArrayBuffer))
data = new TextEncoder("utf-8").encode(data).buffer;

View File

@ -71,8 +71,6 @@ ChromeUtils.defineModuleGetter(this, "XPIProvider",
const PREF_ALLOW_NON_RESTARTLESS = "extensions.legacy.non-restartless.enabled";
const DEFAULT_SKIN = "classic/1.0";
/* globals AddonInternal, BOOTSTRAP_REASONS, KEY_APP_SYSTEM_ADDONS, KEY_APP_SYSTEM_DEFAULTS, KEY_APP_TEMPORARY, TEMPORARY_ADDON_SUFFIX, SIGNED_TYPES, TOOLKIT_ID, XPIDatabase, XPIStates, getExternalType, isTheme, isUsableAddon, isWebExtension, mustSign, recordAddonTelemetry */
const XPI_INTERNAL_SYMBOLS = [
"AddonInternal",
@ -158,14 +156,13 @@ const PROP_TARGETAPP = ["id", "minVersion", "maxVersion"];
// Map new string type identifiers to old style nsIUpdateItem types.
// Retired values:
// 8 = locale
// 32 = multipackage xpi file
// 8 = locale
// 256 = apiextension
// 128 = experiment
// theme = 4
const TYPES = {
extension: 2,
theme: 4,
dictionary: 64,
};
@ -801,16 +798,7 @@ async function loadManifestFromRDF(aUri, aData) {
addon.targetPlatforms.push(platform);
}
// A theme's userDisabled value is true if the theme is not the selected skin
// or if there is an active lightweight theme. We ignore whether softblocking
// is in effect since it would change the active theme.
if (isTheme(addon.type)) {
addon.userDisabled = !!LightweightThemeManager.currentTheme ||
addon.internalName != DEFAULT_SKIN;
} else {
addon.userDisabled = false;
}
addon.userDisabled = false;
addon.softDisabled = addon.blocklistState == nsIBlocklistService.STATE_SOFTBLOCKED;
addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;

View File

@ -87,8 +87,6 @@ const PREF_EM_MIN_COMPAT_PLATFORM_VERSION = "extensions.minCompatiblePlatformVer
const PREF_EM_LAST_APP_BUILD_ID = "extensions.lastAppBuildId";
const DEFAULT_SKIN = "classic/1.0";
// Specify a list of valid built-in add-ons to load.
const BUILT_IN_ADDONS_URI = "chrome://browser/content/built_in_addons.json";
@ -112,8 +110,6 @@ const FILE_RDF_MANIFEST = "install.rdf";
const FILE_WEB_MANIFEST = "manifest.json";
const FILE_XPI_ADDONS_LIST = "extensions.ini";
const ADDON_ID_DEFAULT_THEME = "{972ce4c6-7e08-4474-a285-3208198ce6fd}";
const KEY_PROFILEDIR = "ProfD";
const KEY_ADDON_APP_DIR = "XREAddonAppDir";
const KEY_APP_DISTRIBUTION = "XREAppDist";
@ -128,6 +124,8 @@ const KEY_APP_SYSTEM_SHARE = "app-system-share";
const KEY_APP_SYSTEM_USER = "app-system-user";
const KEY_APP_TEMPORARY = "app-temporary";
const DEFAULT_THEME_ID = "default-theme@mozilla.org";
const TEMPORARY_ADDON_SUFFIX = "@temporary-addon";
const STARTUP_MTIME_SCOPES = [KEY_APP_GLOBAL,
@ -142,7 +140,7 @@ const TOOLKIT_ID = "toolkit@mozilla.org";
const XPI_SIGNATURE_CHECK_PERIOD = 24 * 60 * 60;
XPCOMUtils.defineConstant(this, "DB_SCHEMA", 24);
XPCOMUtils.defineConstant(this, "DB_SCHEMA", 25);
const NOTIFICATION_TOOLBOX_CONNECTION_CHANGE = "toolbox-connection-change";
@ -211,7 +209,6 @@ const SIGNED_TYPES = new Set([
const LEGACY_TYPES = new Set([
"extension",
"theme",
]);
const ALL_EXTERNAL_TYPES = new Set([
@ -289,7 +286,6 @@ function loadLazyObjects() {
SIGNED_TYPES,
BOOTSTRAP_REASONS,
DB_SCHEMA,
DEFAULT_SKIN,
AddonInternal,
XPIProvider,
XPIStates,
@ -791,9 +787,6 @@ function isDisabledLegacy(addon) {
* @return true if the add-on should not be appDisabled
*/
function isUsableAddon(aAddon) {
if (aAddon.type == "theme")
return aAddon.internalName == DEFAULT_SKIN;
if (mustSign(aAddon.type) && !aAddon.isCorrectlySigned) {
logger.warn(`Add-on ${aAddon.id} is not correctly signed.`);
if (Services.prefs.getBoolPref(PREF_XPI_SIGNATURES_DEV_ROOT, false)) {
@ -1201,14 +1194,7 @@ class XPIState {
// We don't use aDBAddon.active here because it's not updated until after restart.
let mustGetMod = (aDBAddon.visible && !aDBAddon.disabled && !this.enabled);
// We need to treat XUL themes specially here, since lightweight
// themes require the default theme's chrome to be registered even
// though we report it as disabled for UI purposes.
if (aDBAddon.type == "theme") {
this.enabled = aDBAddon.internalName == DEFAULT_SKIN;
} else {
this.enabled = aDBAddon.visible && !aDBAddon.disabled;
}
this.enabled = aDBAddon.visible && !aDBAddon.disabled;
this.version = aDBAddon.version;
this.type = aDBAddon.type;
@ -2060,9 +2046,6 @@ var XPIProvider = {
if (AppConstants.MOZ_CRASHREPORTER) {
// Annotate the crash report with relevant add-on information.
try {
Services.appinfo.annotateCrashReport("Theme", DEFAULT_SKIN);
} catch (e) { }
try {
Services.appinfo.annotateCrashReport("EMCheckCompatibility",
AddonManager.checkCompatibility);
@ -2883,30 +2866,6 @@ var XPIProvider = {
.filter(addon => addon.dependencies.includes(aAddon.id));
},
/**
* Returns the add-on state data for the restartful extensions which
* should be available in safe mode. In particular, this means the
* default theme, and only the default theme.
*
* @returns {object}
*/
getSafeModeExtensions() {
let loc = XPIStates.getLocation(KEY_APP_GLOBAL);
let state = loc.get(ADDON_ID_DEFAULT_THEME);
// Use the default state data for the default theme, but always mark
// it enabled, in case another theme is enabled in normal mode.
let addonData = state.toJSON();
addonData.enabled = true;
return {
[KEY_APP_GLOBAL]: {
path: loc.path,
addons: { [ADDON_ID_DEFAULT_THEME]: addonData },
},
};
},
/**
* Checks for any changes that have occurred since the last time the
* application was launched.
@ -3006,25 +2965,13 @@ var XPIProvider = {
}
}
if (Services.appinfo.inSafeMode) {
aomStartup.initializeExtensions(this.getSafeModeExtensions());
logger.debug("Initialized safe mode add-ons");
return false;
}
// If the application crashed before completing any pending operations then
// we should perform them now.
if (extensionListChanged || hasPendingChanges) {
this._updateActiveAddons();
// Serialize and deserialize so we get the expected JSON data.
let state = JSON.parse(JSON.stringify(XPIStates));
aomStartup.initializeExtensions(state);
return true;
}
aomStartup.initializeExtensions(XPIStates.initialStateData);
logger.debug("No changes found");
} catch (e) {
logger.error("Error during startup file checks", e);
@ -3570,14 +3517,21 @@ var XPIProvider = {
if (!isTheme(aType))
return;
let addons = XPIDatabase.getAddonsByType("theme", "webextension-theme");
let addons = XPIDatabase.getAddonsByType("webextension-theme");
for (let theme of addons) {
if (isWebExtension(theme.type) && theme.visible && theme.id != aId)
this.updateAddonDisabledState(theme, true, undefined);
if (theme.visible && theme.id != aId)
this.updateAddonDisabledState(theme, true, undefined, true);
}
let defaultTheme = XPIDatabase.getVisibleAddonForInternalName(DEFAULT_SKIN);
this.updateAddonDisabledState(defaultTheme, aId && aId != defaultTheme.id);
if (!aId && (!LightweightThemeManager.currentTheme ||
LightweightThemeManager.currentTheme !== DEFAULT_THEME_ID)) {
let theme = LightweightThemeManager.getUsedTheme(DEFAULT_THEME_ID);
// This can only ever be null in tests.
// This can all go away once lightweight themes are gone.
if (theme) {
LightweightThemeManager.currentTheme = theme;
}
}
},
/**
@ -3914,13 +3868,16 @@ var XPIProvider = {
* @param aSoftDisabled
* Value for the softDisabled property. If undefined the value will
* not change. If true this will force userDisabled to be true
* @param {boolean} aBecauseSelecting
* True if we're disabling this add-on because we're selecting
* another.
* @return a tri-state indicating the action taken for the add-on:
* - undefined: The add-on did not change state
* - true: The add-on because disabled
* - false: The add-on became enabled
* @throws if addon is not a DBAddonInternal
*/
updateAddonDisabledState(aAddon, aUserDisabled, aSoftDisabled) {
updateAddonDisabledState(aAddon, aUserDisabled, aSoftDisabled, aBecauseSelecting) {
if (!(aAddon.inDatabase))
throw new Error("Can only update addon states for installed addons.");
if (aUserDisabled !== undefined && aSoftDisabled !== undefined) {
@ -4016,12 +3973,16 @@ var XPIProvider = {
}
// Notify any other providers that a new theme has been enabled
if (isTheme(aAddon.type) && !isDisabled) {
AddonManagerPrivate.notifyAddonChanged(aAddon.id, aAddon.type);
if (isTheme(aAddon.type)) {
if (!isDisabled) {
AddonManagerPrivate.notifyAddonChanged(aAddon.id, aAddon.type);
if (xpiState) {
xpiState.syncWithDB(aAddon);
XPIStates.save();
if (xpiState) {
xpiState.syncWithDB(aAddon);
XPIStates.save();
}
} else if (isDisabled && !aBecauseSelecting) {
AddonManagerPrivate.notifyAddonChanged(null, "theme");
}
}
@ -4768,8 +4729,7 @@ AddonWrapper.prototype = {
}
}
let canUseIconURLs = this.isActive ||
(addon.type == "theme" && addon.internalName == DEFAULT_SKIN);
let canUseIconURLs = this.isActive;
if (canUseIconURLs && addon.iconURL) {
icons[32] = addon.iconURL;
icons[48] = addon.iconURL;
@ -4931,22 +4891,12 @@ AddonWrapper.prototype = {
}
if (addon.inDatabase) {
let theme = isTheme(addon.type);
if (theme && val) {
if (addon.internalName == DEFAULT_SKIN)
throw new Error("Cannot disable the default theme");
let defaultTheme = XPIDatabase.getVisibleAddonForInternalName(DEFAULT_SKIN);
XPIProvider.updateAddonDisabledState(defaultTheme, false);
}
if (!(theme && val) || isWebExtension(addon.type)) {
// hidden and system add-ons should not be user disasbled,
// as there is no UI to re-enable them.
if (this.hidden) {
throw new Error(`Cannot disable hidden add-on ${addon.id}`);
}
XPIProvider.updateAddonDisabledState(addon, val);
// hidden and system add-ons should not be user disabled,
// as there is no UI to re-enable them.
if (this.hidden) {
throw new Error(`Cannot disable hidden add-on ${addon.id}`);
}
XPIProvider.updateAddonDisabledState(addon, val);
} else {
addon.userDisabled = val;
// When enabling remove the softDisabled flag
@ -4965,8 +4915,6 @@ AddonWrapper.prototype = {
if (addon.inDatabase) {
// When softDisabling a theme just enable the active theme
if (isTheme(addon.type) && val && !addon.userDisabled) {
if (addon.internalName == DEFAULT_SKIN)
throw new Error("Cannot disable the default theme");
if (isWebExtension(addon.type))
XPIProvider.updateAddonDisabledState(addon, undefined, val);
} else {

View File

@ -8,7 +8,7 @@
/* globals ADDON_SIGNING, SIGNED_TYPES, BOOTSTRAP_REASONS, DB_SCHEMA,
AddonInternal, XPIProvider, XPIStates, syncLoadManifestFromFile,
isUsableAddon, recordAddonTelemetry,
flushChromeCaches, descriptorToPath, DEFAULT_SKIN */
flushChromeCaches, descriptorToPath */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
@ -48,7 +48,7 @@ const KEY_APP_TEMPORARY = "app-temporary";
// Properties to save in JSON file
const PROP_JSON_FIELDS = ["id", "syncGUID", "location", "version", "type",
"internalName", "updateURL", "optionsURL",
"updateURL", "optionsURL",
"optionsType", "optionsBrowserStyle", "aboutURL",
"defaultLocale", "visible", "active", "userDisabled",
"appDisabled", "pendingUninstall", "installDate",
@ -711,28 +711,6 @@ this.XPIDatabase = {
return _filterDB(this.addonDB, aAddon => aTypes.includes(aAddon.type));
},
/**
* Synchronously gets an add-on with a particular internalName.
*
* @param aInternalName
* The internalName of the add-on to retrieve
* @return a DBAddonInternal
*/
getVisibleAddonForInternalName(aInternalName) {
if (!this.addonDB) {
// This may be called when the DB hasn't otherwise been loaded
logger.warn(`Synchronous load of XPI database due to ` +
`getVisibleAddonForInternalName. Stack: ${Error().stack}`);
AddonManagerPrivate.recordSimpleMeasure("XPIDB_lateOpen_forInternalName",
XPIProvider.runPhase);
this.syncLoadDB(true);
}
return _findAddon(this.addonDB,
aAddon => aAddon.visible &&
(aAddon.internalName == aInternalName));
},
/**
* Asynchronously gets all add-ons with pending operations.
*
@ -1095,10 +1073,6 @@ this.XPIDatabaseReconcile = {
// appDisabled depends on whether the add-on is a foreignInstall so update
aNewAddon.appDisabled = !isUsableAddon(aNewAddon);
// The default theme is never a foreign install
if (aNewAddon.type == "theme" && aNewAddon.internalName == DEFAULT_SKIN)
aNewAddon.foreignInstall = false;
if (isDetectedInstall && aNewAddon.foreignInstall) {
// If the add-on is a foreign install and is in a scope where add-ons
// that were dropped in should default to disabled then disable it
@ -1460,11 +1434,7 @@ this.XPIDatabaseReconcile = {
// We might be recovering from a corrupt database, if so use the
// list of known active add-ons to update the new add-on
if (!wasStaged && XPIDatabase.activeBundles) {
// For themes we know which is active by the current skin setting
if (currentAddon.type == "theme")
isActive = currentAddon.internalName == DEFAULT_SKIN;
else
isActive = XPIDatabase.activeBundles.includes(currentAddon.path);
isActive = XPIDatabase.activeBundles.includes(currentAddon.path);
if (currentAddon.type == "webextension-theme")
currentAddon.userDisabled = !isActive;

View File

@ -22,6 +22,7 @@ toolkit.jar:
content/mozapps/extensions/pluginPrefs.xul (content/pluginPrefs.xul)
content/mozapps/extensions/pluginPrefs.js (content/pluginPrefs.js)
content/mozapps/extensions/OpenH264-license.txt (content/OpenH264-license.txt)
content/mozapps/extensions/default-theme-icon.svg (content/default-theme-icon.svg)
#endif
content/mozapps/xpinstall/xpinstallConfirm.xul (content/xpinstallConfirm.xul)
content/mozapps/xpinstall/xpinstallConfirm.js (content/xpinstallConfirm.js)

View File

@ -23,7 +23,6 @@ support-files =
!/toolkit/mozapps/extensions/test/xpinstall/incompatible.xpi
!/toolkit/mozapps/extensions/test/xpinstall/installtrigger.html
!/toolkit/mozapps/extensions/test/xpinstall/restartless.xpi
!/toolkit/mozapps/extensions/test/xpinstall/theme.xpi
!/toolkit/mozapps/extensions/test/xpinstall/unsigned.xpi
!/toolkit/mozapps/extensions/test/xpinstall/amosigned.xpi
!/toolkit/mozapps/extensions/test/xpinstall/amosigned-restart-required.xpi

View File

@ -1110,7 +1110,7 @@ function check_test_completed(aArgs) {
function ensure_test_completed() {
for (let i in gExpectedEvents) {
if (gExpectedEvents[i].length > 0)
do_throw("Didn't see all the expected events for " + i);
do_throw(`Didn't see all the expected events for ${i}: Still expecting ${gExpectedEvents[i].map(([k]) => k)}`);
}
gExpectedEvents = {};
if (gExpectedInstalls)

View File

@ -48,40 +48,37 @@ const ADDONS = [
},
},
{
"install.rdf": {
id: "test_AddonRepository_2@tests.mozilla.org",
type: 4,
internalName: "test2/1.0",
version: "1.2",
bootstrap: true,
"manifest.json": {
manifest_version: 2,
name: "XPI Add-on 2",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"}],
version: "1.2",
applications: {
gecko: {
id: "test_AddonRepository_2@tests.mozilla.org",
},
},
theme: {},
},
},
{
"install.rdf": {
id: "test_AddonRepository_3@tests.mozilla.org",
type: "4",
internalName: "test3/1.0",
version: "1.3",
bootstrap: true,
"manifest.json": {
manifest_version: 2,
name: "XPI Add-on 3",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"}],
version: "1.3",
applications: {
gecko: {
id: "test_AddonRepository_3@tests.mozilla.org",
},
},
theme: {},
icons: {32: "icon.png"},
},
"icon.png": "",
"preview.png": "",
},
];
const ADDON_IDS = ADDONS.map(addon => addon["install.rdf"].id);
const ADDON_IDS = ADDONS.map(addon => addon["install.rdf"] ? addon["install.rdf"].id : addon["manifest.json"].applications.gecko.id);
const ADDON_FILES = ADDONS.map(addon => AddonTestUtils.createTempXPIFile(addon));
const PREF_ADDON0_CACHE_ENABLED = "extensions." + ADDON_IDS[0] + ".getAddons.cache.enabled";

View File

@ -5,6 +5,8 @@ const OPTIONAL = ["headerURL", "footerURL", "textcolor", "accentcolor",
ChromeUtils.import("resource://gre/modules/Services.jsm");
const DEFAULT_THEME_ID = "default-theme@mozilla.org";
function dummy(id) {
return {
id: id || Math.random().toString(),
@ -31,39 +33,39 @@ async function run_test() {
Assert.equal(typeof ltm, "object");
Assert.equal(typeof ltm.usedThemes, "object");
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.currentTheme.id, DEFAULT_THEME_ID);
ltm.previewTheme(dummy("preview0"));
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.currentTheme.id, DEFAULT_THEME_ID);
ltm.previewTheme(dummy("preview1"));
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.currentTheme.id, DEFAULT_THEME_ID);
ltm.resetPreview();
ltm.currentTheme = dummy("x0");
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.currentTheme.id, "x0");
Assert.equal(ltm.usedThemes[0].id, "x0");
Assert.equal(ltm.getUsedTheme("x0").id, "x0");
ltm.previewTheme(dummy("preview0"));
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.currentTheme.id, "x0");
ltm.resetPreview();
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.currentTheme.id, "x0");
ltm.currentTheme = dummy("x1");
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.usedThemes.length, 3);
Assert.equal(ltm.currentTheme.id, "x1");
Assert.equal(ltm.usedThemes[1].id, "x0");
ltm.currentTheme = dummy("x2");
Assert.equal(ltm.usedThemes.length, 3);
Assert.equal(ltm.usedThemes.length, 4);
Assert.equal(ltm.currentTheme.id, "x2");
Assert.equal(ltm.usedThemes[1].id, "x1");
Assert.equal(ltm.usedThemes[2].id, "x0");
@ -73,25 +75,25 @@ async function run_test() {
ltm.currentTheme = dummy("x5");
ltm.currentTheme = dummy("x6");
ltm.currentTheme = dummy("x7");
Assert.equal(ltm.usedThemes.length, 8);
Assert.equal(ltm.usedThemes.length, 9);
Assert.equal(ltm.currentTheme.id, "x7");
Assert.equal(ltm.usedThemes[1].id, "x6");
Assert.equal(ltm.usedThemes[7].id, "x0");
ltm.currentTheme = dummy("x8");
Assert.equal(ltm.usedThemes.length, 8);
Assert.equal(ltm.usedThemes.length, 9);
Assert.equal(ltm.currentTheme.id, "x8");
Assert.equal(ltm.usedThemes[1].id, "x7");
Assert.equal(ltm.usedThemes[7].id, "x1");
Assert.equal(ltm.getUsedTheme("x0"), null);
ltm.forgetUsedTheme("nonexistent");
Assert.equal(ltm.usedThemes.length, 8);
Assert.notEqual(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 9);
Assert.notEqual(ltm.currentTheme.id, DEFAULT_THEME_ID);
ltm.forgetUsedTheme("x8");
Assert.equal(ltm.usedThemes.length, 7);
Assert.equal(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 8);
Assert.equal(ltm.currentTheme.id, DEFAULT_THEME_ID);
Assert.equal(ltm.usedThemes[0].id, "x7");
Assert.equal(ltm.usedThemes[6].id, "x1");
@ -100,40 +102,40 @@ async function run_test() {
ltm.forgetUsedTheme("x5");
ltm.forgetUsedTheme("x4");
ltm.forgetUsedTheme("x3");
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 3);
Assert.equal(ltm.currentTheme.id, DEFAULT_THEME_ID);
Assert.equal(ltm.usedThemes[0].id, "x2");
Assert.equal(ltm.usedThemes[1].id, "x1");
ltm.currentTheme = dummy("x1");
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.usedThemes.length, 3);
Assert.equal(ltm.currentTheme.id, "x1");
Assert.equal(ltm.usedThemes[0].id, "x1");
Assert.equal(ltm.usedThemes[1].id, "x2");
ltm.currentTheme = dummy("x2");
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.usedThemes.length, 3);
Assert.equal(ltm.currentTheme.id, "x2");
Assert.equal(ltm.usedThemes[0].id, "x2");
Assert.equal(ltm.usedThemes[1].id, "x1");
ltm.currentTheme = ltm.getUsedTheme("x1");
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.usedThemes.length, 3);
Assert.equal(ltm.currentTheme.id, "x1");
Assert.equal(ltm.usedThemes[0].id, "x1");
Assert.equal(ltm.usedThemes[1].id, "x2");
ltm.forgetUsedTheme("x1");
ltm.forgetUsedTheme("x2");
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.currentTheme.id, DEFAULT_THEME_ID);
// Use chinese name to test utf-8, for bug #541943
var chineseTheme = dummy("chinese0");
chineseTheme.name = "笢恅0";
chineseTheme.description = "笢恅1";
ltm.currentTheme = chineseTheme;
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.currentTheme.name, "笢恅0");
Assert.equal(ltm.currentTheme.description, "笢恅1");
Assert.equal(ltm.usedThemes[0].name, "笢恅0");
@ -146,8 +148,8 @@ async function run_test() {
chineseTheme1.name = "眵昜湮桵蔗坌~郔乾";
chineseTheme1.description = "眵昜湮桵蔗坌~郔乾";
ltm.currentTheme = chineseTheme1;
Assert.notEqual(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 2);
Assert.notEqual(ltm.currentTheme.id, DEFAULT_THEME_ID);
Assert.equal(ltm.usedThemes.length, 3);
Assert.equal(ltm.currentTheme.name, "眵昜湮桵蔗坌~郔乾");
Assert.equal(ltm.currentTheme.description, "眵昜湮桵蔗坌~郔乾");
Assert.equal(ltm.usedThemes[1].name, "笢恅0");
@ -156,12 +158,12 @@ async function run_test() {
Assert.equal(ltm.usedThemes[0].description, "眵昜湮桵蔗坌~郔乾");
ltm.forgetUsedTheme("chinese0");
Assert.equal(ltm.usedThemes.length, 1);
Assert.notEqual(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 2);
Assert.notEqual(ltm.currentTheme.id, DEFAULT_THEME_ID);
ltm.forgetUsedTheme("chinese1");
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.currentTheme.id, DEFAULT_THEME_ID);
Assert.equal(ltm.parseTheme("invalid json"), null);
Assert.equal(ltm.parseTheme('"json string"'), null);
@ -300,8 +302,8 @@ async function run_test() {
Assert.equal(typeof after[prop], "undefined");
});
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.currentTheme.id, DEFAULT_THEME_ID);
data = dummy();
delete data.name;
@ -316,52 +318,52 @@ async function run_test() {
data = dummy();
data.headerURL = "foo";
ltm.currentTheme = data;
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.currentTheme.headerURL, undefined);
ltm.forgetUsedTheme(ltm.currentTheme.id);
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.usedThemes.length, 1);
// Sanitize themes with a non-http(s) headerURL
data = dummy();
data.headerURL = "ftp://lwtest.invalid/test.png";
ltm.currentTheme = data;
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.currentTheme.headerURL, undefined);
ltm.forgetUsedTheme(ltm.currentTheme.id);
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.usedThemes.length, 1);
// Sanitize themes with a non-http(s) headerURL
data = dummy();
data.headerURL = "file:///test.png";
ltm.currentTheme = data;
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.currentTheme.headerURL, undefined);
ltm.forgetUsedTheme(ltm.currentTheme.id);
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.usedThemes.length, 1);
data = dummy();
data.updateURL = "file:///test.json";
ltm.setLocalTheme(data);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.currentTheme.updateURL, undefined);
ltm.forgetUsedTheme(ltm.currentTheme.id);
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.usedThemes.length, 1);
data = dummy();
data.headerURL = "file:///test.png";
ltm.setLocalTheme(data);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.currentTheme.headerURL, "file:///test.png");
ltm.forgetUsedTheme(ltm.currentTheme.id);
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.usedThemes.length, 1);
data = dummy();
data.headerURL = "ftp://lwtest.invalid/test.png";
ltm.setLocalTheme(data);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.currentTheme.updateURL, undefined);
ltm.forgetUsedTheme(ltm.currentTheme.id);
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.usedThemes.length, 1);
data = dummy();
delete data.id;
@ -372,60 +374,60 @@ async function run_test() {
// Expected exception
}
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.currentTheme.id, DEFAULT_THEME_ID);
// Force the theme into the prefs anyway
let themes = [data];
Services.prefs.setCharPref("lightweightThemes.usedThemes", JSON.stringify(themes));
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes.length, 2);
// This should silently drop the bad theme.
ltm.currentTheme = dummy();
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes.length, 2);
ltm.forgetUsedTheme(ltm.currentTheme.id);
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.currentTheme.id, DEFAULT_THEME_ID);
// Add one broken and some working.
themes = [data, dummy("x1"), dummy("x2")];
Services.prefs.setCharPref("lightweightThemes.usedThemes", JSON.stringify(themes));
Assert.equal(ltm.usedThemes.length, 3);
Assert.equal(ltm.usedThemes.length, 4);
// Switching to an existing theme should drop the bad theme.
ltm.currentTheme = ltm.getUsedTheme("x1");
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.usedThemes.length, 3);
ltm.forgetUsedTheme("x1");
ltm.forgetUsedTheme("x2");
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.currentTheme.id, DEFAULT_THEME_ID);
Services.prefs.setCharPref("lightweightThemes.usedThemes", JSON.stringify(themes));
Assert.equal(ltm.usedThemes.length, 3);
Assert.equal(ltm.usedThemes.length, 4);
// Forgetting an existing theme should drop the bad theme.
ltm.forgetUsedTheme("x1");
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes.length, 2);
ltm.forgetUsedTheme("x2");
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.currentTheme.id, DEFAULT_THEME_ID);
// Test whether a JSON set with setCharPref can be retrieved with usedThemes
ltm.currentTheme = dummy("x0");
ltm.currentTheme = dummy("x1");
Services.prefs.setCharPref("lightweightThemes.usedThemes", JSON.stringify(ltm.usedThemes));
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.usedThemes.length, 4);
Assert.equal(ltm.currentTheme.id, "x1");
Assert.equal(ltm.usedThemes[1].id, "x0");
Assert.equal(ltm.usedThemes[0].id, "x1");
ltm.forgetUsedTheme("x0");
Assert.equal(ltm.usedThemes.length, 1);
Assert.notEqual(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 2);
Assert.notEqual(ltm.currentTheme.id, DEFAULT_THEME_ID);
ltm.forgetUsedTheme("x1");
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal(ltm.currentTheme, null);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.currentTheme.id, DEFAULT_THEME_ID);
Services.prefs.clearUserPref("lightweightThemes.maxUsedThemes");
@ -460,16 +462,16 @@ async function run_test() {
ltm.currentTheme = dummy("x29");
ltm.currentTheme = dummy("x30");
Assert.equal(ltm.usedThemes.length, 30);
Assert.equal(ltm.usedThemes.length, 31);
ltm.currentTheme = dummy("x31");
Assert.equal(ltm.usedThemes.length, 30);
Assert.equal(ltm.usedThemes.length, 31);
Assert.equal(ltm.getUsedTheme("x1"), null);
Services.prefs.setIntPref("lightweightThemes.maxUsedThemes", 15);
Assert.equal(ltm.usedThemes.length, 15);
Assert.equal(ltm.usedThemes.length, 16);
Services.prefs.setIntPref("lightweightThemes.maxUsedThemes", 32);
@ -492,15 +494,15 @@ async function run_test() {
ltm.currentTheme = dummy("x32");
Assert.equal(ltm.usedThemes.length, 32);
Assert.equal(ltm.usedThemes.length, 33);
ltm.currentTheme = dummy("x33");
Assert.equal(ltm.usedThemes.length, 32);
Assert.equal(ltm.usedThemes.length, 33);
Services.prefs.clearUserPref("lightweightThemes.maxUsedThemes");
Assert.equal(ltm.usedThemes.length, 30);
Assert.equal(ltm.usedThemes.length, 31);
let usedThemes = ltm.usedThemes;
for (let theme of usedThemes) {
@ -509,18 +511,18 @@ async function run_test() {
// Check builtInTheme functionality for Bug 1094821
Assert.equal(ltm._builtInThemes.toString(), "[object Map]");
Assert.equal([...ltm._builtInThemes.entries()].length, 0);
Assert.equal(ltm.usedThemes.length, 0);
Assert.equal([...ltm._builtInThemes.entries()].length, 1);
Assert.equal(ltm.usedThemes.length, 1);
ltm.addBuiltInTheme(dummy("builtInTheme0"));
Assert.equal([...ltm._builtInThemes].length, 1);
Assert.equal(ltm.usedThemes.length, 1);
Assert.equal(ltm.usedThemes[0].id, "builtInTheme0");
ltm.addBuiltInTheme(dummy("builtInTheme1"));
Assert.equal([...ltm._builtInThemes].length, 2);
Assert.equal(ltm.usedThemes.length, 2);
Assert.equal(ltm.usedThemes[1].id, "builtInTheme1");
Assert.equal(ltm.usedThemes[1].id, "builtInTheme0");
ltm.addBuiltInTheme(dummy("builtInTheme1"));
Assert.equal([...ltm._builtInThemes].length, 3);
Assert.equal(ltm.usedThemes.length, 3);
Assert.equal(ltm.usedThemes[2].id, "builtInTheme1");
// Clear all and then re-add
ltm.clearBuiltInThemes();

View File

@ -5,19 +5,6 @@ add_task(async function test_XPIStates_invalid_paths() {
let startupDatasets = [
{
"app-global": {
"addons": {
"{972ce4c6-7e08-4474-a285-3208198ce6fd}": {
"enabled": true,
"lastModifiedTime": 1,
"path": "{972ce4c6-7e08-4474-a285-3208198ce6fd}",
"type": "theme",
"version": "55.0a1",
}
},
"checkStartupModifications": true,
"path": "c:\\Program Files\\Mozilla Firefox\\extensions",
},
"app-profile": {
"addons": {
"xpcshell-something-or-other@mozilla.org": {
@ -35,19 +22,6 @@ add_task(async function test_XPIStates_invalid_paths() {
},
},
{
"app-global": {
"addons": {
"{972ce4c6-7e08-4474-a285-3208198ce6fd}": {
"enabled": true,
"lastModifiedTime": 1,
"path": "{972ce4c6-7e08-4474-a285-3208198ce6fd}",
"type": "theme",
"version": "55.0a1",
}
},
"checkStartupModifications": true,
"path": "c:\\Program Files\\Mozilla Firefox\\extensions",
},
"app-profile": {
"addons": {
"xpcshell-something-or-other@mozilla.org": {

View File

@ -31,7 +31,7 @@ function end_test() {
// called
async function run_test_1() {
let aAddons = await AddonManager.getAddonsByTypes(["extension", "theme", "locale"]);
Assert.equal(aAddons.length, 0);
Assert.equal(aAddons.length, 1);
Services.obs.addObserver(function observer() {
Services.obs.removeObserver(observer, "addons-background-update-complete");

View File

@ -183,16 +183,16 @@ const ADDONS = {
},
"theme1@tests.mozilla.org": {
"install.rdf": {
id: "theme1@tests.mozilla.org",
version: "1.0",
manifest: {
manifest_version: 2,
name: "Theme 1",
internalName: "classic/1.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
version: "1.0",
theme: { images: { headerURL: "example.png" } },
applications: {
gecko: {
id: "theme1@tests.mozilla.org",
},
},
},
desiredValues: {
isActive: false,

View File

@ -602,29 +602,6 @@ const ADDONS = [
expected: null,
},
// Theme manifests should ignore aboutURL and optionsURL.
{
"install.rdf": {
id: "bug371495@tests.mozilla.org",
version: "1.0",
type: "4",
internalName: "test/1.0",
optionsURL: "chrome://foo/content/bar.xul",
aboutURL: "chrome://foo/content/bar.xul",
name: "Test theme",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1",
}],
},
expected: {
aboutURL: null,
optionsURL: null,
}
},
// Tests compatibility based on target platforms.
// No targetPlatforms so should be compatible

View File

@ -47,25 +47,6 @@ const ADDONS = {
compatible: [false, true, false, true],
},
// Theme - always uses strict compatibility, so is always incompatible
"addon3@tests.mozilla.org": {
"install.rdf": {
id: "addon3@tests.mozilla.org",
version: "1.0",
name: "Test 3",
internalName: "test-theme-3",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "0.8",
maxVersion: "0.9"
}]
},
expected: {
strictCompatibility: true,
},
compatible: [false, false, false, false],
},
// Opt-in to strict compatibility - always incompatible
"addon4@tests.mozilla.org": {
"install.rdf": {

View File

@ -8,11 +8,12 @@
* Coverage may overlap with other tests in this folder.
*/
const {LightweightThemeManager} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
ChromeUtils.defineModuleGetter(this, "LightweightThemeManager",
"resource://gre/modules/LightweightThemeManager.jsm");
const THEME_IDS = [
"theme3@tests.mozilla.org",
"theme2@personas.mozilla.org",
"default@tests.mozilla.org"
"default-theme@mozilla.org",
];
const DEFAULT_THEME = THEME_IDS[2];
@ -37,19 +38,6 @@ add_task(async function setup_to_default_browserish_state() {
}
}
}, profileDir);
// We need a default theme for some of these things to work but we have hidden
// the one in the application directory.
writeInstallRDFForExtension({
id: DEFAULT_THEME,
version: "1.0",
name: "Default",
internalName: "classic/1.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "2"
}]
}, profileDir);
startupManager();

View File

@ -25,7 +25,6 @@ support-files =
signed.xpi
slowinstall.sjs
startsoftwareupdate.html
theme.xpi
triggerredirect.html
unsigned.xpi

View File

@ -8,9 +8,3 @@ toolkit.jar:
skin/classic/mozapps/extensions/heart.png (extensions/heart.png)
skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png)
skin/classic/mozapps/update/updates.css (update/updates.css)
#if MOZ_BUILD_APP == browser
[browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
#elif MOZ_SEPARATE_MANIFEST_FOR_THEME_OVERRIDES
[extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
#endif

View File

@ -82,9 +82,3 @@ toolkit.jar:
skin/classic/global/tree/columnpicker.gif (tree/columnpicker.gif)
skin/classic/global/tree/folder.png (tree/folder.png)
skin/classic/global/tree/folder@2x.png (tree/folder@2x.png)
#if MOZ_BUILD_APP == browser
[browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
#elif MOZ_SEPARATE_MANIFEST_FOR_THEME_OVERRIDES
[extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
#endif

View File

@ -23,9 +23,3 @@ toolkit.jar:
* skin/classic/mozapps/update/updates.css (update/updates.css)
skin/classic/mozapps/xpinstall/xpinstallConfirm.css (extensions/xpinstallConfirm.css)
skin/classic/mozapps/handling/handling.css (handling/handling.css)
#if MOZ_BUILD_APP == browser
[browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
#elif MOZ_SEPARATE_MANIFEST_FOR_THEME_OVERRIDES
[extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
#endif

View File

@ -51,9 +51,4 @@
skin/classic/mozapps/update/downloadButtons.png (../../windows/mozapps/update/downloadButtons.png)
* skin/classic/mozapps/xpinstall/xpinstallConfirm.css (../../windows/mozapps/extensions/xpinstallConfirm.css)
#if MOZ_BUILD_APP == browser
[browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
#elif MOZ_SEPARATE_MANIFEST_FOR_THEME_OVERRIDES
[extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
#endif
% override chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png chrome://mozapps/skin/extensions/extensionGeneric.svg

View File

@ -61,12 +61,6 @@ toolkit.jar:
skin/classic/global/tree/twisty.svg (tree/twisty.svg)
skin/classic/global/tree/twisty-preWin10.svg (tree/twisty-preWin10.svg)
#if MOZ_BUILD_APP == browser
[browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
#elif MOZ_SEPARATE_MANIFEST_FOR_THEME_OVERRIDES
[extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
#endif
% override chrome://global/skin/tree/twisty.svg#clsd chrome://global/skin/tree/twisty-preWin10.svg#clsd osversion<=6.3
% override chrome://global/skin/tree/twisty.svg#clsd-rtl chrome://global/skin/tree/twisty-preWin10.svg#clsd-rtl osversion<=6.3
% override chrome://global/skin/tree/twisty.svg#clsd-hover chrome://global/skin/tree/twisty-preWin10.svg#clsd-hover osversion<=6.3

View File

@ -8,9 +8,3 @@ toolkit.jar:
skin/classic/mozapps/extensions/heart.png (extensions/heart.png)
skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png)
skin/classic/mozapps/update/updates.css (update/updates.css)
#if MOZ_BUILD_APP == browser
[browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
#elif MOZ_SEPARATE_MANIFEST_FOR_THEME_OVERRIDES
[extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
#endif