OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/js-test.js"></script> | 2 <script src="../../../resources/js-test.js"></script> |
3 <script src="testutils.js"></script> | 3 <script src="testutils.js"></script> |
4 <body> | 4 <body> |
5 <div id="s"> | 5 <div id="s"> |
6 </div> | 6 </div> |
7 <script> | 7 <script> |
8 if (fork()) { | 8 if (fork()) { |
9 // The controlling parent frame | 9 // The controlling parent frame |
10 description('Tests destroying a context during attributeChanged callback.'); | 10 description('Tests destroying a context during attributeChanged callback.'); |
11 jsTestIsAsync = true; | 11 jsTestIsAsync = true; |
12 successfullyParsed = true; | 12 successfullyParsed = true; |
13 } else { | 13 } else { |
14 // The child frame | 14 // The child frame |
15 | 15 |
16 var n = 0; | 16 var n = 0; |
17 var proto = Object.create(HTMLElement.prototype); | 17 var proto = Object.create(HTMLElement.prototype); |
18 proto.createdCallback = function () { | 18 proto.createdCallback = function () { |
19 if (n++ == 2) | 19 if (n++ == 2) |
20 this.previousSibling.setAttribute('tick', '...'); | 20 this.previousSibling.setAttribute('tick', '...'); |
21 }; | 21 }; |
22 proto.attributeChangedCallback = function (name) { | 22 proto.attributeChangedCallback = function (name) { |
23 if (name == 'tick') | 23 if (name == 'tick') |
24 this.previousSibling.setAttribute('boom', 'tsk'); | 24 this.previousSibling.setAttribute('boom', 'tsk'); |
25 if (name == 'boom') | 25 if (name == 'boom') |
26 destroyContext(); | 26 destroyContext(); |
27 }; | 27 }; |
28 | 28 |
29 var A = document.register('x-a', {prototype: proto}); | 29 var A = document.registerElement('x-a', {prototype: proto}); |
30 s.innerHTML = | 30 s.innerHTML = |
31 '<x-a id="t"></x-a>' + | 31 '<x-a id="t"></x-a>' + |
32 '<x-a id="u"></x-a>' + | 32 '<x-a id="u"></x-a>' + |
33 '<x-a id="v"></x-a>' + | 33 '<x-a id="v"></x-a>' + |
34 '<x-a id="w"></x-a>'; | 34 '<x-a id="w"></x-a>'; |
35 | 35 |
36 done(); | 36 done(); |
37 } | 37 } |
38 </script> | 38 </script> |
OLD | NEW |