summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/ajax/offline/test_bug460353.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/tests/mochitest/ajax/offline/test_bug460353.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/tests/mochitest/ajax/offline/test_bug460353.html')
-rw-r--r--dom/tests/mochitest/ajax/offline/test_bug460353.html100
1 files changed, 100 insertions, 0 deletions
diff --git a/dom/tests/mochitest/ajax/offline/test_bug460353.html b/dom/tests/mochitest/ajax/offline/test_bug460353.html
new file mode 100644
index 000000000..683d53d6a
--- /dev/null
+++ b/dom/tests/mochitest/ajax/offline/test_bug460353.html
@@ -0,0 +1,100 @@
+<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
+<head>
+<title>Bug 460353</title>
+
+<!--
+ This test checks that each iframe creates its own
+ scope. Actually, we just check that it loads and updates
+ its associated cache. There is no check that the cache is the
+ expected one, there is no API to gain that information.
+-->
+
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
+
+<script class="testbody" type="text/javascript">
+
+var result = new Array();
+var expectedUpdates = 3; // 2 iframes and our self
+
+applicationCache.oncached = onUpdatePassed;
+applicationCache.onnoupdate = onUpdatePassed;
+
+SpecialPowers.pushPermissions([{'type': 'offline-app', 'allow': true, 'context': document}], init);
+
+function onUpdatePassed()
+{
+ if (!(--expectedUpdates))
+ SimpleTest.executeSoon(finish);
+}
+
+function init()
+{
+ var iframes = document.getElementsByTagName('iframe');
+ iframes[0].src = "460353_iframe_nomanifest.html";
+ iframes[1].src = "460353_iframe_ownmanifest.html";
+ iframes[2].src = "460353_iframe_samemanifest.html";
+}
+
+function frameOnLoad(frameid, status)
+{
+ var obj = new Object();
+ result[frameid] = obj;
+
+ result[frameid].load = true;
+ result[frameid].cacheStatus = status;
+}
+
+function frameOnUpdate(frameid, ok, status)
+{
+ result[frameid].update = true;
+ result[frameid].updateOK = ok;
+ result[frameid].cacheStatus = status;
+
+ onUpdatePassed();
+}
+
+function finish()
+{
+ SimpleTest.ok(result["same"].load || false, "Frame with the same manifest loads");
+ SimpleTest.ok(result["same"].update || false, "Frame with the same manifest cache update notification");
+ SimpleTest.ok(result["same"].updateOK || false, "Frame with the same manifest cache update passed OK");
+ SimpleTest.is(result["same"].cacheStatus || -1, 1, "Frame with the same manifest cache status was IDLE");
+
+ SimpleTest.ok(result["diff"].load || false, "Frame with different manifest loads");
+ SimpleTest.ok(result["diff"].update || false, "Frame with different manifest cache update notification");
+ SimpleTest.ok(result["diff"].updateOK || false, "Frame with different manifest cache update passed OK");
+ SimpleTest.is(result["diff"].cacheStatus || -1, 1, "Frame with different manifest cache status was IDLE");
+
+ SimpleTest.ok(result["noman"].load || false, "Frame with no manifest loads");
+ SimpleTest.ok(result["noman"].update == undefined, "Frame with no manifest cache update didn't notify");
+ SimpleTest.ok(result["noman"].updateOK == undefined, "Frame with no manifest cache update didn't pass");
+ SimpleTest.is(result["noman"].cacheStatus || -1, -1, "Frame with no manifest cache status was undefined");
+
+ OfflineTest.waitForUpdates(function() {
+ cleanCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest");
+ cleanCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs");
+
+ SimpleTest.finish();
+ });
+}
+
+function cleanCache(manifestURL)
+{
+ var cache = OfflineTest.getActiveCache(manifestURL);
+ dump("Discarding cache for " + manifestURL + " cache=" + cache + "\n");
+ if (cache)
+ cache.discard();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+
+<body>
+ <iframe></iframe>
+ <iframe></iframe>
+ <iframe></iframe>
+</body>
+</html>