mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
50 lines
1.2 KiB
HTML
50 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">
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
|
|
|
|
|
// Set cookies behavior to "always reject".
|
|
Services.prefs.setIntPref("network.cookie.cookieBehavior", 2);
|
|
try {
|
|
localStorage.setItem("contentkey", "test-value");
|
|
ok(false, "Setting localStorageItem should throw a security exception");
|
|
}
|
|
catch(ex) {
|
|
is(ex.name, "SecurityError");
|
|
}
|
|
|
|
try {
|
|
Services.prefs.clearUserPref("network.cookie.cookieBehavior");
|
|
}
|
|
catch (ex) {}
|
|
|
|
|
|
// Set cookies behavior to "ask every time".
|
|
Services.prefs.setIntPref("network.cookie.lifetimePolicy", 1);
|
|
try {
|
|
localStorage.setItem("contentkey", "test-value");
|
|
ok(false, "Setting localStorageItem should throw a security exception");
|
|
}
|
|
catch(ex) {
|
|
is(ex.name, "SecurityError");
|
|
}
|
|
|
|
try {
|
|
Services.prefs.clearUserPref("network.cookie.lifetimePolicy");
|
|
}
|
|
catch (ex) {}
|
|
|
|
</script>
|
|
</head>
|
|
<body>
|
|
</body>
|
|
</html>
|