2 // Copyright 2013 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
8 <title>unload_sleep_before_cookie
</title>
10 function sleep_ms(ms
) {
11 var start_ms
= Number(new Date());
12 var remaining_ms
= ms
;
13 while (remaining_ms
> 0) {
14 remaining_ms
= ms
- (Number(new Date()) - start_ms
);
17 addEventListener("unload", function() {
20 var expires
= new Date();
21 expires
.setMinutes(expires
.getMinutes() + 1);
22 document
.cookie
= "unloaded=ohyeah;path=/;expires=" + expires
.toUTCString();
23 console
.log("set the cookie");