tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

071.html (1646B)


      1 <!DOCTYPE html>
      2 <html><head>
      3  <title> scheduler: document.write several scripts into IFRAME </title>
      4  <script src="/resources/testharness.js"></script>
      5  <script src="/resources/testharnessreport.js"></script>
      6  <script src="testlib/testlib.js"></script>
      7 
      8 </head>
      9 <body>
     10 
     11  <div id="log">FAILED (This TC requires JavaScript enabled)</div>
     12 
     13  <iframe style="width:1px;height:1px"></iframe>
     14 
     15  <script type="text/javascript">
     16    var doc = document.getElementsByTagName('iframe')[0].contentDocument;
     17    doc.open();
     18 
     19    var html = '<html><head><title>test</title></head>'+
     20              '<script>top.log("inline script #1");'+
     21              '<\/script>'+
     22              /* made url unique because Chrome will change
     23                 order depending on file cached status */
     24              '<script src="scripts/include-6.js?'+new Date().getTime()+'"><\/script>'+
     25              '</head>'+
     26              '<body>'+
     27              '<div id="foo"></div>'+
     28              '</body></html>'+
     29              '<script>top.log("inline script #2");<\/script>';
     30    log("calling document.write");
     31    doc.write(html);
     32 
     33    log("calling document.close");
     34    doc.close();
     35 
     36    var t = async_test()
     37 
     38 
     39    function test() {
     40      if( !window.include6Loaded )return setTimeout(t.step_func(test),200); //  try checking again if external script didn't run yet
     41      assert_array_equals(eventOrder, ['calling document.write',
     42          'inline script #1',
     43          'calling document.close',
     44          'external script (#foo found? NO)',
     45          'inline script #2'
     46        ]);
     47      t.done();
     48    }
     49 
     50    onload = t.step_func(test)
     51  </script>
     52 </head>
     53 
     54 </body>
     55 </html>