mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 23:37:33 +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,72 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>WebExtension test</title>
|
||||
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script>
|
||||
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/ExtensionTestUtils.js"></script>
|
||||
<script type="text/javascript" src="chrome_head.js"></script>
|
||||
<script type="text/javascript" src="head.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
add_task(function* test_cookies_expiry() {
|
||||
function background() {
|
||||
let expectedEvents = [];
|
||||
|
||||
browser.cookies.onChanged.addListener(event => {
|
||||
expectedEvents.push(`${event.removed}:${event.cause}`);
|
||||
if (expectedEvents.length === 1) {
|
||||
browser.test.assertEq("true:expired", expectedEvents[0], "expired cookie removed");
|
||||
browser.test.assertEq("first", event.cookie.name, "expired cookie has the expected name");
|
||||
browser.test.assertEq("one", event.cookie.value, "expired cookie has the expected value");
|
||||
} else {
|
||||
browser.test.assertEq("false:explicit", expectedEvents[1], "new cookie added");
|
||||
browser.test.assertEq("first", event.cookie.name, "new cookie has the expected name");
|
||||
browser.test.assertEq("one-again", event.cookie.value, "new cookie has the expected value");
|
||||
browser.test.notifyPass("cookie-expiry");
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
browser.test.sendMessage("change-cookies");
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
let domain = ".example.com";
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["http://example.com/", "cookies"],
|
||||
},
|
||||
background,
|
||||
});
|
||||
|
||||
let cookieSvc = SpecialPowers.Services.cookies;
|
||||
|
||||
let cookie = {
|
||||
host: domain,
|
||||
name: "first",
|
||||
path: "/",
|
||||
};
|
||||
|
||||
do {
|
||||
cookieSvc.add(cookie.host, cookie.path, cookie.name, "one", false, false, false, Date.now() / 1000 + 1);
|
||||
} while (!cookieSvc.cookieExists(cookie));
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitMessage("change-cookies");
|
||||
|
||||
cookieSvc.add(cookie.host, cookie.path, cookie.name, "one-again", false, false, false, Date.now() / 1000 + 10);
|
||||
|
||||
yield extension.awaitFinish("cookie-expiry");
|
||||
yield extension.unload();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue