OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../resources/testharness.js"></script> |
| 5 <script src="../../../resources/testharnessreport.js"></script> |
| 6 <script src="resources/async-block-helper.js"></script> |
| 7 <script> |
| 8 var test = async_test('With the async attribute, link element don\'t block the s
cript execution of following imports.'); |
| 9 |
| 10 function childReady() { |
| 11 test.step(function() { |
| 12 assert_true(window.masterScriptExecuted, 'A script in master is executed
wihtout waiting slow script.'); |
| 13 assert_true(isImportLoaded('has-slow-child-async.html'), 'A script (in c
hild) is executed wihtout waiting slow script.'); |
| 14 assert_false(isImportLoaded('has-slow-script.html'), 'A script in slow a
ync import has not to be excuted yet.'); |
| 15 }); |
| 16 } |
| 17 |
| 18 function grandchildReady() { |
| 19 test.step(function() { |
| 20 assert_true(window.masterScriptExecuted, 'A script in master is executed
wihtout waiting slow script.'); |
| 21 assert_true(isImportLoaded('has-slow-child-async.html'), 'A script (in c
hild) is executed wihtout waiting slow script.'); |
| 22 assert_true(isImportLoaded('has-slow-script.html'), 'A script in slow ay
nc import is eventually exeuted.'); |
| 23 test.done(); |
| 24 }); |
| 25 } |
| 26 |
| 27 function notifyImportLoaded(name) { |
| 28 switch (name) { |
| 29 case "has-slow-child-async.html": |
| 30 childReady(); |
| 31 break; |
| 32 case "has-slow-script.html": |
| 33 grandchildReady(); |
| 34 break; |
| 35 } |
| 36 } |
| 37 |
| 38 </script> |
| 39 <link id="asyncLink" async rel="import" href="resources/has-slow-child-async.htm
l"> |
| 40 <script> |
| 41 test.step(function() { |
| 42 assert_false(isImportLoaded('has-slow-script.html'), 'A script in async impo
rt (in grandchild) has not to be excuted yet.'); |
| 43 assert_false(isImportLoaded('has-slow-child-async.html'), 'A script in sync
import (in child) has not to be excuted yet.'); |
| 44 window.masterScriptExecuted = true; |
| 45 }); |
| 46 </script> |
| 47 </head> |
| 48 <body></body> |
| 49 </html> |
OLD | NEW |