tizen beta release
[profile/ivi/webkit-efl.git] / LayoutTests / fast / frames / resources / sandboxed-iframe-storage-disallowed.html
1 <html>
2 <head>
3 <script>
4 if (window.layoutTestController)
5     layoutTestController.dumpAsText();
6
7 function debug(msg)
8 {
9     var span = document.createElement("span");
10     document.getElementById("console").appendChild(span);
11     span.innerHTML = msg + '<br />';
12 }
13
14 function escapeHTML(text)
15 {
16     return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\0/g, "\\0");
17 }
18
19 function testPassed(msg)
20 {
21     debug('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
22 }
23
24 function testFailed(msg)
25 {
26     debug('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
27 }
28
29 function shouldThrow(_a, _e)
30 {
31   var exception;
32   var _av;
33   try {
34      _av = eval(_a);
35   } catch (e) {
36      exception = e;
37   }
38
39   var _ev;
40   if (_e)
41       _ev =  eval(_e);
42
43   if (exception) {
44     if (typeof _e == "undefined" || exception == _ev)
45       testPassed(_a + " threw exception " + exception + ".");
46     else
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.");
50   else
51     testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
52 }
53 </script>
54 <script>
55
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'");
60 }
61
62 </script>
63 </head>
64 <body>
65     <div id="console"></div>
66 </body>
67 </html>