test_bug1053321.html (1589B)
1 <!DOCTYPE html> 2 <html> 3 <!-- 4 This test confirms we don't block body referred sub-resources by head-referenced defer and async scripts. 5 If this test times out, the two image requests, that unblock the two script requests, never happen, hence 6 are unexpectedly blocked. 7 --> 8 9 <head> 10 <script src="/tests/SimpleTest/SimpleTest.js"></script> 11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 12 13 <script> 14 // The two scripts below are expected to load and call scriptLoaded(). 15 SimpleTest.waitForExplicitFinish(); 16 17 window.expected_scripts = { 18 "defer": true, 19 "async": true, 20 }; 21 22 function scriptLoaded(script) 23 { 24 ok(true, 'Script ' + script + ' executed'); 25 delete window.expected_scripts[script]; 26 27 let expecting = Object.keys(window.expected_scripts).length; 28 info("Expecting " + expecting + " more script(s) to execute"); 29 30 if (expecting == 0) { 31 SimpleTest.finish(); 32 } 33 } 34 </script> 35 36 <!-- this script is not loaded until file_blocked_script.sjs?unblock&defer request is made, 37 when this script is executed, it calls SimpleTest.finish(). 38 --> 39 <script defer src="file_blocked_script.sjs?blocked&defer"></script> 40 41 <!-- this script is not loaded until file_blocked_script.sjs?unblock&async request is made, 42 when this script is executed, it calls SimpleTest.finish(). 43 --> 44 <script async src="file_blocked_script.sjs?blocked&async"></script> 45 </head> 46 47 <body> 48 <img src="file_blocked_script.sjs?unblock&defer"/> 49 <img src="file_blocked_script.sjs?unblock&async"/> 50 </body>