chromium/third_party/blink/web_tests/http/tests/security/window-events-clear-port.html

<html>
<head>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
    testRunner.setPopupBlockingEnabled(false);
}

function pagehideHandler() {
    document.getElementById('result').innerHTML = "PASS";
}

function loadHandler() {
    document.getElementById('result').innerHTML = "FAIL - load event should not fire if security check failed.";
}

function test()
{
    var w = window.open('http://127.0.0.1:8080/security/resources/has-window-events.html');
    w.addEventListener('pagehide', pagehideHandler, false);
    w.addEventListener('load', loadHandler, false);
}

</script>
<body onload='test()'>
Test that window event handlers set for initial document are reset upon navigation if security check failed. There will be 'PASS' below if the test passes:<br>
<div id='result'>FAIL - nothing happened</div>