Bug 1759354 - Fix test_granted_for_privileged_mv3 r=robwu

Differential Revision: https://phabricator.services.mozilla.com/D140933
This commit is contained in:
Tomislav Jovanovic 2022-03-14 18:42:20 +00:00
parent f04ccd7a53
commit c9bb3ea189

View File

@ -383,22 +383,27 @@ add_task(function test_granted_for_temporary_mv3() {
});
});
add_task(async function test_granted_for_privileged_mv3() {
const { AddonSettings } = ChromeUtils.import(
"resource://gre/modules/addons/AddonSettings.jsm"
);
// This makes temporary loaded extensions Privileged.
Services.prefs.setBoolPref("extensions.experiments.enabled", true);
add_task(async function test_granted_only_for_privileged_mv3() {
try {
// For permanent non-privileged, granted_host_permissions does nothing.
await test_permissions({
manifest_version: 3,
granted_host_permissions: true,
useAddonManager: "temporary",
// Expect granted only in configurations where experiments are enabled.
expectAllGranted: AddonSettings.EXPERIMENTS_ENABLED,
useAddonManager: "permanent",
expectAllGranted: false,
});
// Make extensions loaded with addon manager privileged.
AddonTestUtils.usePrivilegedSignatures = true;
await test_permissions({
manifest_version: 3,
granted_host_permissions: true,
useAddonManager: "permanent",
expectAllGranted: true,
});
} finally {
Services.prefs.setBoolPref("extensions.experiments.enabled", false);
AddonTestUtils.usePrivilegedSignatures = false;
}
});