mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-21 15:57:31 +09:00
Rename Toolkit's webextensions component directory to better reflect what it is.
This commit is contained in:
parent
6955450f7a
commit
d7d16e7fbb
242 changed files with 4 additions and 2 deletions
|
|
@ -1,140 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>clipboard permission test</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="/tests/SimpleTest/SpawnTask.js"></script>
|
||||
<script src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
|
||||
<script src="head.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
function doCopy(txt) {
|
||||
let field = document.createElement("textarea");
|
||||
document.body.appendChild(field);
|
||||
field.value = txt;
|
||||
field.select();
|
||||
return document.execCommand("copy");
|
||||
}
|
||||
|
||||
add_task(function* no_permission_deny_copy() {
|
||||
function backgroundScript() {
|
||||
browser.test.assertEq(false, doCopy("whatever"),
|
||||
"copy should be denied without permission");
|
||||
browser.test.sendMessage("ready");
|
||||
}
|
||||
let extensionData = {
|
||||
background: `${doCopy};(${backgroundScript})();`,
|
||||
};
|
||||
let extension = ExtensionTestUtils.loadExtension(extensionData);
|
||||
yield extension.startup();
|
||||
|
||||
yield extension.awaitMessage("ready");
|
||||
|
||||
yield extension.unload();
|
||||
});
|
||||
|
||||
/** Selecting text in a bg page is not possible, skip test until it's fixed.
|
||||
add_task(function* with_permission_allow_copy() {
|
||||
function backgroundScript() {
|
||||
browser.test.onMessage.addListener(txt => {
|
||||
browser.test.assertEq(true, doCopy(txt),
|
||||
"copy should be allowed with permission");
|
||||
});
|
||||
browser.test.sendMessage("ready");
|
||||
}
|
||||
let extensionData = {
|
||||
background: `${doCopy};(${backgroundScript})();`,
|
||||
manifest: {
|
||||
permissions: [
|
||||
"clipboardWrite",
|
||||
],
|
||||
},
|
||||
};
|
||||
let extension = ExtensionTestUtils.loadExtension(extensionData);
|
||||
yield extension.startup();
|
||||
yield extension.awaitMessage("ready");
|
||||
|
||||
const DUMMY_STR = "dummy string to copy";
|
||||
yield new Promise(resolve => {
|
||||
SimpleTest.waitForClipboard(DUMMY_STR, () => {
|
||||
extension.sendMessage(DUMMY_STR);
|
||||
}, resolve, resolve);
|
||||
});
|
||||
|
||||
yield extension.unload();
|
||||
}); */
|
||||
|
||||
add_task(function* content_script_no_permission_deny_copy() {
|
||||
function contentScript() {
|
||||
browser.test.assertEq(false, doCopy("whatever"),
|
||||
"copy should be denied without permission");
|
||||
browser.test.sendMessage("ready");
|
||||
}
|
||||
let extensionData = {
|
||||
manifest: {
|
||||
content_scripts: [{
|
||||
js: ["contentscript.js"],
|
||||
matches: ["http://mochi.test/*/file_sample.html"],
|
||||
}],
|
||||
},
|
||||
files: {
|
||||
"contentscript.js": `${doCopy};(${contentScript})();`,
|
||||
},
|
||||
};
|
||||
let extension = ExtensionTestUtils.loadExtension(extensionData);
|
||||
yield extension.startup();
|
||||
|
||||
let win = window.open("file_sample.html");
|
||||
yield extension.awaitMessage("ready");
|
||||
win.close();
|
||||
|
||||
yield extension.unload();
|
||||
});
|
||||
|
||||
add_task(function* content_script_with_permission_allow_copy() {
|
||||
function contentScript() {
|
||||
browser.test.onMessage.addListener(txt => {
|
||||
browser.test.assertEq(true, doCopy(txt),
|
||||
"copy should be allowed with permission");
|
||||
});
|
||||
browser.test.sendMessage("ready");
|
||||
}
|
||||
let extensionData = {
|
||||
manifest: {
|
||||
content_scripts: [{
|
||||
js: ["contentscript.js"],
|
||||
matches: ["http://mochi.test/*/file_sample.html"],
|
||||
}],
|
||||
permissions: [
|
||||
"clipboardWrite",
|
||||
],
|
||||
},
|
||||
files: {
|
||||
"contentscript.js": `${doCopy};(${contentScript})();`,
|
||||
},
|
||||
};
|
||||
let extension = ExtensionTestUtils.loadExtension(extensionData);
|
||||
yield extension.startup();
|
||||
|
||||
let win = window.open("file_sample.html");
|
||||
yield extension.awaitMessage("ready");
|
||||
|
||||
const DUMMY_STR = "dummy string to copy in content script";
|
||||
yield new Promise(resolve => {
|
||||
SimpleTest.waitForClipboard(DUMMY_STR, () => {
|
||||
extension.sendMessage(DUMMY_STR);
|
||||
}, resolve, resolve);
|
||||
});
|
||||
|
||||
win.close();
|
||||
|
||||
yield extension.unload();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue