browser_aboutdebugging_addons_warnings.js (1556B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /* import-globals-from helper-addons.js */ 7 Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this); 8 9 // Test that extension warnings are displayed in about:debugging. 10 add_task(async function () { 11 const EXTENSION_NAME = "Temporary web extension"; 12 const EXTENSION_ID = "test-devtools@mozilla.org"; 13 14 const { document, tab, window } = await openAboutDebugging(); 15 await selectThisFirefoxPage(document, window.AboutDebugging.store); 16 17 await pushPref("extensions.webextensions.warnings-as-errors", false); 18 await installTemporaryExtensionFromXPI( 19 { 20 id: EXTENSION_ID, 21 name: EXTENSION_NAME, 22 extraProperties: { 23 // This property is not expected in the manifest and should trigger a warning! 24 wrongProperty: {}, 25 }, 26 }, 27 document 28 ); 29 await SpecialPowers.popPrefEnv(); 30 31 info("Wait until a debug target item appears"); 32 await waitUntil(() => findDebugTargetByText(EXTENSION_NAME, document)); 33 const target = findDebugTargetByText(EXTENSION_NAME, document); 34 35 const warningMessage = target.querySelector(".qa-message"); 36 ok( 37 !!warningMessage, 38 "A warning message is displayed for the installed addon" 39 ); 40 41 const warningText = warningMessage.textContent; 42 ok( 43 warningText.includes("wrongProperty"), 44 "The warning message mentions wrongProperty" 45 ); 46 47 await removeTemporaryExtension(EXTENSION_NAME, document); 48 await removeTab(tab); 49 });