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 iframeLoaded()
26 setTimeout(function() {
27 if (!window
.randomNumber
)
28 done('FAIL: window.randomNumber not defined!');
29 else if (sessionStorage
.lastRandom
) {
30 if ((sessionStorage
.lastRandom
- 0) == (randomNumber
- 0))
35 sessionStorage
.lastRandom
= randomNumber
;
43 // After onload, add a script tag that should always load from the cache.
46 var f
= document
.createElement('iframe');
47 f
.src
= 'resources/loaded-from-cache-after-reload-within-iframe-subframe.html';
48 f
.onload
= iframeLoaded
;
49 document
.body
.appendChild(f
);