mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Bug 1687762
fix deprecated extension api use r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D111966
This commit is contained in:
parent
ee5b607262
commit
7d11b0aa66
@ -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: {
|
||||
|
@ -11,7 +11,7 @@ const TEST_DATA_URI = "data:text/html,<body onload='alert(1)'>";
|
||||
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",
|
||||
|
@ -22,7 +22,7 @@ add_task(async function test_cross_docGroup_adoption() {
|
||||
"current.html": "<html>data</html>",
|
||||
"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(
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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/,
|
||||
|
@ -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",
|
||||
|
@ -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({
|
||||
|
@ -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(
|
||||
|
@ -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") {
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
};
|
||||
|
@ -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";
|
||||
|
@ -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() {
|
||||
<div class="preview-image">
|
||||
<div class="preview-buttons">
|
||||
<button class="highlight-button-cancel" title="${cancelTitle}">
|
||||
<img src="${browser.extension.getURL(
|
||||
<img src="${browser.runtime.getURL(
|
||||
"icons/cancel.svg"
|
||||
)}" />
|
||||
</button>
|
||||
<button class="highlight-button-copy" title="${copyTitle}">
|
||||
<img src="${browser.extension.getURL(
|
||||
<img src="${browser.runtime.getURL(
|
||||
"icons/copy.svg"
|
||||
)}" />
|
||||
<span data-l10n-id="screenshots-copy-button"/>
|
||||
</button>
|
||||
<button class="highlight-button-download" title="${downloadTitle}">
|
||||
<img src="${browser.extension.getURL(
|
||||
<img src="${browser.runtime.getURL(
|
||||
"icons/download-white.svg"
|
||||
)}" />
|
||||
<span data-l10n-id="screenshots-download-button"/>
|
||||
@ -731,7 +731,7 @@ this.ui = (function() {
|
||||
const buttons = makeEl("div", "highlight-buttons");
|
||||
const cancel = makeEl("button", "highlight-button-cancel");
|
||||
const cancelImg = makeEl("img");
|
||||
cancelImg.src = browser.extension.getURL("icons/cancel.svg");
|
||||
cancelImg.src = browser.runtime.getURL("icons/cancel.svg");
|
||||
cancel.title = cancelTitle;
|
||||
cancel.appendChild(cancelImg);
|
||||
buttons.appendChild(cancel);
|
||||
@ -741,14 +741,14 @@ this.ui = (function() {
|
||||
const copyImg = makeEl("img");
|
||||
const copyString = makeEl("span");
|
||||
copyString.textContent = copyText;
|
||||
copyImg.src = browser.extension.getURL("icons/copy.svg");
|
||||
copyImg.src = browser.runtime.getURL("icons/copy.svg");
|
||||
copy.appendChild(copyImg);
|
||||
copy.appendChild(copyString);
|
||||
buttons.appendChild(copy);
|
||||
|
||||
const download = makeEl("button", "highlight-button-download");
|
||||
const downloadImg = makeEl("img");
|
||||
downloadImg.src = browser.extension.getURL("icons/download-white.svg");
|
||||
downloadImg.src = browser.runtime.getURL("icons/download-white.svg");
|
||||
download.appendChild(downloadImg);
|
||||
download.append(downloadText);
|
||||
download.title = downloadTitle;
|
||||
|
@ -84,7 +84,7 @@ add_task(async function testBadURL() {
|
||||
}, result => {
|
||||
browser.test.assertEq(undefined, result, "Result value");
|
||||
|
||||
browser.test.assertTrue(browser.extension.lastError instanceof Error,
|
||||
browser.test.assertTrue(browser.runtime.lastError instanceof Error,
|
||||
"runtime.lastError is Error");
|
||||
|
||||
browser.test.assertTrue(browser.runtime.lastError instanceof Error,
|
||||
@ -92,8 +92,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(
|
||||
"Files to be injected must be within the extension",
|
||||
@ -109,8 +109,8 @@ add_task(async function testBadURL() {
|
||||
}).catch(error => {
|
||||
browser.test.assertTrue(error instanceof Error, "Error is Error");
|
||||
|
||||
browser.test.assertEq(null, browser.extension.lastError,
|
||||
"extension.lastError value");
|
||||
browser.test.assertEq(null, browser.runtime.lastError,
|
||||
"runtime.lastError value");
|
||||
|
||||
browser.test.assertEq(null, browser.runtime.lastError,
|
||||
"runtime.lastError value");
|
||||
|
@ -72,15 +72,15 @@ add_task(async function test_webRequest_no_mozextension_permission() {
|
||||
|
||||
add_task(async function test_webRequest_mozextension_fetch() {
|
||||
function background() {
|
||||
let page = browser.extension.getURL("fetched.html");
|
||||
let page = browser.runtime.getURL("fetched.html");
|
||||
browser.webRequest.onBeforeRequest.addListener(details => {
|
||||
browser.test.assertEq(details.url, page, "got correct url in onBeforeRequest");
|
||||
browser.test.sendMessage("request-started");
|
||||
}, {urls: [browser.extension.getURL("*")]}, ["blocking"]);
|
||||
}, {urls: [browser.runtime.getURL("*")]}, ["blocking"]);
|
||||
browser.webRequest.onCompleted.addListener(details => {
|
||||
browser.test.assertEq(details.url, page, "got correct url in onCompleted");
|
||||
browser.test.sendMessage("request-complete");
|
||||
}, {urls: [browser.extension.getURL("*")]});
|
||||
}, {urls: [browser.runtime.getURL("*")]});
|
||||
|
||||
browser.test.onMessage.addListener((msg, data) => {
|
||||
fetch(page).then(() => {
|
||||
@ -91,7 +91,7 @@ add_task(async function test_webRequest_mozextension_fetch() {
|
||||
browser.test.sendMessage("done");
|
||||
});
|
||||
});
|
||||
browser.test.sendMessage("extensionUrl", browser.extension.getURL("*"));
|
||||
browser.test.sendMessage("extensionUrl", browser.runtime.getURL("*"));
|
||||
}
|
||||
|
||||
// Use webrequest to monitor moz-extension:// requests
|
||||
@ -134,15 +134,15 @@ add_task(async function test_webRequest_mozextension_fetch() {
|
||||
|
||||
add_task(async function test_webRequest_mozextension_tab_query() {
|
||||
function background() {
|
||||
browser.test.sendMessage("extensionUrl", browser.extension.getURL("*"));
|
||||
let page = browser.extension.getURL("tab.html");
|
||||
browser.test.sendMessage("extensionUrl", browser.runtime.getURL("*"));
|
||||
let page = browser.runtime.getURL("tab.html");
|
||||
|
||||
async function onUpdated(tabId, tabInfo, tab) {
|
||||
if (tabInfo.status !== "complete") {
|
||||
return;
|
||||
}
|
||||
browser.test.log(`tab created ${tabId} ${JSON.stringify(tabInfo)} ${tab.url}`);
|
||||
let tabs = await browser.tabs.query({url: browser.extension.getURL("*")});
|
||||
let tabs = await browser.tabs.query({url: browser.runtime.getURL("*")});
|
||||
browser.test.assertEq(1, tabs.length, "got one tab");
|
||||
browser.test.assertEq(tabs.length && tabs[0].id, tab.id, "got the correct tab");
|
||||
browser.test.assertEq(tabs.length && tabs[0].url, page, "got correct url in tab");
|
||||
|
@ -110,7 +110,7 @@ add_task(async function test_api() {
|
||||
browser.tabs.hide(data);
|
||||
}
|
||||
});
|
||||
browser.test.sendMessage("url", browser.extension.getURL(""));
|
||||
browser.test.sendMessage("url", browser.runtime.getURL(""));
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -155,6 +155,8 @@ add_task(async function test_enumerate_content_script_apis() {
|
||||
"contentscript.js": sendAllApis,
|
||||
},
|
||||
};
|
||||
// Turn off warning as errors to pass for deprecated APIs
|
||||
ExtensionTestUtils.failOnSchemaWarnings(false);
|
||||
let extension = ExtensionTestUtils.loadExtension(extensionData);
|
||||
await extension.startup();
|
||||
|
||||
@ -165,17 +167,22 @@ add_task(async function test_enumerate_content_script_apis() {
|
||||
isDeeply(actualApis, expectedApis, "content script APIs");
|
||||
|
||||
await extension.unload();
|
||||
ExtensionTestUtils.failOnSchemaWarnings(true);
|
||||
});
|
||||
|
||||
add_task(async function test_enumerate_background_script_apis() {
|
||||
let extensionData = {
|
||||
background: sendAllApis,
|
||||
};
|
||||
// Turn off warning as errors to pass for deprecated APIs
|
||||
ExtensionTestUtils.failOnSchemaWarnings(false);
|
||||
let extension = ExtensionTestUtils.loadExtension(extensionData);
|
||||
await extension.startup();
|
||||
|
||||
let actualApis = await extension.awaitMessage("allApis");
|
||||
let expectedApis = generateExpectations(expectedBackgroundApis);
|
||||
isDeeply(actualApis, expectedApis, "background script APIs");
|
||||
|
||||
await extension.unload();
|
||||
ExtensionTestUtils.failOnSchemaWarnings(true);
|
||||
});
|
||||
|
@ -45,7 +45,7 @@ function getExtension() {
|
||||
`,
|
||||
},
|
||||
background: async () => {
|
||||
let redirectUrl = browser.extension.getURL("finished.html");
|
||||
let redirectUrl = browser.runtime.getURL("finished.html");
|
||||
browser.webRequest.onBeforeRequest.addListener(details => {
|
||||
return {redirectUrl};
|
||||
}, {urls: ["*://*/intercept*"]}, ["blocking"]);
|
||||
|
@ -68,7 +68,7 @@ add_task(async function test_web_accessible_resources_incognito() {
|
||||
],
|
||||
},
|
||||
background() {
|
||||
browser.test.sendMessage("url", browser.extension.getURL(""));
|
||||
browser.test.sendMessage("url", browser.runtime.getURL(""));
|
||||
},
|
||||
files: {
|
||||
"image.png": IMAGE_ARRAYBUFFER,
|
||||
|
@ -83,54 +83,54 @@ add_task(async function test_web_accessible_resources() {
|
||||
let urls = [
|
||||
// { url, shouldLoad, sandbox, srcdoc }
|
||||
{
|
||||
url: browser.extension.getURL("accessible.html"),
|
||||
url: browser.runtime.getURL("accessible.html"),
|
||||
shouldLoad: true,
|
||||
},
|
||||
{
|
||||
url: browser.extension.getURL("accessible.html") + "?foo=bar",
|
||||
url: browser.runtime.getURL("accessible.html") + "?foo=bar",
|
||||
shouldLoad: true,
|
||||
},
|
||||
{
|
||||
url: browser.extension.getURL("accessible.html") + "#!foo=bar",
|
||||
url: browser.runtime.getURL("accessible.html") + "#!foo=bar",
|
||||
shouldLoad: true,
|
||||
},
|
||||
{
|
||||
url: browser.extension.getURL("accessible.html"),
|
||||
url: browser.runtime.getURL("accessible.html"),
|
||||
shouldLoad: true,
|
||||
sandbox: "allow-scripts",
|
||||
},
|
||||
{
|
||||
url: browser.extension.getURL("accessible.html"),
|
||||
url: browser.runtime.getURL("accessible.html"),
|
||||
shouldLoad: true,
|
||||
sandbox: "allow-same-origin allow-scripts",
|
||||
},
|
||||
{
|
||||
url: browser.extension.getURL("accessible.html"),
|
||||
url: browser.runtime.getURL("accessible.html"),
|
||||
shouldLoad: true,
|
||||
sandbox: "allow-scripts",
|
||||
srcdoc: true,
|
||||
},
|
||||
{
|
||||
url: browser.extension.getURL("inaccessible.html"),
|
||||
url: browser.runtime.getURL("inaccessible.html"),
|
||||
shouldLoad: false,
|
||||
},
|
||||
{
|
||||
url: browser.extension.getURL("inaccessible.html"),
|
||||
url: browser.runtime.getURL("inaccessible.html"),
|
||||
shouldLoad: false,
|
||||
sandbox: "allow-same-origin allow-scripts",
|
||||
},
|
||||
{
|
||||
url: browser.extension.getURL("inaccessible.html"),
|
||||
url: browser.runtime.getURL("inaccessible.html"),
|
||||
shouldLoad: false,
|
||||
sandbox: "allow-same-origin allow-scripts",
|
||||
srcdoc: true,
|
||||
},
|
||||
{
|
||||
url: browser.extension.getURL("wild1.html"),
|
||||
url: browser.runtime.getURL("wild1.html"),
|
||||
shouldLoad: true,
|
||||
},
|
||||
{
|
||||
url: browser.extension.getURL("wild2.htm"),
|
||||
url: browser.runtime.getURL("wild2.htm"),
|
||||
shouldLoad: false,
|
||||
},
|
||||
];
|
||||
@ -305,14 +305,14 @@ add_task(async function test_web_accessible_resources_mixed_content() {
|
||||
"http://example.com/tests/toolkit/components/extensions/test/mochitest/file_image_bad.png",
|
||||
"blocked"
|
||||
);
|
||||
await testImageLoading(browser.extension.getURL("image.png"), "loaded");
|
||||
await testImageLoading(browser.runtime.getURL("image.png"), "loaded");
|
||||
|
||||
let testScriptElement = document.createElement("script");
|
||||
// Set the src via wrappedJSObject so the load is triggered with the
|
||||
// content page's principal rather than ours.
|
||||
testScriptElement.wrappedJSObject.setAttribute(
|
||||
"src",
|
||||
browser.extension.getURL("test_script.js")
|
||||
browser.runtime.getURL("test_script.js")
|
||||
);
|
||||
document.head.appendChild(testScriptElement);
|
||||
|
||||
|
@ -101,7 +101,7 @@ async function testPolicy(manifest_version = 2, customCSP = null) {
|
||||
function background() {
|
||||
browser.test.sendMessage(
|
||||
"base-url",
|
||||
browser.extension.getURL("").replace(/\/$/, "")
|
||||
browser.runtime.getURL("").replace(/\/$/, "")
|
||||
);
|
||||
|
||||
browser.test.sendMessage("background-csp", window.getCSP());
|
||||
|
@ -47,6 +47,8 @@ add_task(async function test_contentscript() {
|
||||
},
|
||||
},
|
||||
});
|
||||
// Turn off warning as errors to pass for deprecated APIs
|
||||
ExtensionTestUtils.failOnSchemaWarnings(false);
|
||||
await extension.startup();
|
||||
|
||||
let contentPage = await ExtensionTestUtils.loadContentPage(
|
||||
@ -58,4 +60,5 @@ add_task(async function test_contentscript() {
|
||||
await contentPage.close();
|
||||
|
||||
await extension.unload();
|
||||
ExtensionTestUtils.failOnSchemaWarnings(true);
|
||||
});
|
||||
|
@ -44,9 +44,9 @@ async function test_counter() {
|
||||
});
|
||||
|
||||
// getURL() is done in the child, let do three
|
||||
browser.extension.getURL("beasts/frog.html");
|
||||
browser.extension.getURL("beasts/frog2.html");
|
||||
browser.extension.getURL("beasts/frog3.html");
|
||||
browser.runtime.getURL("beasts/frog.html");
|
||||
browser.runtime.getURL("beasts/frog2.html");
|
||||
browser.runtime.getURL("beasts/frog3.html");
|
||||
browser.test.sendMessage("done");
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ add_task(async function test_permissions() {
|
||||
browser.test.onMessage.addListener(async (method, arg) => {
|
||||
if (method == "getAll") {
|
||||
let perms = await browser.permissions.getAll();
|
||||
let url = browser.extension.getURL("*");
|
||||
let url = browser.runtime.getURL("*");
|
||||
perms.origins = perms.origins.filter(i => i != url);
|
||||
browser.test.sendMessage("getAll.result", perms);
|
||||
} else if (method == "contains") {
|
||||
@ -349,7 +349,7 @@ add_task(async function test_startup() {
|
||||
});
|
||||
|
||||
let all = await browser.permissions.getAll();
|
||||
let url = browser.extension.getURL("*");
|
||||
let url = browser.runtime.getURL("*");
|
||||
all.origins = all.origins.filter(i => i != url);
|
||||
browser.test.sendMessage("perms", all);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ function getExtension(
|
||||
if (!background) {
|
||||
background = () => {
|
||||
// send the extensions public uri to the test.
|
||||
let exturi = browser.extension.getURL("finished.html");
|
||||
let exturi = browser.runtime.getURL("finished.html");
|
||||
browser.test.sendMessage("redirectURI", exturi);
|
||||
};
|
||||
}
|
||||
@ -475,8 +475,8 @@ add_task(async function test_extension_302_redirect_tracing() {
|
||||
// disabled due to NS_BINDING_ABORTED happening.
|
||||
add_task(async function test_extension_302_redirect() {
|
||||
let extension = getExtension(true, () => {
|
||||
let myuri = browser.extension.getURL("*");
|
||||
let exturi = browser.extension.getURL("finished.html");
|
||||
let myuri = browser.runtime.getURL("*");
|
||||
let exturi = browser.runtime.getURL("finished.html");
|
||||
browser.webRequest.onBeforeRedirect.addListener(
|
||||
details => {
|
||||
browser.test.assertEq(details.redirectUrl, exturi, "redirect matches");
|
||||
@ -521,8 +521,8 @@ add_task(async function test_extension_302_redirect() {
|
||||
// Currently disabled due to NS_BINDING_ABORTED happening.
|
||||
add_task(async function test_extension_redirect() {
|
||||
let extension = getExtension(true, () => {
|
||||
let myuri = browser.extension.getURL("*");
|
||||
let exturi = browser.extension.getURL("finished.html");
|
||||
let myuri = browser.runtime.getURL("*");
|
||||
let exturi = browser.runtime.getURL("finished.html");
|
||||
browser.webRequest.onBeforeRequest.addListener(
|
||||
details => {
|
||||
return { redirectUrl: exturi };
|
||||
|
@ -42,7 +42,7 @@ add_task(
|
||||
});
|
||||
|
||||
let anotherFrame = document.createElement("iframe");
|
||||
anotherFrame.src = browser.extension.getURL("extensionpage.html");
|
||||
anotherFrame.src = browser.runtime.getURL("extensionpage.html");
|
||||
document.body.appendChild(anotherFrame);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ add_task(async function test_xhr_capabilities() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
background() {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", browser.extension.getURL("bad.xml"));
|
||||
xhr.open("GET", browser.runtime.getURL("bad.xml"));
|
||||
|
||||
browser.test.sendMessage("result", {
|
||||
name: "Background script XHRs should not be privileged",
|
||||
@ -37,7 +37,7 @@ add_task(async function test_xhr_capabilities() {
|
||||
"bad.xml": "<xml",
|
||||
"content_script.js"() {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", browser.extension.getURL("bad.xml"));
|
||||
xhr.open("GET", browser.runtime.getURL("bad.xml"));
|
||||
|
||||
browser.test.sendMessage("result", {
|
||||
name: "Content script XHRs should not be privileged",
|
||||
|
@ -59,7 +59,7 @@ const EXTENSION_DATA = {
|
||||
async details => {
|
||||
browser.test.log("webRequest onBeforeRequest");
|
||||
let isRedirect =
|
||||
details.originUrl == browser.extension.getURL("redirect.html") &&
|
||||
details.originUrl == browser.runtime.getURL("redirect.html") &&
|
||||
details.url.endsWith("print_postdata.sjs");
|
||||
let url = this.extUrl ? this.extUrl : details.url + "?redirected";
|
||||
return isRedirect ? { redirectUrl: url } : {};
|
||||
|
@ -10,9 +10,9 @@ add_task(async function setup() {
|
||||
function backgroundGetSelf() {
|
||||
browser.management.getSelf().then(
|
||||
extInfo => {
|
||||
let url = browser.extension.getURL("*");
|
||||
let url = browser.runtime.getURL("*");
|
||||
extInfo.hostPermissions = extInfo.hostPermissions.filter(i => i != url);
|
||||
extInfo.url = browser.extension.getURL("");
|
||||
extInfo.url = browser.runtime.getURL("");
|
||||
browser.test.sendMessage("management-getSelf", extInfo);
|
||||
},
|
||||
error => {
|
||||
|
Loading…
Reference in New Issue
Block a user