Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- Manifest: dom/workers/test/browser.toml
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
"use strict";
const EMPTY_URL = "/browser/dom/workers/test/empty.html";
const WORKER_URL = "/browser/dom/workers/test/empty_worker.js";
add_task(async function () {
let tab = BrowserTestUtils.addTab(
gBrowser,
);
gBrowser.selectedTab = tab;
let browser = gBrowser.getBrowserForTab(tab);
await BrowserTestUtils.browserLoaded(browser);
await SpecialPowers.spawn(
browser,
function (spec) {
return new content.Promise((resolve, reject) => {
let w = new content.window.Worker(spec);
w.onerror = _ => {
resolve();
};
w.onmessage = _ => {
reject();
};
});
}
);
ok(
true,
"The worker is not loaded when the script is from different origin."
);
BrowserTestUtils.removeTab(tab);
});
add_task(async function () {
let tab = BrowserTestUtils.addTab(
gBrowser,
);
gBrowser.selectedTab = tab;
let browser = gBrowser.getBrowserForTab(tab);
await BrowserTestUtils.browserLoaded(browser);
await SpecialPowers.spawn(
browser,
function (spec) {
return new content.Promise((resolve, reject) => {
let w = new content.window.Worker(spec);
w.onerror = _ => {
resolve();
};
w.onmessage = _ => {
reject();
};
});
}
);
ok(
true,
"The worker is not loaded when the script is from different origin."
);
BrowserTestUtils.removeTab(tab);
});