iframe_006.html (768B)
1 <!doctype html> 2 <title>document.write external script into iframe write back into parent</title> 3 <script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> 4 <iframe id="test"></iframe> 5 <script> 6 var t = async_test(); 7 var iframe = document.getElementById("test"); 8 var order = []; 9 t.step(function() { 10 order.push(1); 11 var s = "<script>parent.order.push(2); parent.document.write('<script>order.push(3); iframe.contentDocument.write(\"<script>parent.order.push(4)</script\"+\">\");order.push(5);</script' + '>'); parent.order.push(6)</script"+">"; 12 iframe.contentDocument.write(s); 13 iframe.contentDocument.close(); 14 order.push(7); 15 assert_array_equals(order, [1,2,3,4,5,6,7]); 16 }); 17 t.done(); 18 </script> 19 <div id="log"></div>