summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/localstorage/test_localStorageSessionPrefOverride.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/tests/mochitest/localstorage/test_localStorageSessionPrefOverride.html')
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageSessionPrefOverride.html54
1 files changed, 54 insertions, 0 deletions
diff --git a/dom/tests/mochitest/localstorage/test_localStorageSessionPrefOverride.html b/dom/tests/mochitest/localstorage/test_localStorageSessionPrefOverride.html
new file mode 100644
index 000000000..9fe6a48ec
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageSessionPrefOverride.html
@@ -0,0 +1,54 @@
+<html>
+ <head>
+ <title>Local Storage Session Pref Override</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <script>
+ const ACCEPT_SESSION = 2;
+
+ add_task(function*() {
+ yield new Promise((resolve, reject) => {
+ SpecialPowers.pushPrefEnv({"set": [["network.cookie.lifetimePolicy",
+ ACCEPT_SESSION]]},
+ resolve);
+ });
+
+ // Before setting permission
+ yield new Promise((resolve) => {
+ var frame = document.createElement('iframe');
+ frame.src = "frameLocalStorageSessionOnly.html";
+
+ var listener = (e) => {
+ is(e.data, true, "Before adding permission should be session only");
+ window.removeEventListener('message', listener);
+ resolve();
+ };
+ window.addEventListener('message', listener);
+ document.body.appendChild(frame);
+ });
+
+ // After setting permission
+ yield new Promise((resolve) => {
+ SpecialPowers.pushPermissions([{"type": "cookie", "allow": 1, "context": document}],
+ resolve);
+ });
+
+ yield new Promise((resolve) => {
+ var frame = document.createElement('iframe');
+ frame.src = "frameLocalStorageSessionOnly.html";
+
+ var listener = (e) => {
+ is(e.data, false, "After adding permission should not be session only");
+ window.removeEventListener('message', listener);
+ resolve();
+ };
+ window.addEventListener('message', listener);
+ document.body.appendChild(frame);
+ });
+ });
+ </script>
+ </head>
+ <body>
+ </body>
+</html>