tor-browser

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

070.html (1400B)


      1 <!DOCTYPE html>
      2 <html><head>
      3  <title> scheduler: document.write into IFRAME a script that adds a SCRIPT through DOM</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></iframe>
     14 
     15  <script type="text/javascript">
     16    var doc = document.getElementsByTagName('iframe')[0].contentDocument;
     17    doc.open();
     18 
     19    log("calling document.write");
     20    doc.write('<script>top.log("inline script #1");'+
     21              'var s=document.createElement("script");'+
     22              's.src="scripts/include-6.js?'+new Date().getTime()+'";'+
     23              'document.getElementsByTagName("head")[0].appendChild(s);'+
     24              '<\/script>'+
     25              '<div id="foo"></div>'+
     26              '<script>top.log("inline script #2");<\/script>'
     27    );
     28 
     29    log("calling document.close");
     30    doc.close();
     31 
     32    var t = async_test()
     33 
     34 
     35    function test() {
     36      if(!window.include6Loaded) {
     37            return setTimeout(t.step_func(test),200);
     38      }
     39      assert_array_equals(eventOrder, ['calling document.write', 'inline script #1', 'inline script #2', 'calling document.close', 'external script (#foo found? YES)']);
     40      t.done();
     41    }
     42 
     43    onload = t.step_func(test)
     44  </script>
     45 </head>
     46 
     47 </body>
     48 </html>