OLD | NEW |
| (Empty) |
1 <html> | |
2 <body> | |
3 | |
4 <div id='foo'></div> | |
5 | |
6 <script type="application/dart"> | |
7 #import("dart:dom"); | |
8 | |
9 void main() { | |
10 if (null !== layoutTestController) { | |
11 layoutTestController.dumpAsText(); | |
12 } | |
13 log("window.document: $document"); | |
14 // FIXME: move into separate HTMLDocument test. | |
15 HTMLElement foo = document.getElementById('foo'); | |
16 log("window.document.getElementById('foo'): $foo"); | |
17 HTMLElement missing = document.getElementById('missing_id'); | |
18 log("window.document.getElementById('missing_id'): $missing"); | |
19 bool closed = window.closed; | |
20 log("window.closed: $closed"); | |
21 window.name = "WindowAttr"; | |
22 String name = window.name; | |
23 log("window.name: '$name'"); | |
24 mustThrow("window.name = 239", function() { window.name = 239; }); | |
25 // Note: later we may rethink it and treat null as allowed value. | |
26 mustThrow("window.name = null", function() { window.name = null; }); | |
27 mustThrow("window.onload = 239", function() { window.onload = 239; }); | |
28 log("PASS"); | |
29 } | |
30 | |
31 void mustThrow(String snippet, void code()) { | |
32 // FIXME: re-enable when we don't immediately output exceptions into stdout. | |
33 return; | |
34 try { | |
35 code(); | |
36 log("FAILED: $snippet should have thrown"); | |
37 } catch(var e) { | |
38 log("$snippet threw $e"); | |
39 } | |
40 } | |
41 | |
42 void log(String msg) { | |
43 HTMLElement element = document.createElement('div'); | |
44 element.innerHTML = msg; | |
45 document.body.appendChild(element); | |
46 } | |
47 </script> | |
48 | |
49 <script> | |
50 // Fake script to trigger Dart execution. | |
51 </script> | |
52 | |
53 </body> | |
54 </html> | |
OLD | NEW |