gecko/dom/tests/mochitest/localstorage/test_cookieBlock.html
Bobby Holley 5af5a73d3d Bug 792036 - Automated fixups. r=mccr8
find /files/mozilla/build/d/_tests/testing/mochitest/tests/ | egrep "\.(xhtml|html|xml|js)$" | grep -v SimpleTest | grep -vi mochikit | grep -v simpleThread | grep -v test_ipc_messagemanager_blob.html | grep -v "indexedDB/test" | xargs grep -l Components |  xargs grep -L enablePrivilege | perl -pe 's#.*mochitest/tests/##' | xargs perl -p -i.bakkk -e 's/Components\.interfaces(\s|;|\.|\[)/SpecialPowers\.Ci$1/g, s/SpecialPowers\.wrap\(Components\)\.(.)(lasses|tils|nterfaces|esults)/SpecialPowers.C$1/g, s/(?<![\.a-zA-Z])Components/SpecialPowers\.Components/g, s/window\.Components/window\.SpecialPowers\.Components/g'
2012-09-24 14:46:29 +02:00

51 lines
1.2 KiB
HTML

<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()
{
var io = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
.getService(SpecialPowers.Ci.nsIIOService);
var uri = io.newURI(window.location, "", null);
var cp = SpecialPowers.Cc["@mozilla.org/cookie/permission;1"]
.getService(SpecialPowers.Ci.nsICookiePermission);
cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_DENY);
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");
}
cp.setAccess(uri, SpecialPowers.Ci.nsICookiePermission.ACCESS_DEFAULT);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
</script>
</head>
<body onload="startTest();">
</body>
</html>