2 <html manifest=
"resources/fail-on-update-2.php">
4 if (window
.testRunner
) {
5 testRunner
.dumpAsText();
6 testRunner
.waitUntilDone();
9 function setManifestDeleted(state
, callback
)
11 var req
= new XMLHttpRequest
;
12 req
.onreadystatechange = function() {
13 if (req
.readyState
== 4)
16 req
.open("GET", "resources/fail-on-update.php?command=" + (state
? "delete" : "reset"));
22 clearTimeout(timeoutId
);
24 setManifestDeleted(true, afterDelete
);
26 function afterDelete()
28 applicationCache
.update();
30 // Create two subframes at different times to make hitting the race condition more likely.
31 var ifr
= document
.createElement("iframe");
32 ifr
.setAttribute("src", 'resources/fail-on-update-2.html');
33 document
.body
.appendChild(ifr
);
35 setTimeout(function() {
36 var ifr
= document
.createElement("iframe");
37 ifr
.setAttribute("src", 'resources/fail-on-update-2.html');
38 document
.body
.appendChild(ifr
);
43 var subframesLeft
= 2;
44 function subframeLoaded()
46 if (!--subframesLeft
) {
47 document
.write('<p>SUCCESS: No crash.</p>');
48 if (window
.testRunner
)
49 testRunner
.notifyDone();
53 function resetManifest()
55 if (applicationCache
.status
!= applicationCache
.UNCACHED
&& applicationCache
.status
!= applicationCache
.OBSOLETE
) {
56 timeoutId
= setTimeout(resetManifest
, 100);
60 setManifestDeleted(false, function() {
65 applicationCache
.addEventListener('noupdate', function() { setTimeout(test
, 0) }, false);
66 applicationCache
.addEventListener('cached', function() { setTimeout(test
, 0) }, false);
68 // If the manifest script happened to be in a wrong state, reset it.
69 var timeoutId
= setTimeout(resetManifest
, 100);
72 <p>Test for a particular incorrect assertion failure.
</p>