summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/ajax/offline/test_bug544462.html
blob: 1dbf9256c487b8b598720b9a031f095096a44796 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest">
<head>
<title>wildcard in network section test</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" />

<style>
  img {
    max-width: 400px;
    max-height: 400px;
  }
</style>

<script type="text/javascript">

var gImageLoaded = [];

function imageOnLoad(idx)
{
  gImageLoaded[idx] = true;
}

function manifestUpdated()
{
  window.location.reload();
}

function finishTheTest()
{
  OfflineTest.is(gImageLoaded[1], true, "Image from a different origin not cointained in the offline cache has loaded");
  OfflineTest.is(gImageLoaded[2], true, "Image not cointained in the offline cache has loaded");
  OfflineTest.teardownAndFinish();
}

if (OfflineTest.setup()) {
  applicationCache.onerror = OfflineTest.failEvent;
  applicationCache.oncached = OfflineTest.priv(manifestUpdated);
  applicationCache.onnoupdate = OfflineTest.priv(finishTheTest);
}

SimpleTest.waitForExplicitFinish();

</script>

</head>

<body>
  <img src="http://example.com/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg" onload="imageOnLoad(1)" />
  <img src="jupiter.jpg" onload="imageOnLoad(2)" />
</body>
</html>