| Index: LayoutTests/dart/multi-wrapper-test.html
|
| diff --git a/LayoutTests/dart/multi-wrapper-test.html b/LayoutTests/dart/multi-wrapper-test.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..aea2fd29bf17a8821a91f44d48ab3ac0dcdc00ab
|
| --- /dev/null
|
| +++ b/LayoutTests/dart/multi-wrapper-test.html
|
| @@ -0,0 +1,109 @@
|
| +<html>
|
| +<body>
|
| +
|
| +<script>
|
| +if (window.testRunner) {
|
| + window.testRunner.dumpAsText();
|
| + window.testRunner.waitUntilDone();
|
| +}
|
| +</script>
|
| +
|
| +<div id="dart">
|
| +import 'dart:js';
|
| +import 'dart:html';
|
| +
|
| +var retainDocument;
|
| +var retainCustom;
|
| +var retainCustomWithCallback;
|
| +var retainThrow;
|
| +
|
| +void main() {
|
| + retainDocument = document;
|
| + retainCustom = querySelector('#custom');
|
| + retainCustomWithCallback = querySelector('#callback');
|
| + retainThrow = querySelector('#throw');
|
| + window.postMessage('hello', '*', []);
|
| +}
|
| +</div>
|
| +
|
| +<x-custom id="custom"></x-custom>
|
| +<x-callback id="callback"></x-callback>
|
| +<x-throw id="throw"></x-throw>
|
| +
|
| +<script type="application/dart">
|
| +import 'dart:html';
|
| +import 'dart:isolate';
|
| +import 'dart:js';
|
| +
|
| +class XCustom extends HtmlElement {
|
| + static final tag = 'x-custom';
|
| + factory XCustom() => new Element.tag(tag);
|
| + XCustom.created() : super.created();
|
| + String toString() => "XCustom";
|
| +}
|
| +
|
| +class XCustomWithCallback extends HtmlElement {
|
| + static final tag = 'x-callback';
|
| + factory XCustomWithCallback() => new Element.tag(tag);
|
| + XCustomWithCallback.created() : super.created() {
|
| + print("During upgrade: ${querySelector('#callback')}");
|
| + }
|
| + String toString() => "XCustomWithCallback";
|
| +}
|
| +
|
| +class XThrow extends HtmlElement {
|
| + static final tag = 'x-throw';
|
| + factory XThrow() => new Element.tag(tag);
|
| + XThrow.created() : super.created() {
|
| + throw new Exception("XThrow throws");
|
| + }
|
| +}
|
| +
|
| +var earlyCustom;
|
| +var hellos = 0;
|
| +void main() {
|
| + window.onMessage.listen((Event event) {
|
| + if (event.data == 'hello') {
|
| + hellos++;
|
| + print("Hello World $hellos");
|
| + if (hellos == 3) {
|
| + var custom = querySelector('#custom');
|
| + print("Same wrapper after spawning: ${identical(custom, earlyCustom)}");
|
| + print("Before upgrade: $custom");
|
| + var upgrader = document.createElementUpgrader(XCustom);
|
| + upgrader.upgrade(custom);
|
| + custom = querySelector('#custom');
|
| + print("After upgrade: $custom");
|
| +
|
| + var callback = querySelector('#callback');
|
| + print("Before upgrade: $callback");
|
| + upgrader = document.createElementUpgrader(XCustomWithCallback);
|
| + upgrader.upgrade(callback);
|
| + callback = querySelector('#callback');
|
| + print("After upgrade: $callback");
|
| +
|
| + document.registerElement(XThrow.tag, XThrow);
|
| + print(querySelector('#throw'));
|
| +
|
| + context['testRunner'].callMethod('notifyDone', []);
|
| + }
|
| + }
|
| + });
|
| +
|
| + earlyCustom = querySelector('#custom');
|
| + var code = querySelector('#dart');
|
| + var dataUri = 'data:application/dart;base64,${window.btoa(code.text)}';
|
| + try {
|
| + Future<Isolate> isolate1 = spawnDomUri(Uri.parse(dataUri), [], null);
|
| + Future<Isolate> isolate2 = spawnDomUri(Uri.parse(dataUri), [], null);
|
| + Future<Isolate> isolate3 = spawnDomUri(Uri.parse(dataUri), [], null);
|
| + } catch (e) {
|
| + print("Spawn failed: $e");
|
| + context['testRunner'].callMethod('notifyDone', []);
|
| + }
|
| + code.remove();
|
| +}
|
| +</script>
|
| +
|
| +</body>
|
| +</html>
|
|
|