summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/internal/AddonTestUtils.sys.mjs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /toolkit/mozapps/extensions/internal/AddonTestUtils.sys.mjs
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz
firefox-adbda400be353e676059e335c3c0aaf99e719475.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/mozapps/extensions/internal/AddonTestUtils.sys.mjs')
-rw-r--r--toolkit/mozapps/extensions/internal/AddonTestUtils.sys.mjs31
1 files changed, 22 insertions, 9 deletions
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]