diff options
Diffstat (limited to 'dom/tests/mochitest/ajax/offline/test_bug744719-cancel.html')
-rw-r--r-- | dom/tests/mochitest/ajax/offline/test_bug744719-cancel.html | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/dom/tests/mochitest/ajax/offline/test_bug744719-cancel.html b/dom/tests/mochitest/ajax/offline/test_bug744719-cancel.html new file mode 100644 index 000000000..53955790d --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_bug744719-cancel.html @@ -0,0 +1,84 @@ +<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest"> +<head> +<title>parallel load canceled</title> + +<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> + +<script type="text/javascript"> + +/* + Manifest refers a large number of resource to load. The 10th item however is a reference to a non-existing + resource that cancels the load. This test checks we cancel all loads and don't leak any of the other resources + after cancelation. +*/ + +if (SpecialPowers.isMainProcess()) { + ok(applicationCache.mozItems.length == 0, + "applicationCache.mozItems should be available and empty before associating with a cache."); +} + +function updateCanceled() +{ + OfflineTest.checkCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest", false, null); + OfflineTest.checkCache("http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false, null); + OfflineTest.checkCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false, null); + + OfflineTest.checkCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/nonexistent744719?010", false, null); + + var URL = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/subresource744719.html?"; + OfflineTest.checkCache(URL + "001", false, null); + OfflineTest.checkCache(URL + "002", false, null); + OfflineTest.checkCache(URL + "003", false, null); + OfflineTest.checkCache(URL + "004", false, null); + OfflineTest.checkCache(URL + "005", false, null); + OfflineTest.checkCache(URL + "006", false, null); + OfflineTest.checkCache(URL + "007", false, null); + OfflineTest.checkCache(URL + "008", false, null); + OfflineTest.checkCache(URL + "009", false, null); + OfflineTest.checkCache(URL + "011", false, null); + OfflineTest.checkCache(URL + "012", false, null); + OfflineTest.checkCache(URL + "013", false, null); + OfflineTest.checkCache(URL + "014", false, null); + OfflineTest.checkCache(URL + "015", false, null); + OfflineTest.checkCache(URL + "016", false, null); + OfflineTest.checkCache(URL + "017", false, null); + OfflineTest.checkCache(URL + "018", false, null); + OfflineTest.checkCache(URL + "019", false, null); + OfflineTest.checkCache(URL + "020", false, null); + OfflineTest.checkCache(URL + "021", false, null); + OfflineTest.checkCache(URL + "022", false, null); + OfflineTest.checkCache(URL + "023", false, null); + OfflineTest.checkCache(URL + "024", false, null); + OfflineTest.checkCache(URL + "025", false, null); + OfflineTest.checkCache(URL + "026", false, null); + OfflineTest.checkCache(URL + "027", false, null); + OfflineTest.checkCache(URL + "028", false, null); + OfflineTest.checkCache(URL + "029", false, null); + OfflineTest.checkCache(URL + "030", false, null); + + OfflineTest.teardownAndFinish(); +} + +if (OfflineTest.setup()) { + // Wait some time after the update has been canceled to catch potential leaks of channels that would cause + // unwanted items to be cached regardless the update has been canceled with a failure. + var privUpdateCanceled = OfflineTest.priv(updateCanceled); + applicationCache.onerror = function() {window.setTimeout(privUpdateCanceled, 1000)}; + + // We don't expect this update to finish correctly. + applicationCache.oncached = OfflineTest.failEvent; +} + +SimpleTest.waitForExplicitFinish(); +SimpleTest.requestFlakyTimeout("untriaged"); + +</script> + +</head> + +<body> + +</body> +</html> |