Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: appname == 'thunderbird' OR os == 'android' OR os == 'mac' && debug OR socketprocess_networking && fission OR os == 'linux' && socketprocess_networking && !fission && debug
- Manifest: toolkit/components/extensions/test/xpcshell/xpcshell-e10s.toml includes toolkit/components/extensions/test/xpcshell/xpcshell-content.toml
- Manifest: toolkit/components/extensions/test/xpcshell/xpcshell-remote.toml includes toolkit/components/extensions/test/xpcshell/xpcshell-content.toml
- Manifest: toolkit/components/extensions/test/xpcshell/xpcshell.toml includes toolkit/components/extensions/test/xpcshell/xpcshell-content.toml
"use strict";
// ExtensionContent.sys.mjs needs to know when it's running from xpcshell,
// to use the right timeout for content scripts executed at document_idle.
ExtensionTestUtils.mockAppInfo();
const server = createHttpServer();
server.registerDirectory("/data/", do_get_file("data"));
add_task(async function test_contentscript_xrays() {
async function contentScript() {
let unwrapped = window.wrappedJSObject;
browser.test.assertEq(
"undefined",
typeof test,
"Should not have named X-ray property access"
);
browser.test.assertEq(
undefined,
window.test,
"Should not have named X-ray property access"
);
browser.test.assertEq(
"object",
typeof unwrapped.test,
"Should always have non-X-ray named property access"
);
browser.test.notifyPass("contentScriptXrays");
}
let extension = ExtensionTestUtils.loadExtension({
manifest: {
content_scripts: [
{
js: ["content_script.js"],
},
],
},
files: {
"content_script.js": contentScript,
},
});
await extension.startup();
let contentPage = await ExtensionTestUtils.loadContentPage(
`${BASE_URL}/file_sample.html`
);
await extension.awaitFinish("contentScriptXrays");
await contentPage.close();
await extension.unload();
});