xmlhttprequest-sync-block-scripts.html (750B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Check that while a sync XHR is in flight async script loads don't complete and run script</title> 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 <body> 7 <script> 8 var scriptRan = false; 9 var onloadFired = false; 10 test(function() { 11 var s = document.createElement("script"); 12 s.src = "data:application/javascript,scriptRan = true;"; 13 s.onload = function() { onloadFired = true; } 14 document.body.appendChild(s); 15 var xhr = new XMLHttpRequest(); 16 xhr.open("GET", "data:,", false); 17 xhr.send(); 18 assert_false(scriptRan, "Script should not have run"); 19 assert_false(onloadFired, "load event for <script> should not have fired"); 20 }); 21 </script> 22 </body>