<html>

<head>
<script>

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

window.addEventListener('beforeunload', before, false);
window.onunload = unload; 

function before()
{
    console.log( "before unload");
}

function unload()
{
    console.log( "unload" );
    window.removeEventListener('beforeunload', before, false);
}

function load()
{
    location = "data:text/html,If you didn't hit an assert you PASS.<script>if (window.testRunner) testRunner.notifyDone(); </" + "script>";
}

</script>
</head>

<body onload="load()">
start document
</body>

</html>
