| OLD | NEW |
| (Empty) |
| 1 <html manifest="resources/idempotent-update.manifest"> | |
| 2 <body> | |
| 3 <p>Test what applicationCache.update() does if update is already in progess.</p> | |
| 4 <p>Should say DONE, with no failures:</p> | |
| 5 <div id=result></div> | |
| 6 | |
| 7 <script> | |
| 8 if (window.testRunner) { | |
| 9 testRunner.dumpAsText(); | |
| 10 testRunner.waitUntilDone(); | |
| 11 } | |
| 12 | |
| 13 function log(message) | |
| 14 { | |
| 15 document.getElementById("result").innerHTML += message + "<br>"; | |
| 16 } | |
| 17 | |
| 18 function test() | |
| 19 { | |
| 20 // During update, additional update() should be no-op (the spec says that fa
ke checking and | |
| 21 // downloading events need to be dispatched, but that's only when the update
algorithm is invoked | |
| 22 // with a browsing context). | |
| 23 if (applicationCache.status != applicationCache.IDLE) | |
| 24 log("FAIL: Unexpected cache status while preparing to test: " + applicat
ionCache.status); | |
| 25 | |
| 26 var checkingCount = 0; | |
| 27 applicationCache.onchecking = function() { if (++checkingCount != 1) log("FA
IL: Too many checking events received.") } | |
| 28 | |
| 29 applicationCache.update(); | |
| 30 applicationCache.update(); | |
| 31 applicationCache.update(); | |
| 32 applicationCache.update(); | |
| 33 applicationCache.update(); | |
| 34 | |
| 35 applicationCache.onnoupdate = done; | |
| 36 applicationCache.oncached = function() { log("FAIL: received unexpected cach
ed event") } | |
| 37 } | |
| 38 | |
| 39 function done() | |
| 40 { | |
| 41 setTimeout(function() { | |
| 42 log("DONE"); | |
| 43 if (window.testRunner) | |
| 44 testRunner.notifyDone(); | |
| 45 }, 10); | |
| 46 } | |
| 47 | |
| 48 applicationCache.oncached = test; | |
| 49 applicationCache.onnoupdate = test; | |
| 50 | |
| 51 applicationCache.onupdateready = function() { log("FAIL: received unexpected upd
ateready event") } | |
| 52 applicationCache.onerror = function() { log("FAIL: received unexpected error eve
nt") } | |
| 53 | |
| 54 </script> | |
| 55 </body> | |
| 56 </html> | |
| OLD | NEW |