1 <p>This test verifies that the load event doesn't fire until subresource content has loaded, even if you manually call document.close beforehand. See
<a href=
"http://bugs.webkit.org/show_bug.cgi?id=13241">bug
13241</a>.
</p>
3 <pre id=
"console"></pre>
10 document
.getElementById("console").appendChild(document
.createTextNode(s
+ "\n"));
13 function getDimensions()
15 var image
= frames
[0].document
.images
[0];
16 return "{ " + image
.width
+ " x " + image
.height
+ " }";
19 function beforeOnload()
21 log("dimensions before onload (should be { 0 x 0 }, otherwise the test will falsely pass): " + getDimensions());
24 function afterOnload()
26 log("dimensions during onload (should be { 215 x 174 }, otherwise onload fired too early): " + getDimensions());
27 if (window
.testRunner
)
28 testRunner
.notifyDone();
33 if (window
.testRunner
) {
34 testRunner
.dumpAsText();
36 // Quirkily, the FrameLoadDelegate API considers our <iframe> fully loaded
37 // once it has loaded its initial empty document. So, if we want DumpRenderTree
38 // to wait for the load event caused by our document.close() before dumping,
39 // we need to tell it so explicitly.
40 testRunner
.waitUntilDone();
43 var doc
= frames
[0].document
;
45 doc
.write("<body onload=\"parent.afterOnload()\">");
46 // Append a random query string to force a non-cached load.
47 doc
.write("<img src=\"resources/onload-image.png?" + Math
.random() + "\">");
48 doc
.write("<script\>parent.beforeOnload();</script\>");