summaryrefslogtreecommitdiffstats
path: root/LayoutTests/http/tests/appcache/resources/remove-cache-frame.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/http/tests/appcache/resources/remove-cache-frame.html')
-rw-r--r--LayoutTests/http/tests/appcache/resources/remove-cache-frame.html64
1 files changed, 64 insertions, 0 deletions
diff --git a/LayoutTests/http/tests/appcache/resources/remove-cache-frame.html b/LayoutTests/http/tests/appcache/resources/remove-cache-frame.html
new file mode 100644
index 0000000..30e8553
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/remove-cache-frame.html
@@ -0,0 +1,64 @@
+<html manifest="fail-on-update.php">
+<body>
+<div id=result></div>
+<script>
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function onObsolete()
+{
+ log("obsolete")
+ log("status=" + applicationCache.status + " (expected 5)");
+ applicationCache.onobsolete = function() { log("obsolete") }
+ applicationCache.onupdateready = function() { log("updateready") }
+ applicationCache.onnoupdate = function() { log("noupdate") }
+ applicationCache.onnoupdate = function() { log("error") }
+
+ // We still have a cache, so loading should fail
+ try {
+ var req = new XMLHttpRequest;
+ req.open("GET", "empty.txt", false);
+ req.send(null);
+ alert("FAIL: XMLHttpRequest for an uncached resource didn't raise an exception");
+ } catch (ex) {
+ }
+ log("There should be no messages below.");
+}
+
+function onError()
+{
+ if (applicationCache.status != applicationCache.UNCACHED && applicationCache.status != applicationCache.OBSOLETE) {
+ timeoutId = setTimeout(onNoManifest, 100);
+ return;
+ }
+
+ log("error");
+ applicationCache.onobsolete = function() { log("obsolete") }
+ applicationCache.onupdateready = function() { log("updateready") }
+ applicationCache.onnoupdate = function() { log("noupdate") }
+ applicationCache.onnoupdate = function() { log("error") }
+
+ // Ensure that we are not associated with a cache.
+ try {
+ var req = new XMLHttpRequest;
+ req.open("GET", "empty.txt", false);
+ req.send(null);
+ } catch (ex) {
+ alert("FAIL: XMLHttpRequest raised an exception, " + ex);
+ }
+ log("There should be no messages below.");
+ parent.postMessage("frameDone - timeout", "*");
+}
+
+applicationCache.onupdateready = function() { log("updateready"); alert("Unexpected updateready event in frame") }
+applicationCache.onnoupdate = function() { log("noupdate") }
+applicationCache.oncached = function() { log("cached"); alert("Unexpected cached event in frame") }
+
+applicationCache.onobsolete = onObsolete;
+applicationCache.onerror = onError;
+
+</script>
+</body>
+</html>