diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2014-05-21 11:38:25 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2014-05-21 11:38:25 +0200 |
commit | d25ba7d760b017b038e5aa6c0a605b4a330eb68d (patch) | |
tree | 16ec27edc7d5f83986f16236d3a36a2682a0f37e /dom/tests/mochitest/localstorage/test_localStorageCookieSettings.html | |
parent | a942906574671868daf122284a9c4689e6924f74 (diff) | |
download | palemoon-gre-d25ba7d760b017b038e5aa6c0a605b4a330eb68d.tar.gz |
Recommit working copy to repo with proper line endings.
Diffstat (limited to 'dom/tests/mochitest/localstorage/test_localStorageCookieSettings.html')
-rw-r--r-- | dom/tests/mochitest/localstorage/test_localStorageCookieSettings.html | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/dom/tests/mochitest/localstorage/test_localStorageCookieSettings.html b/dom/tests/mochitest/localstorage/test_localStorageCookieSettings.html new file mode 100644 index 000000000..7298514fc --- /dev/null +++ b/dom/tests/mochitest/localstorage/test_localStorageCookieSettings.html @@ -0,0 +1,47 @@ +<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"> + +window.Services = SpecialPowers.Services; + +// 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> |