1<!doctype html> 2<meta charset="utf-8"> 3<title>window.event is still set when 'beforeunload' result is coerced to string</title> 4<link rel="help" href="https://dom.spec.whatwg.org/#ref-for-window-current-event%E2%91%A1"> 5<link rel="help" href="https://webidl.spec.whatwg.org/#call-a-user-objects-operation"> 6 7<script src="/resources/testharness.js"></script> 8<script src="/resources/testharnessreport.js"></script> 9 10<iframe id="iframe" src="resources/event-global-is-still-set-when-coercing-beforeunload-result-frame.html"></iframe> 11<body> 12<script> 13window.onload = () => { 14 async_test(t => { 15 iframe.onload = t.step_func_done(() => { 16 assert_equals(typeof window.currentEventInToString, "object"); 17 assert_equals(window.currentEventInToString.type, "beforeunload"); 18 }); 19 20 iframe.contentWindow.location.href = "about:blank"; 21 }); 22}; 23</script> 24