OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../js/resources/js-test-pre.js"></script> |
| 3 <script> |
| 4 |
| 5 jsTestIsAsync = true; |
| 6 |
| 7 description('Test usage of document.currentScript with async') |
| 8 |
| 9 var seenIds = []; |
| 10 |
| 11 function logCurrentScript(id) { |
| 12 // Don't print anything if pass since the execution order of script[async] |
| 13 // is non deterministic. |
| 14 if (id !== document.currentScript.id) |
| 15 shouldBeEqualToString('document.currentScript.id', id); |
| 16 |
| 17 seenIds.push(document.currentScript.id); |
| 18 seenIds.sort(); |
| 19 if (seenIds.join('') === expectedIds) |
| 20 finishJSTest(); |
| 21 } |
| 22 |
| 23 var expectedIds = 'abcdef'; |
| 24 |
| 25 </script> |
| 26 <script id="a"> |
| 27 logCurrentScript('a'); |
| 28 </script> |
| 29 <script id="b" async src="resources/log-current-script-b.js"></script> |
| 30 <script id="c"> |
| 31 logCurrentScript('c'); |
| 32 </script> |
| 33 <script id="d" async src="resources/log-current-script-d.js"></script> |
| 34 |
| 35 <script id="e"> |
| 36 logCurrentScript('e'); |
| 37 |
| 38 var script = document.createElement('script'); |
| 39 script.id = 'f' |
| 40 script.async = true; |
| 41 script.defer = false; |
| 42 script.src = 'resources/log-current-script-f.js'; |
| 43 document.head.appendChild(script); |
| 44 </script> |
| 45 |
| 46 <script src="../../js/resources/js-test-post.js"></script> |
| 47 </body> |
| 48 </html> |
| 49 |
OLD | NEW |