blob: 768c843b0d553e9a86dc0b0c5261533b278c8ce2 [file] [log] [blame]
<html>
<head>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function debug(msg)
{
var span = document.createElement("span");
document.getElementById("console").appendChild(span);
span.innerHTML = msg + '<br />';
}
function escapeHTML(text)
{
return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\0/g, "\\0");
}
function testPassed(msg)
{
debug('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
}
function testFailed(msg)
{
debug('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
}
function shouldThrow(_a, _e)
{
var exception;
var _av;
try {
_av = eval(_a);
} catch (e) {
exception = e;
}
var _ev;
if (_e)
_ev = eval(_e);
if (exception) {
if (typeof _e == "undefined" || exception == _ev)
testPassed(_a + " threw exception " + exception + ".");
else
testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Threw exception " + exception + ".");
} else if (typeof _av == "undefined")
testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined.");
else
testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
}
</script>
<script>
window.onload = function() {
shouldThrow("window.openDatabase('SandboxedIframeStorageDisallowed', '1.0', '', 1)", "'SecurityError: The operation is insecure.'");
shouldThrow("window.localStorage", "'SecurityError: The operation is insecure.'");
shouldThrow("window.sessionStorage", "'SecurityError: The operation is insecure.'");
}
</script>
</head>
<body>
<div id="console"></div>
</body>
</html>