4 // Test that a subresource fetched after onload, following a reload, is still
5 // loaded from the cache.
7 if (!sessionStorage
.lastRandom
) {
8 if (window
.testRunner
) {
9 testRunner
.dumpAsText();
10 testRunner
.waitUntilDone();
16 delete sessionStorage
.lastRandom
;
18 document
.body
.innerText
= result
;
20 if (window
.testRunner
)
21 testRunner
.notifyDone();
24 function scriptLoaded()
28 if (!window
.randomNumber
)
29 done('FAIL: window.randomNumber not defined!');
30 else if (sessionStorage
.lastRandom
) {
31 if ((sessionStorage
.lastRandom
- 0) == (randomNumber
- 0))
36 sessionStorage
.lastRandom
= randomNumber
;
44 // After onload, add a script tag that should always load from the cache.
47 var s
= document
.createElement("script");
48 s
.src
= "resources/random-cached.cgi";
49 s
.onload
= scriptLoaded
;
50 document
.body
.appendChild(s
);