dom/tests/mochitest/ajax/offline/test_cancelOfflineCache.html

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

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

mercurial