| OLD | NEW | 
|   1 <!DOCTYPE HTML> |   1 <!DOCTYPE HTML> | 
|   2 <html manifest="resources/fail-on-update.php"> |   2 <html manifest="resources/fail-on-update.php"> | 
|   3 <script> |   3 <script> | 
|   4 if (window.testRunner) { |   4 if (window.testRunner) { | 
|   5     testRunner.dumpAsText(); |   5     testRunner.dumpAsText(); | 
|   6     testRunner.waitUntilDone(); |   6     testRunner.waitUntilDone(); | 
|   7 } |   7 } | 
|   8  |   8  | 
|   9 function setManifestDeleted(state, callback) |   9 function setManifestDeleted(state, callback) | 
|  10 { |  10 { | 
|  11     var req = new XMLHttpRequest; |  11     var req = new XMLHttpRequest; | 
|  12     req.onreadystatechange = function() { |  12     req.onreadystatechange = function() { | 
|  13         if (req.readyState == 4) |  13         if (req.readyState == 4) | 
|  14             callback(); |  14             callback(); | 
|  15     } |  15     } | 
|  16     req.open("GET", "resources/fail-on-update.php?command=" + (state ? "delete" 
    : "reset")); |  16     req.open("GET", "resources/fail-on-update.php?command=" + (state ? "delete" 
    : "reset")); | 
|  17     req.send(null); |  17     req.send(null); | 
|  18 } |  18 } | 
|  19  |  19  | 
|  20 function test() |  20 function test() | 
|  21 { |  21 { | 
|  22     clearTimeout(timeoutId); |  22     clearTimeout(timeoutId); | 
|  23  |  23  | 
|  24     setManifestDeleted(true, afterDelete); |  24     setManifestDeleted(true, afterDelete); | 
|  25  |  25  | 
|  26     function afterDelete() |  26     function afterDelete() | 
|  27     { |  27     { | 
|  28         applicationCache.update(); |  28         applicationCache.update(); | 
|  29         window.location = 'data:text/html,<p>SUCCESS: No crash.</p>' +  |  29         window.location = 'resources/notify-no-crash.html'; | 
|  30             '<script>' + |  | 
|  31                 'if (window.testRunner) testRunner.notifyDone();' + |  | 
|  32             '</scri' + 'pt>'; |  | 
|  33     } |  30     } | 
|  34 } |  31 } | 
|  35  |  32  | 
|  36 function resetManifest() |  33 function resetManifest() | 
|  37 { |  34 { | 
|  38     if (applicationCache.status != applicationCache.UNCACHED && applicationCache
    .status != applicationCache.OBSOLETE) { |  35     if (applicationCache.status != applicationCache.UNCACHED && applicationCache
    .status != applicationCache.OBSOLETE) { | 
|  39         timeoutId = setTimeout(resetManifest, 100); |  36         timeoutId = setTimeout(resetManifest, 100); | 
|  40         return; |  37         return; | 
|  41     } |  38     } | 
|  42  |  39  | 
|  43     setManifestDeleted(false, function() { |  40     setManifestDeleted(false, function() { | 
|  44         location.reload(); |  41         location.reload(); | 
|  45     }); |  42     }); | 
|  46 } |  43 } | 
|  47  |  44  | 
|  48 applicationCache.addEventListener('noupdate', function() { setTimeout(test, 0) }
    , false); |  45 applicationCache.addEventListener('noupdate', function() { setTimeout(test, 0) }
    , false); | 
|  49 applicationCache.addEventListener('cached', function() { setTimeout(test, 0) }, 
    false); |  46 applicationCache.addEventListener('cached', function() { setTimeout(test, 0) }, 
    false); | 
|  50  |  47  | 
|  51 // If the manifest script happened to be in a wrong state, reset it. |  48 // If the manifest script happened to be in a wrong state, reset it. | 
|  52 var timeoutId = setTimeout(resetManifest, 100); |  49 var timeoutId = setTimeout(resetManifest, 100); | 
|  53  |  50  | 
|  54 </script> |  51 </script> | 
|  55 <p>Test for a particular incorrect assertion failure.</p> |  52 <p>Test for a particular incorrect assertion failure.</p> | 
|  56  |  53  | 
|  57 </html> |  54 </html> | 
| OLD | NEW |