chromium/third_party/blink/web_tests/fast/events/before-unload-javascript-navigation.html

<!DOCTYPE html>
<html>
<body>
<p>This test ensures setting location.href with javascript scheme  properly executes the script even while beforeunload event is being fired. You should see PASS 1/2 and PASS 2/2 below:</p>
<pre id="log">FAIL</pre>
<script>

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

var log = document.getElementById('log');

function test(iframe) {
    if (iframe.done)
        return;
    iframe.done = true;
    iframe.contentWindow.location.href = 'resources/before-unload-in-subframe-child.html';
}

function done() {
    log.innerHTML = 'PASS';
    if (window.testRunner)
        testRunner.notifyDone();
}

function fired(contentWindow) {
    location.href = 'javascript:top.done()';
}

</script>
<iframe onload="test(this);" src="resources/before-unload-in-subframe-child.html"></iframe>
</body>
</html>