chromium/third_party/blink/manual_tests/quit-inside-unload.html

<script>
    var showedAlert = false;
    function handleUnload()
    {
        if (showedAlert)
            return;

        showedAlert = true;
        alert("Now Quit Safari. Do not dismiss this alert first.");
    }
</script>
<body onunload="handleUnload()">
    Close this window
</body>