| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
| 4 <script src="../fast/dom/custom/testutils.js"></script> | 4 <script src="../fast/dom/custom/testutils.js"></script> |
| 5 <body> | 5 <body> |
| 6 <script> | 6 <script> |
| 7 'use strict'; | 7 'use strict'; |
| 8 | 8 |
| 9 // TODO(dominicc): Port fork() etc. to work with testharness, then | 9 // TODO(dominicc): Port fork() etc. to work with testharness, then |
| 10 // remove these. | 10 // remove these. |
| 11 function debug() {} | 11 function debug() {} |
| 12 function finishJSTest() {} | 12 function finishJSTest() {} |
| 13 | 13 |
| 14 (() => { | 14 (() => { |
| 15 | 15 |
| 16 if (fork()) { | 16 if (fork()) { |
| 17 // The controlling parent frame. | 17 // The controlling parent frame. |
| 18 let t = async_test('context is destroyed; call across context'); | 18 let t = async_test('context is destroyed; call across context'); |
| 19 let watcher = new EventWatcher(t, window, 'message'); | 19 let watcher = new EventWatcher(t, window, 'message'); |
| 20 watcher.wait_for('message').then(t.step_func((event) => { | 20 watcher.wait_for('message').then(t.step_func((event) => { |
| 21 assert_equals(event.data, 'PASS destroyed context'); | 21 assert_equals(event.data, 'PASS destroyed context'); |
| 22 return watcher.wait_for('message'); | 22 return watcher.wait_for('message'); |
| 23 })).then(t.step_func((event) => { | 23 })).then(t.step_func((event) => { |
| 24 assert_equals(event.data, 'PASS child done'); | 24 assert_equals(event.data, 'PASS child done'); |
| 25 let e = new window.C(); | 25 assert_throws(null, () => new window.C()); |
| 26 assert_true(e instanceof C, 'should have created an element'); | |
| 27 t.done(); | 26 t.done(); |
| 28 })); | 27 })); |
| 29 } else { | 28 } else { |
| 30 // The child frame. | 29 // The child frame. |
| 31 class C extends HTMLElement {} | 30 class C extends HTMLElement {} |
| 32 window.customElements.define('a-a', C); | 31 window.customElements.define('a-a', C); |
| 33 window.parent.C = C; | 32 window.parent.C = C; |
| 34 destroyContext(); | 33 destroyContext(); |
| 35 done(); | 34 done(); |
| 36 } | 35 } |
| 37 | 36 |
| 38 })(); | 37 })(); |
| 39 </script> | 38 </script> |
| OLD | NEW |