dom/tests/mochitest/localstorage/test_cookieBlock.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/localstorage/test_cookieBlock.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,42 @@
     1.4 +<html xmlns="http://www.w3.org/1999/xhtml">
     1.5 +<head>
     1.6 +<title>cookie blocking test</title>
     1.7 +
     1.8 +<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.10 +
    1.11 +<script type="text/javascript">
    1.12 +
    1.13 +function startTest()
    1.14 +{
    1.15 +  try {
    1.16 +    localStorage.setItem("blocked", "blockedvalue");
    1.17 +    ok(false, "Exception for localStorage.setItem, ACCESS_DENY");
    1.18 +  }
    1.19 +  catch (ex) {
    1.20 +    ok(true, "Exception for localStorage.setItem, ACCESS_DENY");
    1.21 +  }
    1.22 +
    1.23 +  try {
    1.24 +    localStorage.getItem("blocked");
    1.25 +    ok(false, "Exception for localStorage.getItem, ACCESS_DENY");
    1.26 +  }
    1.27 +  catch (ex) {
    1.28 +    ok(true, "Exception for localStorage.getItem, ACCESS_DENY");
    1.29 +  }
    1.30 +
    1.31 +  SimpleTest.finish();
    1.32 +}
    1.33 +
    1.34 +SimpleTest.waitForExplicitFinish();
    1.35 +
    1.36 +SpecialPowers.pushPermissions([{'type': 'cookie', 'allow': false, 'context': document}], startTest);
    1.37 +
    1.38 +</script>
    1.39 +
    1.40 +</head>
    1.41 +
    1.42 +<body>
    1.43 +
    1.44 +</body>
    1.45 +</html>

mercurial