018.html (1951B)
1 <!DOCTYPE html> 2 <html><head> 3 <title> scheduler: DOM added scripts and doc.write</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="testlib/testlib.js"></script> 7 </head> 8 <body> 9 10 <div id="log">FAILED (This TC requires JavaScript enabled)</div> 11 12 <script>log('inline script #1'); 13 testlib.addScript('', { 'src':'scripts/include-3.js' }, document.getElementsByTagName('head')[0], false); 14 testlib.addScript('log(\'body script #2\')', {}, document.getElementsByTagName('body')[0], true); 15 log('end script #1'); 16 </script> 17 18 <script type="text/javascript"> 19 log( 'inline script #2' ); 20 var t = async_test() 21 22 //XXX Need to test this delaying the document after we insert the external script and delaying the external script itself; afaict the spec allows us to race here on whether the document.write 23 //ever actually happens or not according to whether the insertion point is defined at the point at which the script is executed. 24 function test() { 25 assert_any(assert_array_equals, eventOrder, [ 26 ['inline script #1', 'body script #2', 'end script #1', 'external script before doc write', 'document.write external script', 'external script after doc write', 'inline script #2'], 27 ['inline script #1', 'body script #2', 'end script #1', 'inline script #2', 'external script before doc write', 'document.write external script', 'external script after doc write'], 28 ['inline script #1', 'body script #2', 'end script #1', 'inline script #2', 'external script before doc write', 'external script after doc write'] 29 ]); 30 t.done(); 31 } 32 onload = t.step_func(function(){setTimeout(test.apply(t), 100); }) 33 </script> 34 35 </body></html>