summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html')
-rw-r--r--dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html112
1 files changed, 112 insertions, 0 deletions
diff --git a/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html b/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html
new file mode 100644
index 000000000..585da7ceb
--- /dev/null
+++ b/dom/tests/mochitest/localstorage/test_localStorageQuotaSessionOnly.html
@@ -0,0 +1,112 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>localStorage and DOM quota test</title>
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="interOriginTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+
+<script type="text/javascript">
+
+var currentTest = 1;
+
+function doNextTest()
+{
+ slave = frame;
+
+ switch (currentTest)
+ {
+ case 1:
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&A&success";
+ break;
+
+ // In subdomain now set another key with length 500 bytes, i.e.
+ // allocate 501 bytes
+ case 2:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&B&success";
+ break;
+
+ // Try to set the same key value again to check we don't fail
+ // even 1002 bytes has already been exhausted from the quota
+ // We just change the value of an existing key.
+ case 3:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&B&success";
+ break;
+
+ // Try to set the same key to a larger value that would lead to
+ // quota reach and check that the value is still the old one
+ case 4:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add2&B&failure";
+ break;
+
+ // In a different subdomain try to set a new 500 bytes key
+ // and check we fail because we are over the quota
+ case 5:
+ slaveOrigin = "https://test2.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&C&failure";
+ break;
+
+ // Remove from the second subdomain the second key, it must not fail
+ // This should release the allocated space of the quota assigned to
+ // example.com.
+ case 6:
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?remove&B&success";
+ break;
+
+ // Now try again to set 500 bytes key, it must succeed.
+ case 7:
+ slaveOrigin = "https://test2.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&C&success";
+ break;
+
+ case 8:
+ // Do a clean up...
+ slaveOrigin = "http://example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
+ break;
+
+ case 9:
+ // Do a clean up...
+ slaveOrigin = "http://test1.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
+ break;
+
+ case 10:
+ // Do a clean up...
+ slaveOrigin = "https://test2.example.com";
+ slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
+ break;
+
+ default:
+ SimpleTest.finish();
+ }
+
+ ++currentTest;
+}
+
+function doStep()
+{
+}
+
+SimpleTest.waitForExplicitFinish();
+
+function startTest() {
+ SpecialPowers.pushPermissions([{'type': 'cookie', 'allow': SpecialPowers.Ci.nsICookiePermission.ACCESS_SESSION, 'context': document}], function() {
+ // Initialy setup the quota to testing value of 1024B and
+ // set a 500 bytes key with name length 1 (allocate 501 bytes)
+ SpecialPowers.pushPrefEnv({"set": [["dom.storage.default_quota", 1], ["security.mixed_content.block_display_content", false], ["security.mixed_content.block_active_content", false]]}, doNextTest);
+ });
+}
+</script>
+
+</head>
+
+<body onload="startTest();">
+ <iframe src="" name="frame"></iframe>
+</body>
+</html>