Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'win' && socketprocess_networking && fission OR os == 'mac' && socketprocess_networking && fission OR os == 'mac' && debug OR os == 'linux' && socketprocess_networking
- Manifest: toolkit/components/extensions/test/xpcshell/xpcshell-remote.toml includes toolkit/components/extensions/test/xpcshell/xpcshell-common.toml
- Manifest: toolkit/components/extensions/test/xpcshell/xpcshell.toml includes toolkit/components/extensions/test/xpcshell/xpcshell-common.toml
"use strict";
const server = createHttpServer();
server.registerDirectory("/data/", do_get_file("data"));
function contentScript() {
window.x = 12;
browser.test.assertEq(window.x, 12, "x is 12");
browser.test.notifyPass("background test passed");
}
let extensionData = {
manifest: {
content_scripts: [
{
js: ["content_script.js"],
run_at: "document_idle",
},
],
},
files: {
"content_script.js": contentScript,
},
};
add_task(async function test_contentscript() {
let extension = ExtensionTestUtils.loadExtension(extensionData);
await extension.startup();
let contentPage = await ExtensionTestUtils.loadContentPage(
`${BASE_URL}/file_sample.html`
);
await extension.awaitFinish();
await contentPage.close();
await extension.unload();
});