1<html manifest="fail-on-update.php"> 2<body> 3<div id=result></div> 4<script> 5function log(message) 6{ 7 document.getElementById("result").innerHTML += message + "<br>"; 8} 9 10function onObsolete() 11{ 12 log("obsolete") 13 log("status=" + applicationCache.status + " (expected 5)"); 14 applicationCache.onobsolete = function() { log("obsolete") } 15 applicationCache.onupdateready = function() { log("updateready") } 16 applicationCache.onnoupdate = function() { log("noupdate") } 17 applicationCache.onnoupdate = function() { log("error") } 18 19 // We still have a cache, so loading should fail 20 try { 21 var req = new XMLHttpRequest; 22 req.open("GET", "empty.txt", false); 23 req.send(null); 24 alert("FAIL: XMLHttpRequest for an uncached resource didn't raise an exception"); 25 } catch (ex) { 26 } 27 log("There should be no messages below."); 28} 29 30function onError() 31{ 32 if (applicationCache.status != applicationCache.UNCACHED && applicationCache.status != applicationCache.OBSOLETE) { 33 timeoutId = setTimeout(onNoManifest, 100); 34 return; 35 } 36 37 log("error"); 38 applicationCache.onobsolete = function() { log("obsolete") } 39 applicationCache.onupdateready = function() { log("updateready") } 40 applicationCache.onnoupdate = function() { log("noupdate") } 41 applicationCache.onnoupdate = function() { log("error") } 42 43 // Ensure that we are not associated with a cache. 44 try { 45 var req = new XMLHttpRequest; 46 req.open("GET", "empty.txt", false); 47 req.send(null); 48 } catch (ex) { 49 alert("FAIL: XMLHttpRequest raised an exception, " + ex); 50 } 51 log("There should be no messages below."); 52 parent.postMessage("frameDone - timeout", "*"); 53} 54 55applicationCache.onupdateready = function() { log("updateready"); alert("Unexpected updateready event in frame") } 56applicationCache.onnoupdate = function() { log("noupdate") } 57applicationCache.oncached = function() { log("cached"); alert("Unexpected cached event in frame") } 58 59applicationCache.onobsolete = onObsolete; 60applicationCache.onerror = onError; 61 62</script> 63</body> 64</html> 65