tor-browser

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

072.html (1377B)


      1 <!DOCTYPE html>
      2 <html><head>
      3  <title> scheduler: document.write into IFRAME a script that creates new inline script in parent </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              '</head>'+
     23              '<body>'+
     24              '<div id="foo"></div>'+
     25              '</body></html>'+
     26              '<script>top.testlib.addScript( \'log("inline script added to parent")\', null, top.document.body, true )<\/script>';
     27    log("calling document.write");
     28    doc.write(html);
     29 
     30    log("calling document.close");
     31    doc.close();
     32 
     33    var t = async_test()
     34 
     35 
     36    function test() {
     37      assert_array_equals(eventOrder, ['calling document.write',
     38          'inline script #1',
     39          'inline script added to parent',
     40          'calling document.close',
     41        ]);
     42      t.done();
     43    }
     44 
     45    onload = t.step_func(test)
     46  </script>
     47 </head>
     48 
     49 </body>
     50 </html>