blob: 9e46bec0713121d8c724955bdd8408d98c92f5a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<html>
<head>
<script src="resources/clearLocalStorage.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function log(a)
{
document.getElementById("logger").innerHTML += a + "<br>";
}
function runTest()
{
if (!window.localStorage) {
log("window.localStorage DOES NOT exist");
return;
}
if (!window.layoutTestController) {
log("Test only designed to be run under DumpRenderTree");
return;
}
localStorage.setItem("testItem", "InitialValue");
layoutTestController.setPrivateBrowsingEnabled(true);
log("Initial value of testItem is: " + localStorage.getItem("testItem"));
try {
localStorage.setItem("testItem", "ChangedValue");
} catch(e) {
log("Caught exception trying to change item: " + e);
}
log("After change attempt, testItem is: " + localStorage.getItem("testItem"));
localStorage.removeItem("testItem");
log("After remove attempt, testItem is: " + localStorage.getItem("testItem"));
localStorage.clear();
log("After clear attempt, testItem is: " + localStorage.getItem("testItem"));
}
</script>
</head>
<body onload="runTest();">
This is a test to make sure that when private browsing is on any attempt to change the localStorage area fail.
<div id="logger"></div>
</body>
</html>
|