test_callback_across_document_open.html (948B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Test for callback invocation for a callback that comes from a 4 no-longer-current window that still has an active document.</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <div id="log"></div> 8 <iframe srcdoc='<script>function f() { parent.callCount++; }</script>'></iframe> 9 <script> 10 /* global async_test, assert_equals */ 11 var callCount = 0; 12 var t = async_test("A test of callback invocation in a no-longer-current window with a still-active document"); 13 window.addEventListener("load", t.step_func_done(function() { 14 var d = document.createElement("div"); 15 d.addEventListener("xyz", frames[0].f); 16 frames[0].document.open(); 17 frames[0].document.write("All gone"); 18 frames[0].document.close(); 19 d.dispatchEvent(new Event("xyz")); 20 assert_equals(callCount, 1, "Callback should have been called"); 21 })); 22 </script>