summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/localstorage/test_cookieBlock.html
blob: c95cbca497841350ed674dcf87a263eee9e55cc2 (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
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>cookie blocking 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">

function startTest()
{
  try {
    localStorage.setItem("blocked", "blockedvalue");
    ok(false, "Exception for localStorage.setItem, ACCESS_DENY");
  }
  catch (ex) {
    ok(true, "Exception for localStorage.setItem, ACCESS_DENY");
  }

  try {
    localStorage.getItem("blocked");
    ok(false, "Exception for localStorage.getItem, ACCESS_DENY");
  }
  catch (ex) {
    ok(true, "Exception for localStorage.getItem, ACCESS_DENY");
  }

  SimpleTest.finish();
}

SimpleTest.waitForExplicitFinish();

SpecialPowers.pushPermissions([{'type': 'cookie', 'allow': false, 'context': document}], startTest);

</script>

</head>

<body>

</body>
</html>