Index: LayoutTests/http/tests/appcache/fail-on-update-2.html |
diff --git a/LayoutTests/http/tests/appcache/fail-on-update-2.html b/LayoutTests/http/tests/appcache/fail-on-update-2.html |
index fa81f9d450161e60d94d82d9409655e1f0a655cc..ee856682661cdafe33dcced4da96e6b82df4c268 100644 |
--- a/LayoutTests/http/tests/appcache/fail-on-update-2.html |
+++ b/LayoutTests/http/tests/appcache/fail-on-update-2.html |
@@ -1,3 +1,4 @@ |
+<!DOCTYPE HTML> |
<html manifest="resources/fail-on-update-2.php"> |
<script> |
if (window.testRunner) { |
@@ -5,10 +6,14 @@ if (window.testRunner) { |
testRunner.waitUntilDone(); |
} |
-function setManifestDeleted(state) |
+function setManifestDeleted(state, callback) |
{ |
var req = new XMLHttpRequest; |
- req.open("GET", "resources/fail-on-update.php?command=" + (state ? "delete" : "reset"), false); |
+ req.onreadystatechange = function() { |
+ if (req.readyState == 4) |
+ callback(); |
+ } |
+ req.open("GET", "resources/fail-on-update.php?command=" + (state ? "delete" : "reset")); |
req.send(null); |
} |
@@ -16,19 +21,23 @@ function test() |
{ |
clearTimeout(timeoutId); |
- setManifestDeleted(true); |
- applicationCache.update(); |
- |
- // Create two subframes at different times to make hitting the race condition more likely. |
- var ifr = document.createElement("iframe"); |
- ifr.setAttribute("src", 'resources/fail-on-update-2.html'); |
- document.body.appendChild(ifr); |
+ setManifestDeleted(true, afterDelete); |
- setTimeout(function() { |
+ function afterDelete() |
+ { |
+ applicationCache.update(); |
+ |
+ // Create two subframes at different times to make hitting the race condition more likely. |
var ifr = document.createElement("iframe"); |
ifr.setAttribute("src", 'resources/fail-on-update-2.html'); |
document.body.appendChild(ifr); |
- }, 0); |
+ |
+ setTimeout(function() { |
+ var ifr = document.createElement("iframe"); |
+ ifr.setAttribute("src", 'resources/fail-on-update-2.html'); |
+ document.body.appendChild(ifr); |
+ }, 0); |
+ } |
} |
var subframesLeft = 2; |
@@ -48,8 +57,9 @@ function resetManifest() |
return; |
} |
- setManifestDeleted(false); |
- location.reload(); |
+ setManifestDeleted(false, function() { |
+ location.reload(); |
+ }); |
} |
applicationCache.addEventListener('noupdate', function() { setTimeout(test, 0) }, false); |