| OLD | NEW |
| (Empty) | |
| 1 <html> |
| 2 <body> |
| 3 |
| 4 <script> |
| 5 if (window.testRunner) { |
| 6 window.testRunner.dumpAsText(); |
| 7 window.testRunner.waitUntilDone(); |
| 8 } |
| 9 </script> |
| 10 |
| 11 <div id="dart"> |
| 12 import 'dart:js'; |
| 13 import 'dart:html'; |
| 14 |
| 15 var retainDocument; |
| 16 var retainCustom; |
| 17 |
| 18 void main() { |
| 19 retainDocument = document; |
| 20 retainCustom = querySelector('#custom'); |
| 21 window.postMessage('hello', '*', []); |
| 22 } |
| 23 </div> |
| 24 |
| 25 <x-custom id="custom"></x-custom> |
| 26 |
| 27 <script type="application/dart"> |
| 28 import 'dart:html'; |
| 29 import 'dart:isolate'; |
| 30 import 'dart:js'; |
| 31 |
| 32 class XCustom extends HtmlElement { |
| 33 static final tag = 'x-custom'; |
| 34 factory XCustom() => new Element.tag(tag); |
| 35 XCustom.created() : super.created(); |
| 36 String toString() => "This is custom"; |
| 37 } |
| 38 |
| 39 var hellos = 0; |
| 40 void main() { |
| 41 window.onMessage.listen((Event event) { |
| 42 if (event.data == 'hello') { |
| 43 hellos++; |
| 44 print("Hello World $hellos"); |
| 45 if (hellos == 3) { |
| 46 var custom = querySelector('#custom'); |
| 47 var upgrader = document.createElementUpgrader(XCustom); |
| 48 upgrader.upgrade(custom); |
| 49 print(custom); |
| 50 custom = querySelector('#custom'); |
| 51 print(custom); |
| 52 context['testRunner'].callMethod('notifyDone', []); |
| 53 } |
| 54 } |
| 55 }); |
| 56 |
| 57 var code = querySelector('#dart'); |
| 58 var dataUri = 'data:application/dart;base64,${window.btoa(code.text)}'; |
| 59 try { |
| 60 Future<Isolate> isolate1 = spawnDomUri(Uri.parse(dataUri), [], null); |
| 61 Future<Isolate> isolate2 = spawnDomUri(Uri.parse(dataUri), [], null); |
| 62 Future<Isolate> isolate3 = spawnDomUri(Uri.parse(dataUri), [], null); |
| 63 } catch (e) { |
| 64 print("Spawn failed: $e"); |
| 65 context['testRunner'].callMethod('notifyDone', []); |
| 66 } |
| 67 code.remove(); |
| 68 } |
| 69 </script> |
| 70 |
| 71 </body> |
| 72 </html> |
| OLD | NEW |