4 if (window.layoutTestController)
5 layoutTestController.dumpAsText();
9 var span = document.createElement("span");
10 document.getElementById("console").appendChild(span);
11 span.innerHTML = msg + '<br />';
14 function escapeHTML(text)
16 return text.replace(/&/g, "&").replace(/</g, "<").replace(/\0/g, "\\0");
19 function testPassed(msg)
21 debug('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
24 function testFailed(msg)
26 debug('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
29 function shouldThrow(_a, _e)
44 if (typeof _e == "undefined" || exception == _ev)
45 testPassed(_a + " threw exception " + exception + ".");
47 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Threw exception " + exception + ".");
48 } else if (typeof _av == "undefined")
49 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined.");
51 testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
56 window.onload = function() {
57 shouldThrow("window.openDatabase('SandboxedIframeStorageDisallowed', '1.0', '', 1)", "'Error: SECURITY_ERR: DOM Exception 18'");
58 shouldThrow("window.localStorage", "'Error: SECURITY_ERR: DOM Exception 18'");
59 shouldThrow("window.sessionStorage", "'Error: SECURITY_ERR: DOM Exception 18'");
65 <div id="console"></div>