summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/ajax/offline/updatingImplicit.html
blob: 6e95b4084df0e348d8f789029174bc30a0582e21 (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/updatingManifest.sjs">
<head>
<title>Updating implicit</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>

<script type="text/javascript">

function manifestUpdated()
{
  // Assert that we are properly associated with the application
  // cache.
  var req = new XMLHttpRequest;
  req.open("GET", "namespace2/script3.js", false);
  try {
    req.send(null);
    window.opener.OfflineTest.ok(false, "Able to fetch unlisted resource, not properly associated.");
  } catch(ex) {
    window.opener.OfflineTest.ok(true, "Unable to fetch unlisted resource, properly associated.");
  }

  req = new XMLHttpRequest;
  req.open("GET", "updatingImplicit.html", false);
  try {
    req.send(null);
    window.opener.OfflineTest.ok(true, "Able to fetch listed resource, properly associated.");
  } catch(ex) {
    window.opener.OfflineTest.ok(false, "Unable to fetch listed resource, not properly associated.");
  }

  window.opener.implicitLoaded(window, false);
}

function manifestError()
{
  window.opener.implicitLoaded(window, true);
}

if (OfflineTest.setupChild()) {
  applicationCache.onerror = OfflineTest.priv(manifestError);
  applicationCache.onupdateready = OfflineTest.failEvent;
  applicationCache.oncached = OfflineTest.failEvent;
  applicationCache.onnoupdate = OfflineTest.priv(manifestUpdated);
}

</script>

</head>

<body>
</body>
</html>