| OLD | NEW |
| 1 <html manifest="fail-on-update.php"> | 1 <html manifest="fail-on-update.php"> |
| 2 <body> | 2 <body> |
| 3 <div id=result></div> | 3 <div id=result></div> |
| 4 <script> | 4 <script> |
| 5 function log(message) | 5 function log(message) |
| 6 { | 6 { |
| 7 document.getElementById("result").innerHTML += message + "<br>"; | 7 document.getElementById("result").innerHTML += message + "<br>"; |
| 8 } | 8 } |
| 9 | 9 |
| 10 function onObsolete() | 10 function onObsolete() |
| 11 { | 11 { |
| 12 log("obsolete") | 12 log("obsolete") |
| 13 log("status=" + applicationCache.status + " (expected 5)"); | 13 log("status=" + applicationCache.status + " (expected 5)"); |
| 14 applicationCache.onobsolete = function() { log("obsolete") } | 14 applicationCache.onobsolete = function() { log("obsolete") } |
| 15 applicationCache.onupdateready = function() { log("updateready") } | 15 applicationCache.onupdateready = function() { log("updateready") } |
| 16 applicationCache.onnoupdate = function() { log("noupdate") } | 16 applicationCache.onnoupdate = function() { log("noupdate") } |
| 17 applicationCache.onnoupdate = function() { log("error") } | 17 applicationCache.onnoupdate = function() { log("error") } |
| 18 | 18 |
| 19 // We still have a cache, so loading should fail | 19 // We still have a cache, so loading should fail |
| 20 try { | 20 try { |
| 21 var req = new XMLHttpRequest; | 21 var req = new XMLHttpRequest; |
| 22 req.open("GET", "empty.txt", false); | 22 req.open("GET", "empty.txt", false); |
| 23 req.setRequestHeader("Cache-control", "no-store"); |
| 23 req.send(null); | 24 req.send(null); |
| 24 alert("FAIL: XMLHttpRequest for an uncached resource didn't raise an exc
eption"); | 25 alert("FAIL: XMLHttpRequest for an uncached resource didn't raise an exc
eption"); |
| 25 } catch (ex) { | 26 } catch (ex) { |
| 26 } | 27 } |
| 27 log("There should be no messages below."); | 28 log("There should be no messages below."); |
| 28 } | 29 } |
| 29 | 30 |
| 30 function onError() | 31 function onError() |
| 31 { | 32 { |
| 32 if (applicationCache.status != applicationCache.UNCACHED && applicationCache
.status != applicationCache.OBSOLETE) { | 33 if (applicationCache.status != applicationCache.UNCACHED && applicationCache
.status != applicationCache.OBSOLETE) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 55 applicationCache.onupdateready = function() { log("updateready"); alert("Unexpec
ted updateready event in frame") } | 56 applicationCache.onupdateready = function() { log("updateready"); alert("Unexpec
ted updateready event in frame") } |
| 56 applicationCache.onnoupdate = function() { log("noupdate") } | 57 applicationCache.onnoupdate = function() { log("noupdate") } |
| 57 applicationCache.oncached = function() { log("cached"); alert("Unexpected cached
event in frame") } | 58 applicationCache.oncached = function() { log("cached"); alert("Unexpected cached
event in frame") } |
| 58 | 59 |
| 59 applicationCache.onobsolete = onObsolete; | 60 applicationCache.onobsolete = onObsolete; |
| 60 applicationCache.onerror = onError; | 61 applicationCache.onerror = onError; |
| 61 | 62 |
| 62 </script> | 63 </script> |
| 63 </body> | 64 </body> |
| 64 </html> | 65 </html> |
| OLD | NEW |