Files
firefox/toolkit/mozapps/extensions/test/xpcshell/test_cache_certdb.js
T
Dave Townsend 037aa70e7b Bug 1362364: Lazily load the certificate database into the add-ons manager. r=rhelmer
The lazy loading is a little more complex because we want this to be a constant
in the scope so extensions can't trivially replace it. This also changes the
test to be more like the proof of concept from bug 1244248.

I took the opportunity to promisify a bunch of things which ultimately made the
verifySignatures code nicer.

MozReview-Commit-ID: 2P890uRY1Si
2017-05-05 14:41:31 -07:00

30 lines
941 B
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// We require signature checks for this test
Services.prefs.setBoolPref(PREF_XPI_SIGNATURES_REQUIRED, true);
gUseRealCertChecks = true;
const profileDir = gProfD.clone();
profileDir.append("extensions");
const ID = "[email protected]";
add_task(async function() {
createAppInfo("[email protected]", "XPCShell", "1", "1.9.2");
AddonTestUtils.manuallyInstall(do_get_addon("test_cache_certdb"), profileDir, ID);
startupManager();
// Force a rescan of signatures
const { XPIProvider } = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {});
await XPIProvider.verifySignatures();
let addon = await AddonManager.getAddonByID(ID);
do_check_eq(addon.signedState, AddonManager.SIGNEDSTATE_MISSING);
do_check_false(addon.isActive);
do_check_true(addon.appDisabled);
});