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="test-harness-utils.js"></script> | 4 <script src="test-harness-utils.js"></script> |
5 <body> | 5 <body> |
6 <script> | 6 <script> |
7 function TestRegistrationContextSharing(window, documentA, documentB) { | 7 function TestRegistrationContextSharing(window, documentA, documentB) { |
8 this.window = window; | 8 this.window = window; |
9 this.documentA = documentA; | 9 this.documentA = documentA; |
10 this.documentB = documentB; | 10 this.documentB = documentB; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 var documentA; | 139 var documentA; |
140 | 140 |
141 t.step(function () { | 141 t.step(function () { |
142 // FIXME: When inserting a <link> within a frame triggers an import, | 142 // FIXME: When inserting a <link> within a frame triggers an import, |
143 // run this part of the test in isolation within a frame. | 143 // run this part of the test in isolation within a frame. |
144 documentA = document; | 144 documentA = document; |
145 | 145 |
146 link = documentA.createElement('link'); | 146 link = documentA.createElement('link'); |
147 link.rel = 'import'; | 147 link.rel = 'import'; |
148 link.href = 'resources/empty-document.html'; | 148 link.href = 'resources/empty-document.html'; |
149 documentA.head.appendChild(link); | 149 link.onload = t.step_func(function () { |
150 | |
151 // FIXME: When imports raise the 'load' event, use that instead of | |
152 // polling. | |
153 waitForLinkToLoad(); | |
154 }); | |
155 | |
156 function waitForLinkToLoad() { | |
157 if (!link.import) { | |
158 setTimeout(waitForLinkToLoad, 100); | |
159 return; | |
160 } | |
161 | |
162 t.step(function () { | |
163 var documentB = link.import; | 150 var documentB = link.import; |
164 var tester = new TestRegistrationContextSharing(window, | 151 var tester = new TestRegistrationContextSharing(window, |
165 documentA, documentB); | 152 documentA, documentB); |
166 tester.testRegistrationContextIsShared(); | 153 tester.testRegistrationContextIsShared(); |
167 t.done(); | 154 t.done(); |
168 }); | 155 }); |
169 } | 156 |
| 157 documentA.head.appendChild(link); |
| 158 }); |
170 | 159 |
171 })(); | 160 })(); |
172 | 161 |
173 </script> | 162 </script> |
OLD | NEW |