diff -r 48d794331fce -r af29b3ac33ae mozilla-bmo1464766.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mozilla-bmo1464766.patch Tue Jun 26 07:37:04 2018 +0200 @@ -0,0 +1,140 @@ + +# HG changeset patch +# User Mike Hommey +# Date 1527491713 -32400 +# Node ID c28becad0c10b906454d7e424f9a9402799ea8dd +# Parent a830c8302c71a45e019fe14e16945b32346b2253 +Bug 1464766 - Allow to relax the addon signature requirements. r?rhelmer + +diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js +--- a/modules/libpref/init/all.js ++++ b/modules/libpref/init/all.js +@@ -1256,16 +1256,19 @@ pref("print.print_via_parent", true); + pref("print.print_via_parent", false); + #endif + + // Pref used by the spellchecker extension to control the + // maximum number of misspelled words that will be underlined + // in a document. + pref("extensions.spellcheck.inline.max-misspellings", 500); + ++// Add-on manager scoped allowing unsigned addons. None by default. ++pref("extensions.unsignedScopes", 12, locked); ++ + // Prefs used by libeditor. Prefs specific to seamonkey composer + // belong in comm-central/editor/ui/composer.js + + pref("editor.use_custom_colors", false); + pref("editor.singleLine.pasteNewlines", 2); + pref("editor.use_css", false); + pref("editor.css.default_length_unit", "px"); + pref("editor.resizing.preserve_ratio", true); +diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js +--- a/toolkit/mozapps/extensions/content/extensions.js ++++ b/toolkit/mozapps/extensions/content/extensions.js +@@ -47,16 +47,17 @@ XPCOMUtils.defineLazyPreferenceGetter(th + const PREF_DISCOVERURL = "extensions.webservice.discoverURL"; + const PREF_DISCOVER_ENABLED = "extensions.getAddons.showPane"; + const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled"; + const PREF_GETADDONS_CACHE_ID_ENABLED = "extensions.%ID%.getAddons.cache.enabled"; + const PREF_UI_TYPE_HIDDEN = "extensions.ui.%TYPE%.hidden"; + const PREF_UI_LASTCATEGORY = "extensions.ui.lastCategory"; + const PREF_LEGACY_EXCEPTIONS = "extensions.legacy.exceptions"; + const PREF_LEGACY_ENABLED = "extensions.legacy.enabled"; ++const PREF_UNSIGNED_SCOPES = "extensions.unsignedScopes"; + + const LOADING_MSG_DELAY = 100; + + const UPDATES_RECENT_TIMESPAN = 2 * 24 * 3600000; // 2 days (in milliseconds) + const UPDATES_RELEASENOTES_TRANSFORMFILE = "chrome://mozapps/content/extensions/updateinfo.xsl"; + + const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml"; + +@@ -229,19 +230,21 @@ function loadView(aViewId) { + + function isCorrectlySigned(aAddon) { + // Add-ons without an "isCorrectlySigned" property are correctly signed as + // they aren't the correct type for signing. + return aAddon.isCorrectlySigned !== false; + } + + function isDisabledUnsigned(addon) { +- let signingRequired = (addon.type == "locale") ? +- AddonSettings.LANGPACKS_REQUIRE_SIGNING : +- AddonSettings.REQUIRE_SIGNING; ++ let unsignedScopes = Services.prefs.getIntPref(PREF_UNSIGNED_SCOPES, 0); ++ let signingRequired = !(addon.scope & unsignedScopes) && ++ ((addon.type == "locale") ? ++ AddonSettings.LANGPACKS_REQUIRE_SIGNING : ++ AddonSettings.REQUIRE_SIGNING); + return signingRequired && !isCorrectlySigned(addon); + } + + function isLegacyExtension(addon) { + let legacy = false; + if (addon.type == "extension" && !addon.isWebExtension) { + legacy = true; + } +diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm +--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm ++++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm +@@ -66,16 +66,17 @@ const PREF_XPI_STATE = + const PREF_BLOCKLIST_ITEM_URL = "extensions.blocklist.itemURL"; + const PREF_BOOTSTRAP_ADDONS = "extensions.bootstrappedAddons"; + const PREF_PENDING_OPERATIONS = "extensions.pendingOperations"; + const PREF_SKIN_SWITCHPENDING = "extensions.dss.switchPending"; + const PREF_SKIN_TO_SELECT = "extensions.lastSelectedSkin"; + const PREF_GENERAL_SKINS_SELECTEDSKIN = "general.skins.selectedSkin"; + const PREF_EM_EXTENSION_FORMAT = "extensions."; + const PREF_EM_ENABLED_SCOPES = "extensions.enabledScopes"; ++const PREF_EM_UNSIGNED_SCOPES = "extensions.unsignedScopes"; + const PREF_EM_STARTUP_SCAN_SCOPES = "extensions.startupScanScopes"; + const PREF_EM_SHOW_MISMATCH_UI = "extensions.showMismatchUI"; + const PREF_XPI_ENABLED = "xpinstall.enabled"; + const PREF_XPI_WHITELIST_REQUIRED = "xpinstall.whitelist.required"; + const PREF_XPI_DIRECT_WHITELISTED = "xpinstall.whitelist.directRequest"; + const PREF_XPI_FILE_WHITELISTED = "xpinstall.whitelist.fileRequest"; + // xpinstall.signatures.required only supported in dev builds + const PREF_XPI_SIGNATURES_REQUIRED = "xpinstall.signatures.required"; +@@ -801,17 +802,19 @@ function isDisabledLegacy(addon) { + * The add-on to check + * @return true if the add-on should not be appDisabled + */ + function isUsableAddon(aAddon) { + // Hack to ensure the default theme is always usable + if (aAddon.type == "theme" && aAddon.internalName == XPIProvider.defaultSkin) + return true; + +- if (mustSign(aAddon.type) && !aAddon.isCorrectlySigned) { ++ let unsignedScopes = Services.prefs.getIntPref(PREF_EM_UNSIGNED_SCOPES, 0); ++ if (!(aAddon._installLocation.scope & unsignedScopes) && ++ 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)) { + logger.warn(`Preference ${PREF_XPI_SIGNATURES_DEV_ROOT} is set.`); + } + return false; + } + + if (aAddon.blocklistState == nsIBlocklistService.STATE_BLOCKED) { +diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js +--- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js ++++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js +@@ -39,16 +39,17 @@ var logger = Log.repository.getLogger(LO + const KEY_PROFILEDIR = "ProfD"; + const FILE_JSON_DB = "extensions.json"; + + // The last version of DB_SCHEMA implemented in SQLITE + const LAST_SQLITE_DB_SCHEMA = 14; + const PREF_DB_SCHEMA = "extensions.databaseSchema"; + const PREF_PENDING_OPERATIONS = "extensions.pendingOperations"; + const PREF_EM_AUTO_DISABLED_SCOPES = "extensions.autoDisableScopes"; ++const PREF_EM_UNSIGNED_SCOPES = "extensions.unsignedScopes"; + + const KEY_APP_SYSTEM_ADDONS = "app-system-addons"; + const KEY_APP_SYSTEM_DEFAULTS = "app-system-defaults"; + const KEY_APP_GLOBAL = "app-global"; + const KEY_APP_TEMPORARY = "app-temporary"; + + // Properties to save in JSON file + const PROP_JSON_FIELDS = ["id", "syncGUID", "location", "version", "type",