From 0548b59e51d966622e8733c62690078b61713d48 Mon Sep 17 00:00:00 2001 From: girst Date: Fri, 29 Apr 2022 15:31:44 +0200 Subject: [PATCH] Do not override AddonSettings.REQUIRE_SIGNING This is not necessary, as it is only checked in XPIDatabase.jsm::mustSign(), which we can override instead, and in aboutaddonsCommon.js::isDisabledUnsigned(), which we cannot affect anyways and only uses it to show a red warning bar for legacy addons. This also removes the old AddonSettings.ALLOW_LEGACY_EXTENSIONS override, which was only used in Extension.jsm::experimentsAllowed() and XPIDatabase.jsm::isDisabledLegacy(). This is in preparation for the ESM-ification endeavours going on at Mozilla, which will make importing a module's global object (as we did with `let Xdb = Cu.import(...)`) impossible, but was needed to get a reference to AddonSettings (instead of a copy). Step two will be replacing Cu.import() with ChromeUtils.import(), which has stricter semantics about exported objects (doesn't hurt us; see Bug 1766114). --- README | 2 +- config.js | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/README b/README index 7877dc0..a5dd03e 100644 --- a/README +++ b/README @@ -22,4 +22,4 @@ trademark; you are not granted any right to distribute modified binary versions of the software containing the official branding. (C) 2018-2019 Mozilla, MPL v2 -(C) 2019-2020 //gir.st/, MPL v2 +(C) 2019-2022 //gir.st/, MPL v2 diff --git a/config.js b/config.js index 6a7fea1..0761851 100644 --- a/config.js +++ b/config.js @@ -1,13 +1,8 @@ // keep this comment try { - let Xdb = Cu.import('resource://gre/modules/addons/XPIDatabase.jsm', {}); - Xdb.XPIDatabase.isDisabledLegacy = (addon) => false; - Xdb.AddonSettings = { - ...Object.fromEntries(Object.getOwnPropertyNames(Xdb.AddonSettings) - .map(e => [e, Xdb.AddonSettings[e]])), - "REQUIRE_SIGNING": false, - "ALLOW_LEGACY_EXTENSIONS": true, // <=fx73 - }; + let {XPIDatabase} = Cu.import('resource://gre/modules/addons/XPIDatabase.jsm', {}); + XPIDatabase.isDisabledLegacy = (addon) => false; + XPIDatabase.mustSign = (aType) => false; const {FileUtils} = Cu.import('resource://gre/modules/FileUtils.jsm'); Components.manager.QueryInterface(Ci.nsIComponentRegistrar) -- 2.39.3