chromium/chrome/test/data/fast_tab_close/unload_sleep_before_cookie.html

<!--
// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-->
<html>
<head>
  <title>unload_sleep_before_cookie</title>
<script>
function sleep_ms(ms) {
  var start_ms = Number(new Date());
  var remaining_ms = ms;
  while (remaining_ms > 0) {
    remaining_ms = ms - (Number(new Date()) - start_ms);
  }
}
addEventListener("unload", function() {
  sleep_ms(200);

  var expires = new Date();
  expires.setMinutes(expires.getMinutes() + 1);
  document.cookie = "unloaded=ohyeah;path=/;expires=" + expires.toUTCString();
  console.log("set the cookie");
}, false);
</script>
</head>
<body></body>
</html>