OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
4 for details. All rights reserved. Use of this source code is governed by a | 4 for details. All rights reserved. Use of this source code is governed by a |
5 BSD-style license that can be found in the LICENSE file. | 5 BSD-style license that can be found in the LICENSE file. |
6 --> | 6 --> |
7 <html lang="en"> | 7 <html lang="en"> |
8 <head> | 8 <head> |
9 <meta charset="utf-8"> | 9 <meta charset="utf-8"> |
10 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 10 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
11 <script type="application/javascript" src="testing.js"></script> | 11 <script type="application/javascript" src="testing.js"></script> |
12 </head> | 12 </head> |
13 <body> | 13 <body> |
14 <!-- Tests that you can inject any URL using SafeUri. --> | 14 <!-- Tests that you can inject any URL using SafeUri. --> |
15 Expect 1 console message: "m2", there should be no message for m1, m3, m4 | 15 Expect 1 console message: "m2", there should be no message for m1, m3, m4 |
16 <a href="{{m1}}"></a> | 16 <a href="{{m1}}"></a> |
17 <a href="{{m2}}"></a> | 17 <a href="{{m2}}"></a> |
18 <a href="javascript:{{m3}}"></a> | 18 <a href="javascript:{{m3}}"></a> |
19 <a href="javascript:{{m4}}"></a> | 19 <a href="javascript:{{m4}}"></a> |
20 <script type="application/dart"> | 20 <script type="application/dart"> |
| 21 @observable library main; |
21 import 'dart:html'; | 22 import 'dart:html'; |
22 import 'package:web_ui/safe_html.dart'; | 23 import 'package:web_ui/safe_html.dart'; |
23 | 24 |
24 var m1 = 'javascript:window.console.log("m1")'; | 25 var m1 = 'javascript:window.console.log("m1")'; |
25 var m2 = new SafeUri.unsafe('javascript:window.console.log("m2")'); | 26 var m2 = new SafeUri.unsafe('javascript:window.console.log("m2")'); |
26 var m3 = 'window.console.log("m3")'; | 27 var m3 = 'window.console.log("m3")'; |
27 var m4 = new SafeUri.unsafe('window.console.log("m4")'); | 28 var m4 = new SafeUri.unsafe('window.console.log("m4")'); |
28 var html = new SafeHtml.unsafe('<span>hello</span>'); | 29 var html = new SafeHtml.unsafe('<span>hello</span>'); |
29 main() { | 30 main() { |
30 window.setTimeout(() { | 31 window.setTimeout(() { |
31 document.queryAll('a').forEach((tag) { | 32 document.queryAll('a').forEach((tag) { |
32 tag.dispatchEvent(new MouseEvent('click', detail: 1)); | 33 tag.dispatchEvent(new MouseEvent('click', detail: 1)); |
33 }); | 34 }); |
34 | 35 |
35 window.setTimeout(() => window.postMessage('done', '*'), 0); | 36 window.setImmediate(() => window.postMessage('done', '*')); |
36 }, 0); | 37 }, 0); |
37 } | 38 } |
38 </script> | 39 </script> |
39 </body> | 40 </body> |
40 </html> | 41 </html> |
OLD | NEW |