1 <html manifest="resources/fail-on-update-2.php"> 2 <script> 3 if (window.layoutTestController) { 4 layoutTestController.dumpAsText(); 5 layoutTestController.waitUntilDone(); 6 } 7 8 function setManifestDeleted(state) 9 { 10 var req = new XMLHttpRequest; 11 req.open("GET", "resources/fail-on-update.php?command=" + (state ? "delete" : "reset"), false); 12 req.send(null); 13 } 14 15 function test() 16 { 17 clearTimeout(timeoutId); 18 19 setManifestDeleted(true); 20 applicationCache.update(); 21 22 // Create two subframes at different times to make hitting the race condition more likely. 23 var ifr = document.createElement("iframe"); 24 ifr.setAttribute("src", 'resources/fail-on-update-2.html'); 25 document.body.appendChild(ifr); 26 27 setTimeout(function() { 28 var ifr = document.createElement("iframe"); 29 ifr.setAttribute("src", 'resources/fail-on-update-2.html'); 30 document.body.appendChild(ifr); 31 }, 0); 32 } 33 34 var subframesLeft = 2; 35 function subframeLoaded() 36 { 37 if (!--subframesLeft) { 38 document.write('<p>SUCCESS: No crash.</p>'); 39 if (window.layoutTestController) 40 layoutTestController.notifyDone(); 41 } 42 } 43 44 function resetManifest() 45 { 46 if (applicationCache.status != applicationCache.UNCACHED && applicationCache.status != applicationCache.OBSOLETE) { 47 timeoutId = setTimeout(resetManifest, 100); 48 return; 49 } 50 51 setManifestDeleted(false); 52 location.reload(); 53 } 54 55 applicationCache.addEventListener('noupdate', function() { setTimeout(test, 0) }, false); 56 applicationCache.addEventListener('cached', function() { setTimeout(test, 0) }, false); 57 58 // If the manifest script happened to be in a wrong state, reset it. 59 var timeoutId = setTimeout(resetManifest, 100); 60 61 </script> 62 <p>Test for a particular incorrect assertion failure.</p> 63 64 </html> 65