Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 <html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
2 <head>
3 <title>Cancel offline cache</title>
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
6 <script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
9 <script type="text/javascript">
11 var manifest = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest";
12 var manifestURI = Cc["@mozilla.org/network/io-service;1"]
13 .getService(Ci.nsIIOService)
14 .newURI(manifest, null, null);
15 var updateService = Cc['@mozilla.org/offlinecacheupdate-service;1']
16 .getService(Ci.nsIOfflineCacheUpdateService);
18 function manifestCached () {
19 OfflineTest.ok(false, "The update was supposed to be canceled");
21 OfflineTest.teardownAndFinish();
22 }
24 function onError () {
25 OfflineTest.ok(true, "Expected error: Update canceled");
27 OfflineTest.teardownAndFinish();
28 }
30 function onProgress () {
31 var i = 0;
32 while (i < updateService.numUpdates) {
33 var update = updateService.getUpdate(i);
34 if (update.manifestURI.spec == manifestURI.spec) {
35 update.cancel();
36 return;
37 }
38 i++;
39 }
40 }
42 if (OfflineTest.setup()) {
43 applicationCache.onerror = OfflineTest.priv(onError);
44 applicationCache.onnoupdate = OfflineTest.failEvent;
45 applicationCache.onprogress = OfflineTest.priv(onProgress);
46 applicationCache.oncached = OfflineTest.priv(manifestCached);
47 }
49 SimpleTest.waitForExplicitFinish();
51 </script>
53 </head>
55 <body>
57 </body>
58 </html>