| <!doctype html> |
| <title>beforeunload and unload events fire after window.close() in script-closeable browsing context</title> |
| <meta name="timeout" content="long"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <div id="log"></div> |
| <script> |
| beforeunload_fired = false; |
| var t = async_test(); |
| |
| onload = t.step_func(function() { |
| window.close(); |
| }); |
| |
| onbeforeunload = t.step_func(function() { |
| beforeunload_fired = true; |
| }); |
| |
| onunload = t.step_func(function() { |
| assert_true(beforeunload_fired); |
| t.done() |
| }); |
| </script> |