From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../extensions/internal/AddonTestUtils.sys.mjs | 31 +++++++++++++++------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'toolkit/mozapps/extensions/internal/AddonTestUtils.sys.mjs') 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] -- cgit v1.2.3