Thu, 15 Jan 2015 15:55:04 +0100
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>Bug 460353</title> |
michael@0 | 4 | |
michael@0 | 5 | <!-- |
michael@0 | 6 | This test checks that each iframe creates its own |
michael@0 | 7 | scope. Actually, we just check that it loads and updates |
michael@0 | 8 | its associated cache. There is no check that the cache is the |
michael@0 | 9 | expected one, there is no API to gain that information. |
michael@0 | 10 | --> |
michael@0 | 11 | |
michael@0 | 12 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 13 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 14 | <script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script> |
michael@0 | 15 | |
michael@0 | 16 | <script class="testbody" type="text/javascript"> |
michael@0 | 17 | |
michael@0 | 18 | var result = new Array(); |
michael@0 | 19 | var expectedUpdates = 3; // 2 iframes and our self |
michael@0 | 20 | |
michael@0 | 21 | applicationCache.oncached = onUpdatePassed; |
michael@0 | 22 | applicationCache.onnoupdate = onUpdatePassed; |
michael@0 | 23 | |
michael@0 | 24 | SpecialPowers.pushPermissions([{'type': 'offline-app', 'allow': true, 'context': document}], init); |
michael@0 | 25 | |
michael@0 | 26 | function onUpdatePassed() |
michael@0 | 27 | { |
michael@0 | 28 | if (!(--expectedUpdates)) |
michael@0 | 29 | SimpleTest.executeSoon(finish); |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | function init() |
michael@0 | 33 | { |
michael@0 | 34 | var iframes = document.getElementsByTagName('iframe'); |
michael@0 | 35 | iframes[0].src = "460353_iframe_nomanifest.html"; |
michael@0 | 36 | iframes[1].src = "460353_iframe_ownmanifest.html"; |
michael@0 | 37 | iframes[2].src = "460353_iframe_samemanifest.html"; |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | function frameOnLoad(frameid, status) |
michael@0 | 41 | { |
michael@0 | 42 | var obj = new Object(); |
michael@0 | 43 | result[frameid] = obj; |
michael@0 | 44 | |
michael@0 | 45 | result[frameid].load = true; |
michael@0 | 46 | result[frameid].cacheStatus = status; |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | function frameOnUpdate(frameid, ok, status) |
michael@0 | 50 | { |
michael@0 | 51 | result[frameid].update = true; |
michael@0 | 52 | result[frameid].updateOK = ok; |
michael@0 | 53 | result[frameid].cacheStatus = status; |
michael@0 | 54 | |
michael@0 | 55 | onUpdatePassed(); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | function finish() |
michael@0 | 59 | { |
michael@0 | 60 | SimpleTest.ok(result["same"].load || false, "Frame with the same manifest loads"); |
michael@0 | 61 | SimpleTest.ok(result["same"].update || false, "Frame with the same manifest cache update notification"); |
michael@0 | 62 | SimpleTest.ok(result["same"].updateOK || false, "Frame with the same manifest cache update passed OK"); |
michael@0 | 63 | SimpleTest.is(result["same"].cacheStatus || -1, 1, "Frame with the same manifest cache status was IDLE"); |
michael@0 | 64 | |
michael@0 | 65 | SimpleTest.ok(result["diff"].load || false, "Frame with different manifest loads"); |
michael@0 | 66 | SimpleTest.ok(result["diff"].update || false, "Frame with different manifest cache update notification"); |
michael@0 | 67 | SimpleTest.ok(result["diff"].updateOK || false, "Frame with different manifest cache update passed OK"); |
michael@0 | 68 | SimpleTest.is(result["diff"].cacheStatus || -1, 1, "Frame with different manifest cache status was IDLE"); |
michael@0 | 69 | |
michael@0 | 70 | SimpleTest.ok(result["noman"].load || false, "Frame with no manifest loads"); |
michael@0 | 71 | SimpleTest.ok(result["noman"].update == undefined, "Frame with no manifest cache update didn't notify"); |
michael@0 | 72 | SimpleTest.ok(result["noman"].updateOK == undefined, "Frame with no manifest cache update didn't pass"); |
michael@0 | 73 | SimpleTest.is(result["noman"].cacheStatus || -1, -1, "Frame with no manifest cache status was undefined"); |
michael@0 | 74 | |
michael@0 | 75 | OfflineTest.waitForUpdates(function() { |
michael@0 | 76 | cleanCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest"); |
michael@0 | 77 | cleanCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs"); |
michael@0 | 78 | |
michael@0 | 79 | SimpleTest.finish(); |
michael@0 | 80 | }); |
michael@0 | 81 | } |
michael@0 | 82 | |
michael@0 | 83 | function cleanCache(manifestURL) |
michael@0 | 84 | { |
michael@0 | 85 | var cache = OfflineTest.getActiveCache(manifestURL); |
michael@0 | 86 | dump("Discarding cache for " + manifestURL + " cache=" + cache + "\n"); |
michael@0 | 87 | if (cache) |
michael@0 | 88 | cache.discard(); |
michael@0 | 89 | } |
michael@0 | 90 | |
michael@0 | 91 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 92 | |
michael@0 | 93 | </script> |
michael@0 | 94 | |
michael@0 | 95 | <body> |
michael@0 | 96 | <iframe></iframe> |
michael@0 | 97 | <iframe></iframe> |
michael@0 | 98 | <iframe></iframe> |
michael@0 | 99 | </body> |
michael@0 | 100 | </html> |