OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 description("This test ensures that script-added import doesn't block scripts"); | 8 description("This test ensures that script-added import doesn't block scripts"); |
9 | 9 |
10 window.jsTestIsAsync = true; | 10 window.jsTestIsAsync = true; |
11 | 11 |
12 var importIsLoaded = false; | 12 var importIsLoaded = false; |
13 var scriptIsExecuted = false; | 13 var scriptIsExecuted = false; |
14 | 14 |
15 var linkEl = document.createElement("link"); | 15 var linkEl = document.createElement("link"); |
16 linkEl.setAttribute("rel", "import"); | 16 linkEl.setAttribute("rel", "import"); |
17 linkEl.setAttribute("href", "resources/async-child.html"); | 17 linkEl.setAttribute("href", "resources/async-child.html"); |
18 document.head.appendChild(linkEl); | 18 document.head.appendChild(linkEl); |
19 linkEl.onload = function(evt) { | 19 linkEl.onload = function(evt) { |
20 debug("In onload handler - This should be called later."); | 20 debug("In onload handler - This should be called later."); |
21 shouldBeTrue("importIsLoaded"); | 21 shouldBeTrue("importIsLoaded"); |
22 shouldBeTrue("scriptIsExecuted"); | 22 shouldBeTrue("scriptIsExecuted"); |
23 finishJSTest(); | 23 finishJSTest(); |
24 }; | 24 }; |
25 | 25 |
26 </script> | 26 </script> |
27 <script> | 27 <script> |
28 debug("In script tag - This should be called first."); | 28 debug("In script tag - This should be called first."); |
29 shouldBeFalse("importIsLoaded"); | 29 shouldBeTrue("importIsLoaded"); |
30 scriptIsExecuted = true; | 30 scriptIsExecuted = true; |
31 </script> | 31 </script> |
32 </body> | 32 </body> |
33 </html> | 33 </html> |
OLD | NEW |