tor-browser

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

074.html (1523B)


      1 <!DOCTYPE html>
      2 <html><head>
      3  <title> scheduler: document.write into IFRAME a script that creates new inline script in parent that again adds script to IFRAME </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  <iframe style="width:1px;height:1px"></iframe>
     13 
     14  <script type="text/javascript">
     15    var doc = document.getElementsByTagName('iframe')[0].contentDocument;
     16    doc.open();
     17    var str1='';
     18    var html = '<html><head><title>test</title></head>'+
     19              '<script>top.log("inline script #1");'+
     20              '<\/script>'+
     21              '</head>'+
     22              '<body>'+
     23              '<script>top.testlib.addScript( \'top.log("inline script added to parent");top.doc.write( "<script>top.log(\\\\"inline script added to iframe\\\\")<\\\/script>");\', null, top.document.body, true ) <\/script>'+
     24              '</body></html>';
     25    log("calling document.write");
     26    doc.write(html);
     27 
     28    log("calling document.close");
     29    doc.close();
     30 
     31    var t = async_test()
     32 
     33 
     34    function test() {
     35      assert_array_equals(eventOrder, ['calling document.write',
     36          'inline script #1',
     37          'inline script added to parent',
     38          'inline script added to iframe',
     39          'calling document.close',
     40        ]);
     41      t.done();
     42    }
     43 
     44    onload = t.step_func(test)
     45  </script>
     46 </head>
     47 
     48 </body>
     49 </html>