diff --git a/browser/base/content/test/popupNotifications/browser_displayURI.js b/browser/base/content/test/popupNotifications/browser_displayURI.js index 4383322b5710..1d5b8ac44530 100644 --- a/browser/base/content/test/popupNotifications/browser_displayURI.js +++ b/browser/base/content/test/popupNotifications/browser_displayURI.js @@ -57,7 +57,7 @@ async function check(contentTask, options = {}) { let { browser } = this; browser.test.sendMessage( "extension-tab-url", - browser.extension.getURL("extension-tab-page.html") + browser.runtime.getURL("extension-tab-page.html") ); }, files: { diff --git a/browser/base/content/test/tabdialogs/browser_tabdialogbox_content_prompts.js b/browser/base/content/test/tabdialogs/browser_tabdialogbox_content_prompts.js index 1661f7a0227f..bb35b9ea0276 100644 --- a/browser/base/content/test/tabdialogs/browser_tabdialogbox_content_prompts.js +++ b/browser/base/content/test/tabdialogs/browser_tabdialogbox_content_prompts.js @@ -11,7 +11,7 @@ const TEST_DATA_URI = "data:text/html,
"; const TEST_EXTENSION_DATA = { background() { // eslint-disable-next-line no-undef - browser.test.sendMessage("url", browser.extension.getURL("alert.html")); + browser.test.sendMessage("url", browser.runtime.getURL("alert.html")); }, manifest: { name: "Test Extension", diff --git a/browser/components/extensions/test/browser/browser_ext_contentscript_cross_docGroup_adoption.js b/browser/components/extensions/test/browser/browser_ext_contentscript_cross_docGroup_adoption.js index 959dbd7a44cc..fd67da9e5c43 100644 --- a/browser/components/extensions/test/browser/browser_ext_contentscript_cross_docGroup_adoption.js +++ b/browser/components/extensions/test/browser/browser_ext_contentscript_cross_docGroup_adoption.js @@ -22,7 +22,7 @@ add_task(async function test_cross_docGroup_adoption() { "current.html": "data", "content-script.js": function() { let iframe = document.createElement("iframe"); - iframe.src = browser.extension.getURL("current.html"); + iframe.src = browser.runtime.getURL("current.html"); document.body.appendChild(iframe); iframe.addEventListener( diff --git a/browser/components/extensions/test/browser/browser_ext_contentscript_cross_docGroup_adoption_xhr.js b/browser/components/extensions/test/browser/browser_ext_contentscript_cross_docGroup_adoption_xhr.js index e69131923c6f..dd0f6c4f870f 100644 --- a/browser/components/extensions/test/browser/browser_ext_contentscript_cross_docGroup_adoption_xhr.js +++ b/browser/components/extensions/test/browser/browser_ext_contentscript_cross_docGroup_adoption_xhr.js @@ -23,7 +23,7 @@ add_task(async function test_cross_docGroup_adoption() { "content-script.js": function() { let xhr = new XMLHttpRequest(); xhr.responseType = "document"; - xhr.open("GET", browser.extension.getURL("blank.html")); + xhr.open("GET", browser.runtime.getURL("blank.html")); xhr.onload = function() { let doc = xhr.response; diff --git a/browser/components/extensions/test/browser/browser_ext_identity_indication.js b/browser/components/extensions/test/browser/browser_ext_identity_indication.js index 8823e0df1194..39a6c091c235 100644 --- a/browser/components/extensions/test/browser/browser_ext_identity_indication.js +++ b/browser/components/extensions/test/browser/browser_ext_identity_indication.js @@ -51,7 +51,7 @@ function confirmExtensionPage() { add_task(async function testIdentityIndication() { let extension = ExtensionTestUtils.loadExtension({ background() { - browser.test.sendMessage("url", browser.extension.getURL("icon.png")); + browser.test.sendMessage("url", browser.runtime.getURL("icon.png")); }, manifest: { name: "Test Extension", @@ -78,7 +78,7 @@ add_task(async function testIdentityIndication() { add_task(async function testIdentityIndicationNewTab() { let extension = ExtensionTestUtils.loadExtension({ background() { - browser.test.sendMessage("url", browser.extension.getURL("newtab.html")); + browser.test.sendMessage("url", browser.runtime.getURL("newtab.html")); }, manifest: { name: "Test Extension", diff --git a/browser/components/extensions/test/browser/browser_ext_lastError.js b/browser/components/extensions/test/browser/browser_ext_lastError.js index a596b56df90b..3f98889b6910 100644 --- a/browser/components/extensions/test/browser/browser_ext_lastError.js +++ b/browser/components/extensions/test/browser/browser_ext_lastError.js @@ -5,10 +5,9 @@ async function sendMessage(options) { browser.runtime.sendMessage(result => { browser.test.assertEq(undefined, result, "Argument value"); if (options.checkLastError) { - let lastError = browser[options.checkLastError].lastError; browser.test.assertEq( "runtime.sendMessage's message argument is missing", - lastError && lastError.message, + browser.runtime.lastError?.message, "lastError value" ); } @@ -34,21 +33,19 @@ add_task(async function testLastError() { // Check that we have no unexpected console messages when lastError is // checked. - for (let api of ["extension", "runtime"]) { - let waitForConsole = new Promise(resolve => { - SimpleTest.monitorConsole(resolve, [ - { message: /message argument is missing/, forbid: true }, - ]); - }); + let waitForConsole = new Promise(resolve => { + SimpleTest.monitorConsole(resolve, [ + { message: /message argument is missing/, forbid: true }, + ]); + }); - await sendMessage({ checkLastError: api }); + await sendMessage({ checkLastError: true }); - SimpleTest.endMonitorConsole(); - await waitForConsole; - } + SimpleTest.endMonitorConsole(); + await waitForConsole; // Check that we do have a console message when lastError is not checked. - let waitForConsole = new Promise(resolve => { + waitForConsole = new Promise(resolve => { SimpleTest.monitorConsole(resolve, [ { message: /Unchecked lastError value: Error: runtime.sendMessage's message argument is missing/, diff --git a/browser/components/extensions/test/browser/browser_ext_persistent_storage_permission_indication.js b/browser/components/extensions/test/browser/browser_ext_persistent_storage_permission_indication.js index f22dd1fde82e..a1ff8075b2c1 100644 --- a/browser/components/extensions/test/browser/browser_ext_persistent_storage_permission_indication.js +++ b/browser/components/extensions/test/browser/browser_ext_persistent_storage_permission_indication.js @@ -67,7 +67,7 @@ async function testPermissionPopup({ expectPermissionHidden }) { add_task(async function testPersistentStoragePermissionHidden() { let extension = ExtensionTestUtils.loadExtension({ background() { - browser.test.sendMessage("url", browser.extension.getURL("icon.png")); + browser.test.sendMessage("url", browser.runtime.getURL("icon.png")); }, manifest: { name: "Test Extension", @@ -91,7 +91,7 @@ add_task(async function testPersistentStoragePermissionHidden() { add_task(async function testPersistentStoragePermissionVisible() { let extension = ExtensionTestUtils.loadExtension({ background() { - browser.test.sendMessage("url", browser.extension.getURL("icon.png")); + browser.test.sendMessage("url", browser.runtime.getURL("icon.png")); }, manifest: { name: "Test Extension", diff --git a/browser/components/extensions/test/browser/browser_ext_runtime_openOptionsPage.js b/browser/components/extensions/test/browser/browser_ext_runtime_openOptionsPage.js index 2ca2c6bb0d87..19f7030adde4 100644 --- a/browser/components/extensions/test/browser/browser_ext_runtime_openOptionsPage.js +++ b/browser/components/extensions/test/browser/browser_ext_runtime_openOptionsPage.js @@ -299,7 +299,7 @@ add_task(async function test_tab_options() { } }); - let optionsURL = browser.extension.getURL("options.html"); + let optionsURL = browser.runtime.getURL("options.html"); try { let [firstTab] = await browser.tabs.query({ diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_executeScript_bad.js b/browser/components/extensions/test/browser/browser_ext_tabs_executeScript_bad.js index 3e2e869b6252..9fd47844c459 100644 --- a/browser/components/extensions/test/browser/browser_ext_tabs_executeScript_bad.js +++ b/browser/components/extensions/test/browser/browser_ext_tabs_executeScript_bad.js @@ -281,7 +281,7 @@ add_task(async function testBadURL() { browser.test.assertEq(undefined, result, "Result value"); browser.test.assertTrue( - browser.extension.lastError instanceof Error, + browser.runtime.lastError instanceof Error, "runtime.lastError is Error" ); @@ -292,9 +292,8 @@ add_task(async function testBadURL() { browser.test.assertEq( "Files to be injected must be within the extension", - browser.extension.lastError && - browser.extension.lastError.message, - "extension.lastError value" + browser.runtime.lastError && browser.runtime.lastError.message, + "runtime.lastError value" ); browser.test.assertEq( @@ -317,8 +316,8 @@ add_task(async function testBadURL() { browser.test.assertEq( null, - browser.extension.lastError, - "extension.lastError value" + browser.runtime.lastError, + "runtime.lastError value" ); browser.test.assertEq( diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_move_window.js b/browser/components/extensions/test/browser/browser_ext_tabs_move_window.js index 09bc8459632f..258db0357ee5 100644 --- a/browser/components/extensions/test/browser/browser_ext_tabs_move_window.js +++ b/browser/components/extensions/test/browser/browser_ext_tabs_move_window.js @@ -140,7 +140,7 @@ add_task(async function test_currentWindowAfterTabMoved() { async function background() { let tabId; - const url = browser.extension.getURL("current.html"); + const url = browser.runtime.getURL("current.html"); browser.test.onMessage.addListener(async msg => { if (msg === "move") { diff --git a/browser/extensions/screenshots/assertIsBlankDocument.js b/browser/extensions/screenshots/assertIsBlankDocument.js index d9fc51578f87..be2371632abe 100644 --- a/browser/extensions/screenshots/assertIsBlankDocument.js +++ b/browser/extensions/screenshots/assertIsBlankDocument.js @@ -9,7 +9,7 @@ Should be applied *inside* catcher.watchFunction */ this.assertIsBlankDocument = function assertIsBlankDocument(doc) { - if (doc.documentURI !== browser.extension.getURL("blank.html")) { + if (doc.documentURI !== browser.runtime.getURL("blank.html")) { const exc = new Error("iframe URL does not match expected blank.html"); exc.foundURL = doc.documentURI; throw exc; diff --git a/browser/extensions/screenshots/background/startBackground.js b/browser/extensions/screenshots/background/startBackground.js index 96edc615f69b..f34f69a1c3c9 100644 --- a/browser/extensions/screenshots/background/startBackground.js +++ b/browser/extensions/screenshots/background/startBackground.js @@ -120,7 +120,7 @@ this.startBackground = (function() { loadedPromise = loadedPromise.then(() => { return new Promise((resolve, reject) => { const tag = document.createElement("script"); - tag.src = browser.extension.getURL(script); + tag.src = browser.runtime.getURL(script); tag.onload = () => { resolve(); }; diff --git a/browser/extensions/screenshots/clipboard.js b/browser/extensions/screenshots/clipboard.js index 67317c5e85d4..3b588689ead4 100644 --- a/browser/extensions/screenshots/clipboard.js +++ b/browser/extensions/screenshots/clipboard.js @@ -12,7 +12,7 @@ this.clipboard = (function() { exports.copy = function(text) { return new Promise((resolve, reject) => { const element = document.createElement("iframe"); - element.src = browser.extension.getURL("blank.html"); + element.src = browser.runtime.getURL("blank.html"); // We can't actually hide the iframe while copying, but we can make // it close to invisible: element.style.opacity = "0"; diff --git a/browser/extensions/screenshots/selector/ui.js b/browser/extensions/screenshots/selector/ui.js index 8a7a37bec562..86d2a22ba42c 100644 --- a/browser/extensions/screenshots/selector/ui.js +++ b/browser/extensions/screenshots/selector/ui.js @@ -31,7 +31,7 @@ this.ui = (function() { const substitutedCss = inlineSelectionCss.replace( /MOZ_EXTENSION([^"]+)/g, (match, filename) => { - return browser.extension.getURL(filename); + return browser.runtime.getURL(filename); } ); @@ -60,7 +60,7 @@ this.ui = (function() { function initializeIframe() { const el = document.createElement("iframe"); - el.src = browser.extension.getURL("blank.html"); + el.src = browser.runtime.getURL("blank.html"); el.style.zIndex = "99999999999"; el.style.border = "none"; el.style.top = "0"; @@ -411,18 +411,18 @@ this.ui = (function() {