diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /toolkit/mozapps/extensions/internal | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/mozapps/extensions/internal')
7 files changed, 66 insertions, 29 deletions
diff --git a/toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs b/toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs index e854e04b3c..e53e4af7a4 100644 --- a/toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs +++ b/toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs @@ -78,7 +78,7 @@ import { Log } from "resource://gre/modules/Log.sys.mjs"; const LOGGER_ID = "addons.repository"; // Create a new logger for use by the Addons Repository -// (Requires AddonManager.jsm) +// (Requires AddonManager.sys.mjs) var logger = Log.repository.getLogger(LOGGER_ID); function convertHTMLToPlainText(html) { diff --git a/toolkit/mozapps/extensions/internal/AddonTestUtils.sys.mjs b/toolkit/mozapps/extensions/internal/AddonTestUtils.sys.mjs index 7b30daa0e2..f53d32092d 100644 --- a/toolkit/mozapps/extensions/internal/AddonTestUtils.sys.mjs +++ b/toolkit/mozapps/extensions/internal/AddonTestUtils.sys.mjs @@ -298,7 +298,7 @@ export var AddonTestUtils = { // And scan for changes at startup Services.prefs.setIntPref("extensions.startupScanScopes", 15); - // By default, don't cache add-ons in AddonRepository.jsm + // By default, don't cache add-ons in AddonRepository.sys.mjs Services.prefs.setBoolPref("extensions.getAddons.cache.enabled", false); // Point update checks to the local machine for fast failures @@ -567,7 +567,7 @@ export var AddonTestUtils = { }, overrideCertDB() { - let verifyCert = async (file, result, cert, callback) => { + let verifyCert = async (file, result, signatureInfos, callback) => { if ( result == Cr.NS_ERROR_SIGNED_JAR_NOT_SIGNED && !this.useRealCertChecks && @@ -606,7 +606,16 @@ export var AddonTestUtils = { }; } - return [callback, Cr.NS_OK, fakeCert]; + return [ + callback, + Cr.NS_OK, + [ + { + signerCert: fakeCert, + signatureAlgorithm: Ci.nsIAppSignatureInfo.COSE_WITH_SHA256, + }, + ], + ]; } catch (e) { // If there is any error then just pass along the original results } finally { @@ -621,7 +630,7 @@ export var AddonTestUtils = { } } - return [callback, result, cert]; + return [callback, result, signatureInfos]; }; let FakeCertDB = { @@ -644,10 +653,14 @@ export var AddonTestUtils = { this._genuine.openSignedAppFileAsync( root, file, - (result, zipReader, cert) => { - verifyCert(file.clone(), result, cert, callback).then( - ([callback, result, cert]) => { - callback.openSignedAppFileFinished(result, zipReader, cert); + (result, zipReader, signatureInfos) => { + verifyCert(file.clone(), result, signatureInfos, callback).then( + ([callback, result, signatureInfos]) => { + callback.openSignedAppFileFinished( + result, + zipReader, + signatureInfos + ); } ); } @@ -1730,7 +1743,7 @@ export var AddonTestUtils = { * @param {object} extension * The return value of ExtensionTestUtils.loadExtension. * For browser tests, see mochitest/tests/SimpleTest/ExtensionTestUtils.js - * For xpcshell tests, see toolkit/components/extensions/ExtensionXPCShellUtils.jsm + * For xpcshell tests, see toolkit/components/extensions/ExtensionXPCShellUtils.sys.mjs * @param {object} [options] * Optional options. * @param {boolean} [options.expectPending = false] diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.sys.mjs b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.sys.mjs index a3935a26f9..5b7b10a764 100644 --- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.sys.mjs +++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.sys.mjs @@ -26,7 +26,7 @@ import { Log } from "resource://gre/modules/Log.sys.mjs"; const LOGGER_ID = "addons.update-checker"; // Create a new logger for use by the Addons Update Checker -// (Requires AddonManager.jsm) +// (Requires AddonManager.sys.mjs) var logger = Log.repository.getLogger(LOGGER_ID); /** diff --git a/toolkit/mozapps/extensions/internal/SitePermsAddonProvider.sys.mjs b/toolkit/mozapps/extensions/internal/SitePermsAddonProvider.sys.mjs index ccac484a1e..7ca952dc8a 100644 --- a/toolkit/mozapps/extensions/internal/SitePermsAddonProvider.sys.mjs +++ b/toolkit/mozapps/extensions/internal/SitePermsAddonProvider.sys.mjs @@ -148,20 +148,30 @@ class SitePermsAddonWrapper { }); } - get creator() {} + get creator() { + return undefined; + } - get homepageURL() {} + get homepageURL() { + return undefined; + } - get description() {} + get description() { + return undefined; + } - get fullDescription() {} + get fullDescription() { + return undefined; + } get version() { // We consider the previous implementation attempt (signed addons) to be the initial version, // hence the 2.0 for this approach. return "2.0"; } - get updateDate() {} + get updateDate() { + return undefined; + } get isActive() { return true; @@ -273,8 +283,6 @@ class SitePermsAddonWrapper { } class SitePermsAddonInstalling extends SitePermsAddonWrapper { - #install = null; - /** * @param {string} siteOriginNoSuffix: The origin this addon is installed * for, WITHOUT the suffix generated from @@ -293,7 +301,6 @@ class SitePermsAddonInstalling extends SitePermsAddonWrapper { }; super(siteOriginNoSuffix, [permission]); - this.#install = install; } get existingAddon() { diff --git a/toolkit/mozapps/extensions/internal/XPIDatabase.sys.mjs b/toolkit/mozapps/extensions/internal/XPIDatabase.sys.mjs index 5d1d2c1970..af0b02444a 100644 --- a/toolkit/mozapps/extensions/internal/XPIDatabase.sys.mjs +++ b/toolkit/mozapps/extensions/internal/XPIDatabase.sys.mjs @@ -117,7 +117,7 @@ const nsIFile = Components.Constructor( ); // Create a new logger for use by the Addons XPI Provider Utils -// (Requires AddonManager.jsm) +// (Requires AddonManager.sys.mjs) var logger = Log.repository.getLogger(LOGGER_ID); const FILE_JSON_DB = "extensions.json"; diff --git a/toolkit/mozapps/extensions/internal/XPIInstall.sys.mjs b/toolkit/mozapps/extensions/internal/XPIInstall.sys.mjs index 1a80407ad2..0402c2f2ca 100644 --- a/toolkit/mozapps/extensions/internal/XPIInstall.sys.mjs +++ b/toolkit/mozapps/extensions/internal/XPIInstall.sys.mjs @@ -99,6 +99,17 @@ const PREF_SELECTED_THEME = "extensions.activeThemeID"; const TOOLKIT_ID = "toolkit@mozilla.org"; +ChromeUtils.defineLazyGetter(lazy, "MOZ_UNSIGNED_SCOPES", () => { + let result = 0; + if (AppConstants.MOZ_UNSIGNED_APP_SCOPE) { + result |= AddonManager.SCOPE_APPLICATION; + } + if (AppConstants.MOZ_UNSIGNED_SYSTEM_SCOPE) { + result |= AddonManager.SCOPE_SYSTEM; + } + return result; +}); + /** * Returns a nsIFile instance for the given path, relative to the given * base file, if provided. @@ -168,7 +179,7 @@ import { Log } from "resource://gre/modules/Log.sys.mjs"; const LOGGER_ID = "addons.xpi"; // Create a new logger for use by all objects in this Addons XPI Provider module -// (Requires AddonManager.jsm) +// (Requires AddonManager.sys.mjs) var logger = Log.repository.getLogger(LOGGER_ID); // Stores the ID of the theme which was selected during the last session, @@ -316,13 +327,22 @@ XPIPackage = class XPIPackage extends Package { verifySignedStateForRoot(addonId, root) { return new Promise(resolve => { let callback = { - openSignedAppFileFinished(aRv, aZipReader, aCert) { + openSignedAppFileFinished(aRv, aZipReader, aSignatureInfos) { + // aSignatureInfos is an array of nsIAppSignatureInfo. + // In the future, this code can iterate through the array to + // determine if one of the verified signatures used a satisfactory + // algorithm and signing certificate. + // For now, any verified signature is acceptable. + let cert; + if (aRv == Cr.NS_OK && aSignatureInfos.length) { + cert = aSignatureInfos[0].signerCert; + } if (aZipReader) { aZipReader.close(); } resolve({ - signedState: getSignedStatus(aRv, aCert, addonId), - cert: aCert, + signedState: getSignedStatus(aRv, cert, addonId), + cert, }); }, }; @@ -872,10 +892,7 @@ function shouldVerifySignedState(aAddonType, aLocation) { return true; } - if ( - aLocation.isBuiltin || - aLocation.scope & AppConstants.MOZ_UNSIGNED_SCOPES - ) { + if (aLocation.isBuiltin || aLocation.scope & lazy.MOZ_UNSIGNED_SCOPES) { return false; } diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.sys.mjs b/toolkit/mozapps/extensions/internal/XPIProvider.sys.mjs index d5ffd06d11..12d4fa1172 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.sys.mjs +++ b/toolkit/mozapps/extensions/internal/XPIProvider.sys.mjs @@ -185,7 +185,7 @@ import { Log } from "resource://gre/modules/Log.sys.mjs"; const LOGGER_ID = "addons.xpi"; // Create a new logger for use by all objects in this Addons XPI Provider module -// (Requires AddonManager.jsm) +// (Requires AddonManager.sys.mjs) var logger = Log.repository.getLogger(LOGGER_ID); /** |