browser_webextension_descriptor.js (1048B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 add_task(async function test_webextension_descriptors() { 8 const extension = ExtensionTestUtils.loadExtension({ 9 useAddonManager: "temporary", 10 manifest: { 11 name: "Descriptor extension", 12 }, 13 }); 14 15 await extension.startup(); 16 17 // Get AddonTarget. 18 const commands = await CommandsFactory.forAddon(extension.id); 19 const descriptor = commands.descriptorFront; 20 ok(descriptor, "webextension descriptor has been found"); 21 is(descriptor.name, "Descriptor extension", "Descriptor name is correct"); 22 is(descriptor.debuggable, true, "Descriptor debuggable attribute is correct"); 23 24 const onDestroyed = descriptor.once("descriptor-destroyed"); 25 info("Uninstall the extension"); 26 await extension.unload(); 27 info("Wait for the descriptor to be destroyed"); 28 await onDestroyed; 29 30 await commands.destroy(); 31 });