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"): with Files("Makefile.in"):
BUG_COMPONENT = ("Firefox Build System", "General") 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"): with Files("profile/channel-prefs.js"):
BUG_COMPONENT = ("Firefox", "Installer") BUG_COMPONENT = ("Firefox", "Installer")
with Files("profile/firefox.js"): with Files("profile/firefox.js"):
BUG_COMPONENT = ("Firefox", "General") BUG_COMPONENT = ("Firefox", "General")
DIRS += ['profile/extensions']
GeckoProgram(CONFIG['MOZ_APP_NAME']) GeckoProgram(CONFIG['MOZ_APP_NAME'])
SOURCES += [ 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 #endif
// Extensions that should not be flagged as legacy in about:addons // 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 // Require signed add-ons by default
pref("extensions.langpacks.signatures.required", true); 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 pref("extensions.update.interval", 86400); // Check for updates to Extensions and
// Themes every day // 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.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"); 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", pref("lightweightThemes.selectedThemeID", "firefox-compact-dark@mozilla.org",
sticky); sticky);
#else #else
pref("lightweightThemes.selectedThemeID", "", sticky); pref("lightweightThemes.selectedThemeID", "default-theme@mozilla.org", sticky);
#endif #endif
// Whether the character encoding menu is under the main Firefox button. This // 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*"): with Files("contentSearch*"):
BUG_COMPONENT = ("Firefox", "Search") BUG_COMPONENT = ("Firefox", "Search")
with Files("*.svg"):
BUG_COMPONENT = ("Firefox", "Theme")
with Files("hiddenWindow.xul"): with Files("hiddenWindow.xul"):
BUG_COMPONENT = ("Firefox", "Device Permissions") BUG_COMPONENT = ("Firefox", "Device Permissions")

View File

@ -78,7 +78,6 @@ support-files =
!/image/test/mochitest/blue.png !/image/test/mochitest/blue.png
!/toolkit/content/tests/browser/common/mockTransfer.js !/toolkit/content/tests/browser/common/mockTransfer.js
!/toolkit/modules/tests/browser/metadata_*.html !/toolkit/modules/tests/browser/metadata_*.html
!/toolkit/mozapps/extensions/test/xpinstall/theme.xpi
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_addKeywordSearch.js] [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. # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_bug585830.js] [browser_bug585830.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. # 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] [browser_bug594131.js]
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
[browser_bug596687.js] [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/browser-webrender.js (content/browser-webrender.js)
content/browser/tab-content.js (content/tab-content.js) content/browser/tab-content.js (content/tab-content.js)
content/browser/content.js (content/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.header.jpg (content/defaultthemes/1.header.jpg)
content/browser/defaultthemes/1.icon.jpg (content/defaultthemes/1.icon.jpg) content/browser/defaultthemes/1.icon.jpg (content/defaultthemes/1.icon.jpg)
content/browser/defaultthemes/1.preview.jpg (content/defaultthemes/1.preview.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.header.png (content/defaultthemes/5.header.png)
content/browser/defaultthemes/5.icon.jpg (content/defaultthemes/5.icon.jpg) 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/5.preview.jpg (content/defaultthemes/5.preview.jpg)
content/browser/defaultthemes/dark.icon.svg (content/defaultthemes/dark.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/defaultthemes/light.icon.svg (content/defaultthemes/light.icon.svg)
* content/browser/pageinfo/pageInfo.xul (content/pageinfo/pageInfo.xul) * content/browser/pageinfo/pageInfo.xul (content/pageinfo/pageInfo.xul)
content/browser/pageinfo/pageInfo.js (content/pageinfo/pageInfo.js) content/browser/pageinfo/pageInfo.js (content/pageinfo/pageInfo.js)
content/browser/pageinfo/pageInfo.css (content/pageinfo/pageInfo.css) content/browser/pageinfo/pageInfo.css (content/pageinfo/pageInfo.css)

View File

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

View File

@ -1339,8 +1339,8 @@ CustomizeMode.prototype = {
this._onUIChange(); this._onUIChange();
}, },
async onLWThemesMenuShowing(aEvent) { onLWThemesMenuShowing(aEvent) {
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 LIGHT_THEME_ID = "firefox-compact-light@mozilla.org";
const DARK_THEME_ID = "firefox-compact-dark@mozilla.org"; const DARK_THEME_ID = "firefox-compact-dark@mozilla.org";
const MAX_THEME_COUNT = 6; const MAX_THEME_COUNT = 6;
@ -1363,21 +1363,13 @@ CustomizeMode.prototype = {
panel.hidePopup(); panel.hidePopup();
}; };
let aDefaultTheme = await AddonManager.getAddonByID(DEFAULT_THEME_ID);
let doc = this.window.document; let doc = this.window.document;
function buildToolbarButton(aTheme) { function buildToolbarButton(aTheme) {
let tbb = doc.createElement("toolbarbutton"); let tbb = doc.createElement("toolbarbutton");
tbb.theme = aTheme; tbb.theme = aTheme;
tbb.setAttribute("label", aTheme.name); tbb.setAttribute("label", aTheme.name);
if (aDefaultTheme == aTheme) { tbb.setAttribute("image", aTheme.iconURL);
// 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);
}
if (aTheme.description) if (aTheme.description)
tbb.setAttribute("tooltiptext", aTheme.description); tbb.setAttribute("tooltiptext", aTheme.description);
tbb.setAttribute("tabindex", "0"); tbb.setAttribute("tabindex", "0");
@ -1396,14 +1388,14 @@ CustomizeMode.prototype = {
return tbb; return tbb;
} }
let themes = [aDefaultTheme]; let themes = [];
let lwts = LightweightThemeManager.usedThemes; let lwts = LightweightThemeManager.usedThemes;
let currentLwt = LightweightThemeManager.currentTheme; let currentLwt = LightweightThemeManager.currentTheme;
let activeThemeID = currentLwt ? currentLwt.id : DEFAULT_THEME_ID; let activeThemeID = currentLwt ? currentLwt.id : DEFAULT_THEME_ID;
// Move the current theme (if any) and the light/dark themes to the start: // 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)) { if (currentLwt && !importantThemes.includes(currentLwt.id)) {
importantThemes.push(currentLwt.id); importantThemes.push(currentLwt.id);
} }

View File

@ -4,7 +4,7 @@
"use strict"; "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 LIGHT_THEME_ID = "firefox-compact-light@mozilla.org";
const DARK_THEME_ID = "firefox-compact-dark@mozilla.org"; const DARK_THEME_ID = "firefox-compact-dark@mozilla.org";
const {LightweightThemeManager} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm", {}); const {LightweightThemeManager} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
@ -95,7 +95,8 @@ add_task(async function() {
let defaultTheme = header.nextSibling; let defaultTheme = header.nextSibling;
defaultTheme.doCommand(); 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" // ensure current theme isn't set to "Default"
popupShownPromise = popupShown(popup); popupShownPromise = popupShown(popup);
@ -111,7 +112,7 @@ add_task(async function() {
// check that "Restore Defaults" button resets theme // check that "Restore Defaults" button resets theme
await gCustomizeMode.reset(); 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(); await endCustomizing();
Services.prefs.setCharPref("lightweightThemes.usedThemes", "[]"); Services.prefs.setCharPref("lightweightThemes.usedThemes", "[]");

View File

@ -37,7 +37,7 @@ add_task(async function() {
ok(CustomizableUI.inDefaultState, "In default state after reset"); ok(CustomizableUI.inDefaultState, "In default state after reset");
is(undoResetButton.hidden, false, "The undo button is visible 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(); 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-rtl@2x.png
browser/chrome/pdfjs/content/web/images/findbarButton-previous.png browser/chrome/pdfjs/content/web/images/findbarButton-previous.png
browser/chrome/pdfjs/content/web/images/findbarButton-previous@2x.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.png
browser/features/firefox@getpocket.com/chrome/skin/linux/menuPanel@2x.png browser/features/firefox@getpocket.com/chrome/skin/linux/menuPanel@2x.png
browser/features/firefox@getpocket.com/chrome/skin/windows/menuPanel.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/browser.manifest
@RESPATH@/browser/chrome/pdfjs.manifest @RESPATH@/browser/chrome/pdfjs.manifest
@RESPATH@/browser/chrome/pdfjs/* @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@JAREXT@
@RESPATH@/chrome/toolkit.manifest @RESPATH@/chrome/toolkit.manifest
@RESPATH@/chrome/recording.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. # Used as the bookmark name when saving a keyword for a search field.
addKeywordTitleAutoFill=Search %S addKeywordTitleAutoFill=Search %S
extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.name=Default
extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.description=The default theme.
# safeModeRestart # safeModeRestart
safeModeRestartPromptTitle=Restart with Add-ons Disabled safeModeRestartPromptTitle=Restart with Add-ons Disabled
safeModeRestartPromptMessage=Are you sure you want to disable all add-ons and restart? 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) 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/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/audioFeedIcon16.png chrome://browser/skin/feeds/feedIcon16.png
% override chrome://browser/skin/feeds/videoFeedIcon.png chrome://browser/skin/feeds/feedIcon.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/tabbrowser/tabDragIndicator@2x.png (tabbrowser/tabDragIndicator@2x.png)
skin/classic/browser/e10s-64@2x.png (../shared/e10s-64@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/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/audioFeedIcon16.png chrome://browser/skin/feeds/feedIcon16.png
% override chrome://browser/skin/feeds/videoFeedIcon.png chrome://browser/skin/feeds/feedIcon.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 { #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 { #customization-uidensity-button > .box-inherit > .box-inherit > .button-icon {
@ -334,10 +334,6 @@ toolbarpaletteitem[place=toolbar] > toolbarspring {
color: inherit; color: inherit;
} }
.customization-lwtheme-menu-theme[defaulttheme] {
list-style-image: url(chrome://browser/content/default-theme-icon.svg);
}
#customization-uidensity-menuitem-normal { #customization-uidensity-menuitem-normal {
list-style-image: url("chrome://browser/skin/customizableui/density-normal.svg"); 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/window-controls/restore-themes.svg (window-controls/restore-themes.svg)
skin/classic/browser/e10s-64@2x.png (../shared/e10s-64@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/page-livemarks.png chrome://browser/skin/feeds/feedIcon16.png % 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/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/audioFeedIcon16.png chrome://browser/skin/feeds/feedIcon16.png

View File

@ -1,6 +1,7 @@
[DEFAULT] [DEFAULT]
head = head_psm.js head = head_psm.js
tags = psm tags = psm
firefox-appdir = browser
support-files = support-files =
bad_certs/** bad_certs/**
ocsp_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 // Ensure we don't go to the network to fetch personas and end up leaking
// stuff. // stuff.
Services.io.offline = true; Services.io.offline = true;
Assert.ok(!prefs.get("lightweightThemes.selectedThemeID")); Assert.equal(LightweightThemeManager.currentTheme.id, "default-theme@mozilla.org");
Assert.equal(LightweightThemeManager.currentTheme, null);
let persona1 = makePersona(); let persona1 = makePersona();
let persona2 = makePersona(); let persona2 = makePersona();
@ -130,8 +129,7 @@ add_task(async function run_test() {
"lightweightThemes.usedThemes": usedThemes "lightweightThemes.usedThemes": usedThemes
}; };
await store.update(record); await store.update(record);
Assert.ok(!prefs.get("lightweightThemes.selectedThemeID")); Assert.equal(LightweightThemeManager.currentTheme.id, "default-theme@mozilla.org");
Assert.equal(LightweightThemeManager.currentTheme, null);
_("Only the current app's preferences are applied."); _("Only the current app's preferences are applied.");
record = new PrefRec("prefs", "some-fake-app"); record = new PrefRec("prefs", "some-fake-app");

View File

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

View File

@ -34,7 +34,7 @@ add_task(async function test_management_getAll() {
}); });
let addons = await browser.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); browser.test.sendMessage("addons", addons);
} }

View File

@ -11,7 +11,6 @@ support-files =
engine.xml engine.xml
system.xpi system.xpi
restartless.xpi restartless.xpi
theme.xpi
testUnicodePDB32.dll testUnicodePDB32.dll
testNoPDB32.dll testNoPDB32.dll
testUnicodePDB64.dll testUnicodePDB64.dll
@ -22,7 +21,6 @@ generated-files =
experiment.xpi experiment.xpi
system.xpi system.xpi
restartless.xpi restartless.xpi
theme.xpi
[test_MigratePendingPings.js] [test_MigratePendingPings.js]
[test_TelemetryHistograms.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. #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.message = An extension, %S, changed what you see when you open your homepage and new windows.
homepageControlled.learnMore = Learn more 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 KEY_APPDIR = "XCurProcD";
const FILE_BLOCKLIST = "blocklist.xml"; const FILE_BLOCKLIST = "blocklist.xml";
const DEFAULT_THEME_ID = "default-theme@mozilla.org";
const BRANCH_REGEXP = /^([^\.]+\.[0-9]+[a-z]*).*/gi; const BRANCH_REGEXP = /^([^\.]+\.[0-9]+[a-z]*).*/gi;
const PREF_EM_CHECK_COMPATIBILITY_BASE = "extensions.checkCompatibility"; const PREF_EM_CHECK_COMPATIBILITY_BASE = "extensions.checkCompatibility";
var PREF_EM_CHECK_COMPATIBILITY = MOZ_COMPATIBILITY_NIGHTLY ? var PREF_EM_CHECK_COMPATIBILITY = MOZ_COMPATIBILITY_NIGHTLY ?
@ -70,6 +72,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
AddonRepository: "resource://gre/modules/addons/AddonRepository.jsm", AddonRepository: "resource://gre/modules/addons/AddonRepository.jsm",
Extension: "resource://gre/modules/Extension.jsm", Extension: "resource://gre/modules/Extension.jsm",
FileUtils: "resource://gre/modules/FileUtils.jsm", FileUtils: "resource://gre/modules/FileUtils.jsm",
LightweightThemeManager: "resource://gre/modules/LightweightThemeManager.jsm",
PromptUtils: "resource://gre/modules/SharedPromptUtils.jsm", PromptUtils: "resource://gre/modules/SharedPromptUtils.jsm",
}); });
@ -838,6 +841,27 @@ var AddonManagerInternal = {
AddonManagerPrivate.recordException("AMI", "startup failed", e); 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"); logger.debug("Completed startup sequence");
this.callManagerListeners("onStartup"); this.callManagerListeners("onStartup");
}, },

View File

@ -12,12 +12,12 @@ ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm"); ChromeUtils.import("resource://gre/modules/Services.jsm");
const ID_SUFFIX = "@personas.mozilla.org"; const ID_SUFFIX = "@personas.mozilla.org";
const PREF_LWTHEME_TO_SELECT = "extensions.lwThemeToSelect";
const ADDON_TYPE = "theme"; const ADDON_TYPE = "theme";
const ADDON_TYPE_WEBEXT = "webextension-theme"; const ADDON_TYPE_WEBEXT = "webextension-theme";
const URI_EXTENSION_STRINGS = "chrome://mozapps/locale/extensions/extensions.properties"; 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 DEFAULT_MAX_USED_THEMES_COUNT = 30;
const MAX_PREVIEW_SECONDS = 30; const MAX_PREVIEW_SECONDS = 30;
@ -120,7 +120,7 @@ var LightweightThemeManager = {
}, },
get currentTheme() { get currentTheme() {
let selectedThemeID = _prefs.getCharPref("selectedThemeID", ""); let selectedThemeID = _prefs.getStringPref("selectedThemeID", DEFAULT_THEME_ID);
let data = null; let data = null;
if (selectedThemeID) { if (selectedThemeID) {
@ -131,7 +131,7 @@ var LightweightThemeManager = {
get currentThemeForDisplay() { get currentThemeForDisplay() {
var data = this.currentTheme; var data = this.currentTheme;
if (!data && _fallbackThemeData) if ((!data || data.id == DEFAULT_THEME_ID) && _fallbackThemeData)
data = _fallbackThemeData; data = _fallbackThemeData;
if (data && PERSIST_ENABLED) { if (data && PERSIST_ENABLED) {
@ -189,7 +189,7 @@ var LightweightThemeManager = {
this._builtInThemes.set(theme.id, theme); this._builtInThemes.set(theme.id, theme);
if (_prefs.getCharPref("selectedThemeID") == theme.id) { if (_prefs.getStringPref("selectedThemeID", DEFAULT_THEME_ID) == theme.id) {
this.currentTheme = theme; this.currentTheme = theme;
} }
}, },
@ -323,15 +323,6 @@ var LightweightThemeManager = {
* necessary. * necessary.
*/ */
startup() { 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); _prefs.addObserver("", _prefObserver);
}, },
@ -350,47 +341,29 @@ var LightweightThemeManager = {
* The ID of the newly enabled add-on * The ID of the newly enabled add-on
* @param aType * @param aType
* The type of the newly enabled add-on * 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) if (aType != ADDON_TYPE && aType != ADDON_TYPE_WEBEXT)
return; return;
let id = _getInternalID(aId); let id = _getInternalID(aId);
let current = this.currentTheme; let current = this.currentTheme;
try { if (current && id == current.id) {
let next = Services.prefs.getCharPref(PREF_LWTHEME_TO_SELECT); AddonManagerPrivate.callAddonListeners("onOperationCancelled",
if (id == next && aPendingRestart) new AddonWrapper(current));
return; 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) { if (current) {
if (current.id == id) if (current.id == id || (!aId && current.id == DEFAULT_THEME_ID))
return; return;
_themeIDBeingDisabled = current.id; _themeIDBeingDisabled = current.id;
let wrapper = new AddonWrapper(current); let wrapper = new AddonWrapper(current);
if (aPendingRestart) {
Services.prefs.setCharPref(PREF_LWTHEME_TO_SELECT, ""); AddonManagerPrivate.callAddonListeners("onDisabling", wrapper, false);
AddonManagerPrivate.callAddonListeners("onDisabling", wrapper, true); this.themeChanged(null);
} else { AddonManagerPrivate.callAddonListeners("onDisabled", wrapper);
AddonManagerPrivate.callAddonListeners("onDisabling", wrapper, false);
this.themeChanged(null);
AddonManagerPrivate.callAddonListeners("onDisabled", wrapper);
}
_themeIDBeingDisabled = null; _themeIDBeingDisabled = null;
} }
@ -401,17 +374,11 @@ var LightweightThemeManager = {
return; return;
_themeIDBeingEnabled = id; _themeIDBeingEnabled = id;
let wrapper = new AddonWrapper(theme); 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 AddonManagerPrivate.callAddonListeners("onEnabling", wrapper, false);
Services.prefs.savePrefFile(null); this.themeChanged(theme);
} else { AddonManagerPrivate.callAddonListeners("onEnabled", wrapper);
AddonManagerPrivate.callAddonListeners("onEnabling", wrapper, false);
this.themeChanged(theme);
AddonManagerPrivate.callAddonListeners("onEnabled", wrapper);
}
_themeIDBeingEnabled = null; _themeIDBeingEnabled = null;
} }
}, },
@ -464,7 +431,7 @@ function AddonWrapper(aTheme) {
AddonWrapper.prototype = { AddonWrapper.prototype = {
get id() { get id() {
return themeFor(this).id + ID_SUFFIX; return _getExternalID(themeFor(this).id);
}, },
get type() { get type() {
@ -522,7 +489,7 @@ AddonWrapper.prototype = {
permissions = AddonManager.PERM_CAN_UNINSTALL; permissions = AddonManager.PERM_CAN_UNINSTALL;
if (this.userDisabled) if (this.userDisabled)
permissions |= AddonManager.PERM_CAN_ENABLE; permissions |= AddonManager.PERM_CAN_ENABLE;
else else if (themeFor(this).id != DEFAULT_THEME_ID)
permissions |= AddonManager.PERM_CAN_DISABLE; permissions |= AddonManager.PERM_CAN_DISABLE;
return permissions; return permissions;
}, },
@ -534,13 +501,8 @@ AddonWrapper.prototype = {
if (_themeIDBeingDisabled == id) if (_themeIDBeingDisabled == id)
return true; return true;
try { let current = LightweightThemeManager.currentTheme;
let toSelect = Services.prefs.getCharPref(PREF_LWTHEME_TO_SELECT); return !current || current.id != id;
return id != toSelect;
} catch (e) {
let current = LightweightThemeManager.currentTheme;
return !current || current.id != id;
}
}, },
set userDisabled(val) { set userDisabled(val) {
@ -638,12 +600,20 @@ AddonWrapper.prototype = {
function _getInternalID(id) { function _getInternalID(id) {
if (!id) if (!id)
return null; return null;
if (id == DEFAULT_THEME_ID)
return id;
let len = id.length - ID_SUFFIX.length; let len = id.length - ID_SUFFIX.length;
if (len > 0 && id.substring(len) == ID_SUFFIX) if (len > 0 && id.substring(len) == ID_SUFFIX)
return id.substring(0, len); return id.substring(0, len);
return null; return null;
} }
function _getExternalID(id) {
if (id == DEFAULT_THEME_ID)
return id;
return id + ID_SUFFIX;
}
function _setCurrentTheme(aData, aLocal) { function _setCurrentTheme(aData, aLocal) {
aData = _sanitizeTheme(aData, null, aLocal); aData = _sanitizeTheme(aData, null, aLocal);
@ -691,7 +661,7 @@ function _setCurrentTheme(aData, aLocal) {
return null; return null;
if (notify) { if (notify) {
AddonManagerPrivate.notifyAddonChanged(aData ? aData.id + ID_SUFFIX : null, AddonManagerPrivate.notifyAddonChanged(aData ? _getExternalID(aData.id) : null,
ADDON_TYPE, false); 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 // themes so explicitly check for new style themes (for which
// isWebExtension is true) or lightweight themes (which have // isWebExtension is true) or lightweight themes (which have
// ids that end with @personas.mozilla.org) // 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)) { 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); var zipW = ZipWriter(zipFile, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | flags);
for (let [path, data] of Object.entries(files)) { for (let [path, data] of Object.entries(files)) {
if (typeof data === "object" && ChromeUtils.getClassName(data) === "Object")
data = JSON.stringify(data);
if (!(data instanceof ArrayBuffer)) if (!(data instanceof ArrayBuffer))
data = new TextEncoder("utf-8").encode(data).buffer; 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 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 */ /* 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 = [ const XPI_INTERNAL_SYMBOLS = [
"AddonInternal", "AddonInternal",
@ -158,14 +156,13 @@ const PROP_TARGETAPP = ["id", "minVersion", "maxVersion"];
// Map new string type identifiers to old style nsIUpdateItem types. // Map new string type identifiers to old style nsIUpdateItem types.
// Retired values: // Retired values:
// 8 = locale
// 32 = multipackage xpi file // 32 = multipackage xpi file
// 8 = locale // 8 = locale
// 256 = apiextension // 256 = apiextension
// 128 = experiment // 128 = experiment
// theme = 4
const TYPES = { const TYPES = {
extension: 2, extension: 2,
theme: 4,
dictionary: 64, dictionary: 64,
}; };
@ -801,16 +798,7 @@ async function loadManifestFromRDF(aUri, aData) {
addon.targetPlatforms.push(platform); addon.targetPlatforms.push(platform);
} }
// A theme's userDisabled value is true if the theme is not the selected skin addon.userDisabled = false;
// 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.softDisabled = addon.blocklistState == nsIBlocklistService.STATE_SOFTBLOCKED; addon.softDisabled = addon.blocklistState == nsIBlocklistService.STATE_SOFTBLOCKED;
addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT; 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 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. // Specify a list of valid built-in add-ons to load.
const BUILT_IN_ADDONS_URI = "chrome://browser/content/built_in_addons.json"; 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_WEB_MANIFEST = "manifest.json";
const FILE_XPI_ADDONS_LIST = "extensions.ini"; const FILE_XPI_ADDONS_LIST = "extensions.ini";
const ADDON_ID_DEFAULT_THEME = "{972ce4c6-7e08-4474-a285-3208198ce6fd}";
const KEY_PROFILEDIR = "ProfD"; const KEY_PROFILEDIR = "ProfD";
const KEY_ADDON_APP_DIR = "XREAddonAppDir"; const KEY_ADDON_APP_DIR = "XREAddonAppDir";
const KEY_APP_DISTRIBUTION = "XREAppDist"; 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_SYSTEM_USER = "app-system-user";
const KEY_APP_TEMPORARY = "app-temporary"; const KEY_APP_TEMPORARY = "app-temporary";
const DEFAULT_THEME_ID = "default-theme@mozilla.org";
const TEMPORARY_ADDON_SUFFIX = "@temporary-addon"; const TEMPORARY_ADDON_SUFFIX = "@temporary-addon";
const STARTUP_MTIME_SCOPES = [KEY_APP_GLOBAL, 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; 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"; const NOTIFICATION_TOOLBOX_CONNECTION_CHANGE = "toolbox-connection-change";
@ -211,7 +209,6 @@ const SIGNED_TYPES = new Set([
const LEGACY_TYPES = new Set([ const LEGACY_TYPES = new Set([
"extension", "extension",
"theme",
]); ]);
const ALL_EXTERNAL_TYPES = new Set([ const ALL_EXTERNAL_TYPES = new Set([
@ -289,7 +286,6 @@ function loadLazyObjects() {
SIGNED_TYPES, SIGNED_TYPES,
BOOTSTRAP_REASONS, BOOTSTRAP_REASONS,
DB_SCHEMA, DB_SCHEMA,
DEFAULT_SKIN,
AddonInternal, AddonInternal,
XPIProvider, XPIProvider,
XPIStates, XPIStates,
@ -791,9 +787,6 @@ function isDisabledLegacy(addon) {
* @return true if the add-on should not be appDisabled * @return true if the add-on should not be appDisabled
*/ */
function isUsableAddon(aAddon) { function isUsableAddon(aAddon) {
if (aAddon.type == "theme")
return aAddon.internalName == DEFAULT_SKIN;
if (mustSign(aAddon.type) && !aAddon.isCorrectlySigned) { if (mustSign(aAddon.type) && !aAddon.isCorrectlySigned) {
logger.warn(`Add-on ${aAddon.id} is not correctly signed.`); logger.warn(`Add-on ${aAddon.id} is not correctly signed.`);
if (Services.prefs.getBoolPref(PREF_XPI_SIGNATURES_DEV_ROOT, false)) { 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. // We don't use aDBAddon.active here because it's not updated until after restart.
let mustGetMod = (aDBAddon.visible && !aDBAddon.disabled && !this.enabled); let mustGetMod = (aDBAddon.visible && !aDBAddon.disabled && !this.enabled);
// We need to treat XUL themes specially here, since lightweight this.enabled = aDBAddon.visible && !aDBAddon.disabled;
// 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.version = aDBAddon.version; this.version = aDBAddon.version;
this.type = aDBAddon.type; this.type = aDBAddon.type;
@ -2060,9 +2046,6 @@ var XPIProvider = {
if (AppConstants.MOZ_CRASHREPORTER) { if (AppConstants.MOZ_CRASHREPORTER) {
// Annotate the crash report with relevant add-on information. // Annotate the crash report with relevant add-on information.
try {
Services.appinfo.annotateCrashReport("Theme", DEFAULT_SKIN);
} catch (e) { }
try { try {
Services.appinfo.annotateCrashReport("EMCheckCompatibility", Services.appinfo.annotateCrashReport("EMCheckCompatibility",
AddonManager.checkCompatibility); AddonManager.checkCompatibility);
@ -2883,30 +2866,6 @@ var XPIProvider = {
.filter(addon => addon.dependencies.includes(aAddon.id)); .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 * Checks for any changes that have occurred since the last time the
* application was launched. * 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 // If the application crashed before completing any pending operations then
// we should perform them now. // we should perform them now.
if (extensionListChanged || hasPendingChanges) { if (extensionListChanged || hasPendingChanges) {
this._updateActiveAddons(); this._updateActiveAddons();
// Serialize and deserialize so we get the expected JSON data.
let state = JSON.parse(JSON.stringify(XPIStates));
aomStartup.initializeExtensions(state);
return true; return true;
} }
aomStartup.initializeExtensions(XPIStates.initialStateData);
logger.debug("No changes found"); logger.debug("No changes found");
} catch (e) { } catch (e) {
logger.error("Error during startup file checks", e); logger.error("Error during startup file checks", e);
@ -3570,14 +3517,21 @@ var XPIProvider = {
if (!isTheme(aType)) if (!isTheme(aType))
return; return;
let addons = XPIDatabase.getAddonsByType("theme", "webextension-theme"); let addons = XPIDatabase.getAddonsByType("webextension-theme");
for (let theme of addons) { for (let theme of addons) {
if (isWebExtension(theme.type) && theme.visible && theme.id != aId) if (theme.visible && theme.id != aId)
this.updateAddonDisabledState(theme, true, undefined); this.updateAddonDisabledState(theme, true, undefined, true);
} }
let defaultTheme = XPIDatabase.getVisibleAddonForInternalName(DEFAULT_SKIN); if (!aId && (!LightweightThemeManager.currentTheme ||
this.updateAddonDisabledState(defaultTheme, aId && aId != defaultTheme.id); 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 * @param aSoftDisabled
* Value for the softDisabled property. If undefined the value will * Value for the softDisabled property. If undefined the value will
* not change. If true this will force userDisabled to be true * 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: * @return a tri-state indicating the action taken for the add-on:
* - undefined: The add-on did not change state * - undefined: The add-on did not change state
* - true: The add-on because disabled * - true: The add-on because disabled
* - false: The add-on became enabled * - false: The add-on became enabled
* @throws if addon is not a DBAddonInternal * @throws if addon is not a DBAddonInternal
*/ */
updateAddonDisabledState(aAddon, aUserDisabled, aSoftDisabled) { updateAddonDisabledState(aAddon, aUserDisabled, aSoftDisabled, aBecauseSelecting) {
if (!(aAddon.inDatabase)) if (!(aAddon.inDatabase))
throw new Error("Can only update addon states for installed addons."); throw new Error("Can only update addon states for installed addons.");
if (aUserDisabled !== undefined && aSoftDisabled !== undefined) { if (aUserDisabled !== undefined && aSoftDisabled !== undefined) {
@ -4016,12 +3973,16 @@ var XPIProvider = {
} }
// Notify any other providers that a new theme has been enabled // Notify any other providers that a new theme has been enabled
if (isTheme(aAddon.type) && !isDisabled) { if (isTheme(aAddon.type)) {
AddonManagerPrivate.notifyAddonChanged(aAddon.id, aAddon.type); if (!isDisabled) {
AddonManagerPrivate.notifyAddonChanged(aAddon.id, aAddon.type);
if (xpiState) { if (xpiState) {
xpiState.syncWithDB(aAddon); xpiState.syncWithDB(aAddon);
XPIStates.save(); XPIStates.save();
}
} else if (isDisabled && !aBecauseSelecting) {
AddonManagerPrivate.notifyAddonChanged(null, "theme");
} }
} }
@ -4768,8 +4729,7 @@ AddonWrapper.prototype = {
} }
} }
let canUseIconURLs = this.isActive || let canUseIconURLs = this.isActive;
(addon.type == "theme" && addon.internalName == DEFAULT_SKIN);
if (canUseIconURLs && addon.iconURL) { if (canUseIconURLs && addon.iconURL) {
icons[32] = addon.iconURL; icons[32] = addon.iconURL;
icons[48] = addon.iconURL; icons[48] = addon.iconURL;
@ -4931,22 +4891,12 @@ AddonWrapper.prototype = {
} }
if (addon.inDatabase) { if (addon.inDatabase) {
let theme = isTheme(addon.type); // hidden and system add-ons should not be user disabled,
if (theme && val) { // as there is no UI to re-enable them.
if (addon.internalName == DEFAULT_SKIN) if (this.hidden) {
throw new Error("Cannot disable the default theme"); throw new Error(`Cannot disable hidden add-on ${addon.id}`);
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);
} }
XPIProvider.updateAddonDisabledState(addon, val);
} else { } else {
addon.userDisabled = val; addon.userDisabled = val;
// When enabling remove the softDisabled flag // When enabling remove the softDisabled flag
@ -4965,8 +4915,6 @@ AddonWrapper.prototype = {
if (addon.inDatabase) { if (addon.inDatabase) {
// When softDisabling a theme just enable the active theme // When softDisabling a theme just enable the active theme
if (isTheme(addon.type) && val && !addon.userDisabled) { if (isTheme(addon.type) && val && !addon.userDisabled) {
if (addon.internalName == DEFAULT_SKIN)
throw new Error("Cannot disable the default theme");
if (isWebExtension(addon.type)) if (isWebExtension(addon.type))
XPIProvider.updateAddonDisabledState(addon, undefined, val); XPIProvider.updateAddonDisabledState(addon, undefined, val);
} else { } else {

View File

@ -8,7 +8,7 @@
/* globals ADDON_SIGNING, SIGNED_TYPES, BOOTSTRAP_REASONS, DB_SCHEMA, /* globals ADDON_SIGNING, SIGNED_TYPES, BOOTSTRAP_REASONS, DB_SCHEMA,
AddonInternal, XPIProvider, XPIStates, syncLoadManifestFromFile, AddonInternal, XPIProvider, XPIStates, syncLoadManifestFromFile,
isUsableAddon, recordAddonTelemetry, isUsableAddon, recordAddonTelemetry,
flushChromeCaches, descriptorToPath, DEFAULT_SKIN */ flushChromeCaches, descriptorToPath */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
@ -48,7 +48,7 @@ const KEY_APP_TEMPORARY = "app-temporary";
// Properties to save in JSON file // Properties to save in JSON file
const PROP_JSON_FIELDS = ["id", "syncGUID", "location", "version", "type", const PROP_JSON_FIELDS = ["id", "syncGUID", "location", "version", "type",
"internalName", "updateURL", "optionsURL", "updateURL", "optionsURL",
"optionsType", "optionsBrowserStyle", "aboutURL", "optionsType", "optionsBrowserStyle", "aboutURL",
"defaultLocale", "visible", "active", "userDisabled", "defaultLocale", "visible", "active", "userDisabled",
"appDisabled", "pendingUninstall", "installDate", "appDisabled", "pendingUninstall", "installDate",
@ -711,28 +711,6 @@ this.XPIDatabase = {
return _filterDB(this.addonDB, aAddon => aTypes.includes(aAddon.type)); 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. * 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 // appDisabled depends on whether the add-on is a foreignInstall so update
aNewAddon.appDisabled = !isUsableAddon(aNewAddon); 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 (isDetectedInstall && aNewAddon.foreignInstall) {
// If the add-on is a foreign install and is in a scope where add-ons // 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 // 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 // We might be recovering from a corrupt database, if so use the
// list of known active add-ons to update the new add-on // list of known active add-ons to update the new add-on
if (!wasStaged && XPIDatabase.activeBundles) { if (!wasStaged && XPIDatabase.activeBundles) {
// For themes we know which is active by the current skin setting isActive = XPIDatabase.activeBundles.includes(currentAddon.path);
if (currentAddon.type == "theme")
isActive = currentAddon.internalName == DEFAULT_SKIN;
else
isActive = XPIDatabase.activeBundles.includes(currentAddon.path);
if (currentAddon.type == "webextension-theme") if (currentAddon.type == "webextension-theme")
currentAddon.userDisabled = !isActive; currentAddon.userDisabled = !isActive;

View File

@ -22,6 +22,7 @@ toolkit.jar:
content/mozapps/extensions/pluginPrefs.xul (content/pluginPrefs.xul) content/mozapps/extensions/pluginPrefs.xul (content/pluginPrefs.xul)
content/mozapps/extensions/pluginPrefs.js (content/pluginPrefs.js) content/mozapps/extensions/pluginPrefs.js (content/pluginPrefs.js)
content/mozapps/extensions/OpenH264-license.txt (content/OpenH264-license.txt) content/mozapps/extensions/OpenH264-license.txt (content/OpenH264-license.txt)
content/mozapps/extensions/default-theme-icon.svg (content/default-theme-icon.svg)
#endif #endif
content/mozapps/xpinstall/xpinstallConfirm.xul (content/xpinstallConfirm.xul) content/mozapps/xpinstall/xpinstallConfirm.xul (content/xpinstallConfirm.xul)
content/mozapps/xpinstall/xpinstallConfirm.js (content/xpinstallConfirm.js) 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/incompatible.xpi
!/toolkit/mozapps/extensions/test/xpinstall/installtrigger.html !/toolkit/mozapps/extensions/test/xpinstall/installtrigger.html
!/toolkit/mozapps/extensions/test/xpinstall/restartless.xpi !/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/unsigned.xpi
!/toolkit/mozapps/extensions/test/xpinstall/amosigned.xpi !/toolkit/mozapps/extensions/test/xpinstall/amosigned.xpi
!/toolkit/mozapps/extensions/test/xpinstall/amosigned-restart-required.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() { function ensure_test_completed() {
for (let i in gExpectedEvents) { for (let i in gExpectedEvents) {
if (gExpectedEvents[i].length > 0) 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 = {}; gExpectedEvents = {};
if (gExpectedInstalls) if (gExpectedInstalls)

View File

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

View File

@ -5,19 +5,6 @@ add_task(async function test_XPIStates_invalid_paths() {
let startupDatasets = [ 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": { "app-profile": {
"addons": { "addons": {
"xpcshell-something-or-other@mozilla.org": { "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": { "app-profile": {
"addons": { "addons": {
"xpcshell-something-or-other@mozilla.org": { "xpcshell-something-or-other@mozilla.org": {

View File

@ -31,7 +31,7 @@ function end_test() {
// called // called
async function run_test_1() { async function run_test_1() {
let aAddons = await AddonManager.getAddonsByTypes(["extension", "theme", "locale"]); 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.addObserver(function observer() {
Services.obs.removeObserver(observer, "addons-background-update-complete"); Services.obs.removeObserver(observer, "addons-background-update-complete");

View File

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

View File

@ -602,29 +602,6 @@ const ADDONS = [
expected: null, 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. // Tests compatibility based on target platforms.
// No targetPlatforms so should be compatible // No targetPlatforms so should be compatible

View File

@ -47,25 +47,6 @@ const ADDONS = {
compatible: [false, true, false, true], 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 // Opt-in to strict compatibility - always incompatible
"addon4@tests.mozilla.org": { "addon4@tests.mozilla.org": {
"install.rdf": { "install.rdf": {

View File

@ -8,11 +8,12 @@
* Coverage may overlap with other tests in this folder. * 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 = [ const THEME_IDS = [
"theme3@tests.mozilla.org", "theme3@tests.mozilla.org",
"theme2@personas.mozilla.org", "theme2@personas.mozilla.org",
"default@tests.mozilla.org" "default-theme@mozilla.org",
]; ];
const DEFAULT_THEME = THEME_IDS[2]; const DEFAULT_THEME = THEME_IDS[2];
@ -37,19 +38,6 @@ add_task(async function setup_to_default_browserish_state() {
} }
} }
}, profileDir); }, 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(); startupManager();

View File

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

View File

@ -8,9 +8,3 @@ toolkit.jar:
skin/classic/mozapps/extensions/heart.png (extensions/heart.png) skin/classic/mozapps/extensions/heart.png (extensions/heart.png)
skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png) skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png)
skin/classic/mozapps/update/updates.css (update/updates.css) 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/columnpicker.gif (tree/columnpicker.gif)
skin/classic/global/tree/folder.png (tree/folder.png) skin/classic/global/tree/folder.png (tree/folder.png)
skin/classic/global/tree/folder@2x.png (tree/folder@2x.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/update/updates.css (update/updates.css)
skin/classic/mozapps/xpinstall/xpinstallConfirm.css (extensions/xpinstallConfirm.css) skin/classic/mozapps/xpinstall/xpinstallConfirm.css (extensions/xpinstallConfirm.css)
skin/classic/mozapps/handling/handling.css (handling/handling.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/update/downloadButtons.png (../../windows/mozapps/update/downloadButtons.png)
* skin/classic/mozapps/xpinstall/xpinstallConfirm.css (../../windows/mozapps/extensions/xpinstallConfirm.css) * 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 % 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.svg (tree/twisty.svg)
skin/classic/global/tree/twisty-preWin10.svg (tree/twisty-preWin10.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 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-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 % 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/extensions/heart.png (extensions/heart.png)
skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png) skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png)
skin/classic/mozapps/update/updates.css (update/updates.css) 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