OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!DOCTYPE html> | 2 <!DOCTYPE html> |
3 <script src="../../../resources/testharness.js"></script> | 3 <script src="../../../resources/testharness.js"></script> |
4 <script src="../../../resources/testharnessreport.js"></script> | 4 <script src="../../../resources/testharnessreport.js"></script> |
5 <script src="test-harness-utils.js"></script> | 5 <script src="test-harness-utils.js"></script> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 (function () { | 8 (function () { |
9 | 9 |
10 var test = async_test('callbacks created in the outer frame\'s context are ' + | 10 var test = async_test('callbacks created in the outer frame\'s context are ' + |
11 'invoked in that context'); | 11 'invoked in that context'); |
12 | 12 |
13 withFrame(function (frame) { | 13 withFrame(function (frame) { |
14 var outerDocument = document; | 14 var outerDocument = document; |
15 var proto = Object.create(frame.contentWindow.HTMLElement.prototype); | 15 var proto = Object.create(frame.contentWindow.HTMLElement.prototype); |
16 proto.createdCallback = test.step_func(function () { | 16 proto.createdCallback = test.step_func(function () { |
17 assert_equals(document, outerDocument, | 17 assert_equals(document, outerDocument, |
18 'the context should be the outer window'); | 18 'the context should be the outer window'); |
19 }); | 19 }); |
20 var doc = frame.contentDocument; | 20 var doc = frame.contentDocument; |
21 doc.register('x-a', {prototype: proto}); | 21 doc.registerElement('x-a', {prototype: proto}); |
22 var script = doc.createElement('script'); | 22 var script = doc.createElement('script'); |
23 script.textContent = 'document.body.innerHTML = "<x-a></x-a>";'; | 23 script.textContent = 'document.body.innerHTML = "<x-a></x-a>";'; |
24 doc.body.appendChild(script); | 24 doc.body.appendChild(script); |
25 frame.remove(); | 25 frame.remove(); |
26 test.done(); | 26 test.done(); |
27 }); | 27 }); |
28 | 28 |
29 })(); | 29 })(); |
30 | 30 |
31 | 31 |
(...skipping 23 matching lines...) Expand all Loading... |
55 | 55 |
56 default: | 56 default: |
57 assert_not_reached(); | 57 assert_not_reached(); |
58 }; | 58 }; |
59 }); | 59 }); |
60 window.addEventListener('message', step); | 60 window.addEventListener('message', step); |
61 | 61 |
62 var script = doc.createElement('script'); | 62 var script = doc.createElement('script'); |
63 script.textContent = | 63 script.textContent = |
64 'var proto = Object.create(HTMLElement.prototype); ' + | 64 'var proto = Object.create(HTMLElement.prototype); ' + |
65 'proto.leftViewCallback = function () { ' + | 65 'proto.detachedCallback = function () { ' + |
66 ' window.parent.postMessage(' + | 66 ' window.parent.postMessage(' + |
67 ' {step: "assert", name: document.name}, "*");' + | 67 ' {step: "assert", name: document.name}, "*");' + |
68 '}; ' + | 68 '}; ' + |
69 'document.register("x-a", {prototype: proto}); ' + | 69 'document.registerElement("x-a", {prototype: proto}); ' + |
70 'document.body.innerHTML = "<x-a></x-a>"; ' + | 70 'document.body.innerHTML = "<x-a></x-a>"; ' + |
71 'window.parent.postMessage({step: "remove"}, "*");'; | 71 'window.parent.postMessage({step: "remove"}, "*");'; |
72 doc.body.appendChild(script); | 72 doc.body.appendChild(script); |
73 }); | 73 }); |
74 | 74 |
75 })(); | 75 })(); |
76 </script> | 76 </script> |
OLD | NEW |