2 <title>Image load in unload handler
</title>
5 var testCalled
= false;
9 if (window
.testRunner
) {
10 testRunner
.dumpAsText();
11 testRunner
.waitUntilDone();
16 // We can't go to check-ping.php directly, since that doesn't start sending
17 // a response until the ping data is detected, but unload handlers (where
18 // we send the ping) are only run once we've begun receiving data from the
19 // page being navigated to. Instead, we go through a dummy redirect page,
20 // to make sure that the onunload handler has run before we get to
22 location
.assign("resources/ping-redirect.html");
26 var img
= new Image(1, 1);
27 img
.src
= "resources/save-Ping.php";
32 <body onload=
"test();" onunload=
"ping();">
33 <img src=
"resources/delete-ping.php" onload=
"test();" onerror=
"test();"></img>
34 Test case for https://bugs.webkit.org/show_bug.cgi?id=
30457. Previously, if an image
<br>
35 load was trigger from an unload handler, we would kill it almost immediately due to the
<br>
36 navigation stopping all loaders. These loads now happen entirely in the background and detached
<br>
37 from the DOM, so they're invisible to the normal resource load callback infrastructure. We generate a
<br>
38 timestamp, then in the unload handler, we load an 'image' (actually a php script) that takes the
<br>
39 timestamp as a parameter and saves it to a file. The destination page is a php script that checks for
<br>
40 the existence of that file and passes the test if the file contains the expected timestamp.
<br>