1 |
|
2 # HG changeset patch |
|
3 # User Mike Hommey <mh+mozilla@glandium.org> |
|
4 # Date 1527491713 -32400 |
|
5 # Node ID c28becad0c10b906454d7e424f9a9402799ea8dd |
|
6 # Parent 86eaa6799cf51660c0b598937121305b8f70c84d |
|
7 Bug 1464766 - Allow to relax the addon signature requirements. r?rhelmer |
|
8 |
|
9 diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js |
|
10 --- a/modules/libpref/init/all.js |
|
11 +++ b/modules/libpref/init/all.js |
|
12 @@ -1134,16 +1134,19 @@ pref("print.print_via_parent", true); |
|
13 pref("print.print_via_parent", false); |
|
14 #endif |
|
15 |
|
16 // Pref used by the spellchecker extension to control the |
|
17 // maximum number of misspelled words that will be underlined |
|
18 // in a document. |
|
19 pref("extensions.spellcheck.inline.max-misspellings", 500); |
|
20 |
|
21 +// Add-on manager scoped allowing unsigned addons. None by default. |
|
22 +pref("extensions.unsignedScopes", 12, locked); |
|
23 + |
|
24 // Prefs used by libeditor. Prefs specific to seamonkey composer |
|
25 // belong in comm-central/editor/ui/composer.js |
|
26 |
|
27 pref("editor.use_custom_colors", false); |
|
28 pref("editor.singleLine.pasteNewlines", 2); |
|
29 pref("editor.use_css", false); |
|
30 pref("editor.css.default_length_unit", "px"); |
|
31 pref("editor.resizing.preserve_ratio", true); |
|
32 diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js |
|
33 --- a/toolkit/mozapps/extensions/content/extensions.js |
|
34 +++ b/toolkit/mozapps/extensions/content/extensions.js |
|
35 @@ -42,16 +42,17 @@ XPCOMUtils.defineLazyPreferenceGetter(th |
|
36 const PREF_DISCOVERURL = "extensions.webservice.discoverURL"; |
|
37 const PREF_DISCOVER_ENABLED = "extensions.getAddons.showPane"; |
|
38 const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled"; |
|
39 const PREF_GETADDONS_CACHE_ID_ENABLED = "extensions.%ID%.getAddons.cache.enabled"; |
|
40 const PREF_UI_TYPE_HIDDEN = "extensions.ui.%TYPE%.hidden"; |
|
41 const PREF_UI_LASTCATEGORY = "extensions.ui.lastCategory"; |
|
42 const PREF_LEGACY_EXCEPTIONS = "extensions.legacy.exceptions"; |
|
43 const PREF_LEGACY_ENABLED = "extensions.legacy.enabled"; |
|
44 +const PREF_UNSIGNED_SCOPES = "extensions.unsignedScopes"; |
|
45 |
|
46 const LOADING_MSG_DELAY = 100; |
|
47 |
|
48 const UPDATES_RECENT_TIMESPAN = 2 * 24 * 3600000; // 2 days (in milliseconds) |
|
49 const UPDATES_RELEASENOTES_TRANSFORMFILE = "chrome://mozapps/content/extensions/updateinfo.xsl"; |
|
50 |
|
51 const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml"; |
|
52 |
|
53 @@ -223,19 +224,21 @@ function loadView(aViewId) { |
|
54 |
|
55 function isCorrectlySigned(aAddon) { |
|
56 // Add-ons without an "isCorrectlySigned" property are correctly signed as |
|
57 // they aren't the correct type for signing. |
|
58 return aAddon.isCorrectlySigned !== false; |
|
59 } |
|
60 |
|
61 function isDisabledUnsigned(addon) { |
|
62 - let signingRequired = (addon.type == "locale") ? |
|
63 - AddonSettings.LANGPACKS_REQUIRE_SIGNING : |
|
64 - AddonSettings.REQUIRE_SIGNING; |
|
65 + let unsignedScopes = Services.prefs.getIntPref(PREF_UNSIGNED_SCOPES, 0); |
|
66 + let signingRequired = !(addon.scope & unsignedScopes) && |
|
67 + ((addon.type == "locale") ? |
|
68 + AddonSettings.LANGPACKS_REQUIRE_SIGNING : |
|
69 + AddonSettings.REQUIRE_SIGNING); |
|
70 return signingRequired && !isCorrectlySigned(addon); |
|
71 } |
|
72 |
|
73 function isLegacyExtension(addon) { |
|
74 let legacy = false; |
|
75 if (addon.type == "extension" && !addon.isWebExtension) { |
|
76 legacy = true; |
|
77 } |
|
78 diff --git a/toolkit/mozapps/extensions/internal/XPIDatabase.jsm b/toolkit/mozapps/extensions/internal/XPIDatabase.jsm |
|
79 --- a/toolkit/mozapps/extensions/internal/XPIDatabase.jsm |
|
80 +++ b/toolkit/mozapps/extensions/internal/XPIDatabase.jsm |
|
81 @@ -78,16 +78,17 @@ const KEY_PROFILEDIR = |
|
82 const FILE_JSON_DB = "extensions.json"; |
|
83 |
|
84 // The last version of DB_SCHEMA implemented in SQLITE |
|
85 const LAST_SQLITE_DB_SCHEMA = 14; |
|
86 |
|
87 const PREF_BLOCKLIST_ITEM_URL = "extensions.blocklist.itemURL"; |
|
88 const PREF_DB_SCHEMA = "extensions.databaseSchema"; |
|
89 const PREF_EM_AUTO_DISABLED_SCOPES = "extensions.autoDisableScopes"; |
|
90 +const PREF_EM_UNSIGNED_SCOPES = "extensions.unsignedScopes"; |
|
91 const PREF_EM_EXTENSION_FORMAT = "extensions."; |
|
92 const PREF_PENDING_OPERATIONS = "extensions.pendingOperations"; |
|
93 const PREF_XPI_SIGNATURES_DEV_ROOT = "xpinstall.signatures.dev-root"; |
|
94 |
|
95 const TOOLKIT_ID = "toolkit@mozilla.org"; |
|
96 |
|
97 const KEY_APP_SYSTEM_ADDONS = "app-system-addons"; |
|
98 const KEY_APP_SYSTEM_DEFAULTS = "app-system-defaults"; |
|
99 @@ -1959,17 +1960,19 @@ this.XPIDatabase = { |
|
100 * Calculates whether an add-on should be appDisabled or not. |
|
101 * |
|
102 * @param {AddonInternal} aAddon |
|
103 * The add-on to check |
|
104 * @returns {boolean} |
|
105 * True if the add-on should not be appDisabled |
|
106 */ |
|
107 isUsableAddon(aAddon) { |
|
108 - if (this.mustSign(aAddon.type) && !aAddon.isCorrectlySigned) { |
|
109 + let unsignedScopes = Services.prefs.getIntPref(PREF_EM_UNSIGNED_SCOPES, 0); |
|
110 + if (!(aAddon._installLocation.scope & unsignedScopes) && |
|
111 + this.mustSign(aAddon.type) && !aAddon.isCorrectlySigned) { |
|
112 logger.warn(`Add-on ${aAddon.id} is not correctly signed.`); |
|
113 if (Services.prefs.getBoolPref(PREF_XPI_SIGNATURES_DEV_ROOT, false)) { |
|
114 logger.warn(`Preference ${PREF_XPI_SIGNATURES_DEV_ROOT} is set.`); |
|
115 } |
|
116 return false; |
|
117 } |
|
118 |
|
119 if (aAddon.blocklistState == nsIBlocklistService.STATE_BLOCKED) { |
|