chromium/content/test/data/navigation_controller/beforeunload_dialog.html

<html>
<head>
<script>
window.addEventListener("beforeunload", function (event) {
  setTimeout(function() {
    window.alert("hi");
  }, 0);
});
</script>
</head>
<body>
</body>
</html>