| Index: LayoutTests/http/tests/appcache/obsolete-error-events.html
|
| diff --git a/LayoutTests/http/tests/appcache/obsolete-error-events.html b/LayoutTests/http/tests/appcache/obsolete-error-events.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e26e89d9e89d39e5211b37f7fed7e20f87a80edc
|
| --- /dev/null
|
| +++ b/LayoutTests/http/tests/appcache/obsolete-error-events.html
|
| @@ -0,0 +1,78 @@
|
| +<html manifest="resources/fail-on-update.php">
|
| +<script src="/js-test-resources/js-test.js"></script>
|
| +<script>
|
| +var jsTestIsAsync = true;
|
| +description("Test that master list entries receive errors when manifest becomes obsolete.");
|
| +
|
| +function setManifestState(state)
|
| +{
|
| + var req = new XMLHttpRequest;
|
| + req.open("GET", "resources/fail-on-update.php?command=" + (state), false);
|
| + req.send(null);
|
| +}
|
| +
|
| +var eventDetailsFromFrame = null;
|
| +function onMessage(e) {
|
| + eventDetailsFromFrame = e.data;
|
| + checkEvents();
|
| +};
|
| +
|
| +var eventDetailsFromWindow = null;
|
| +function onObsolete(e) {
|
| + eventDetailsFromWindow = e;
|
| + checkEvents();
|
| +}
|
| +
|
| +// Event order is indeterminate, so wait for both to arrive.
|
| +function checkEvents() {
|
| + if (!eventDetailsFromFrame || !eventDetailsFromWindow)
|
| + return;
|
| +
|
| + shouldBeEqualToString("eventDetailsFromWindow.type", "obsolete");
|
| +
|
| + shouldBeEqualToString("eventDetailsFromFrame.type", "error");
|
| + shouldBeEqualToString("eventDetailsFromFrame.reason", "manifest");
|
| + shouldBeEqualToString("eventDetailsFromFrame.url", "");
|
| + shouldBe("eventDetailsFromFrame.status", "404");
|
| +
|
| + finishJSTest();
|
| +}
|
| +
|
| +function test()
|
| +{
|
| + applicationCache.onnoupdate = function() { log("Unexpected noupdate event") }
|
| + applicationCache.oncached = function() { log("Unexpected cached event") }
|
| +
|
| + setManifestState('delete');
|
| +
|
| + // The frame will be associated to a cache, but update will obsolete it.
|
| + var ifr = document.createElement("iframe");
|
| + ifr.setAttribute("src", "resources/obsolete-error-events-frame.html");
|
| + document.body.appendChild(ifr);
|
| +
|
| + applicationCache.onobsolete = onObsolete;
|
| + window.onmessage = onMessage;
|
| +}
|
| +
|
| +function resetManifest()
|
| +{
|
| + if (applicationCache.status !== applicationCache.UNCACHED && applicationCache.status !== applicationCache.OBSOLETE) {
|
| + timeoutId = setTimeout(resetManifest, 100);
|
| + return;
|
| + }
|
| +
|
| + setManifestState('reset');
|
| + location.reload();
|
| +}
|
| +
|
| +applicationCache.oncached = function() {
|
| + clearTimeout(timeoutId);
|
| + test();
|
| +};
|
| +
|
| +// If the manifest script happened to be in a wrong state, reset it.
|
| +var timeoutId = setTimeout(resetManifest, 100);
|
| +
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|