mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-31 03:38:36 +09:00
49 lines
1.3 KiB
HTML
49 lines
1.3 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>WebExtension test</title>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
|
|
<script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
|
|
<script type="text/javascript" src="head.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
|
|
<script type="text/javascript">
|
|
"use strict";
|
|
|
|
add_task(function* test_in_incognito_context_true() {
|
|
function background() {
|
|
browser.runtime.onMessage.addListener(msg => {
|
|
browser.test.assertEq(true, msg, "inIncognitoContext is true");
|
|
browser.test.notifyPass("inIncognitoContext");
|
|
});
|
|
|
|
browser.windows.create({url: browser.runtime.getURL("/tab.html"), incognito: true});
|
|
}
|
|
|
|
function tabScript() {
|
|
browser.runtime.sendMessage(browser.extension.inIncognitoContext);
|
|
}
|
|
|
|
let extension = ExtensionTestUtils.loadExtension({
|
|
background,
|
|
files: {
|
|
"tab.js": tabScript,
|
|
"tab.html": `<!DOCTYPE html><html><head>
|
|
<meta charset="utf-8">
|
|
<script src="tab.js"><\/script>
|
|
</head></html>`,
|
|
},
|
|
});
|
|
|
|
yield extension.startup();
|
|
yield extension.awaitFinish("inIncognitoContext");
|
|
yield extension.unload();
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|