mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
33bb7b2d4d
--HG-- extra : rebase_source : 54036e1638d9de46d7ee0116d40e527046d0b26d
48 lines
1.2 KiB
HTML
48 lines
1.2 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>localStorage cookies settings test</title>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
<script type="text/javascript">
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
// Set cookies behavior to "always reject".
|
|
SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 2]]},
|
|
test1);
|
|
|
|
function test1() {
|
|
try {
|
|
localStorage.setItem("contentkey", "test-value");
|
|
ok(false, "Setting localStorageItem should throw a security exception");
|
|
}
|
|
catch(ex) {
|
|
is(ex.name, "SecurityError");
|
|
}
|
|
|
|
// Set cookies behavior to "ask every time".
|
|
SpecialPowers.pushPrefEnv({"set": [["network.cookie.lifetimePolicy", 1]],
|
|
"clear": [["network.cookie.cookieBehavior"]]},
|
|
test2);
|
|
}
|
|
|
|
function test2() {
|
|
try {
|
|
localStorage.setItem("contentkey", "test-value");
|
|
ok(false, "Setting localStorageItem should throw a security exception");
|
|
}
|
|
catch(ex) {
|
|
is(ex.name, "SecurityError");
|
|
}
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<body>
|
|
</body>
|
|
</html>
|