summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/ajax/offline/test_bug445544.html
blob: 07929a656fd5e32a2aa7d39fa8d9857c5f74f180 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<html manifest="445544.cacheManifest">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=445544
-->

<head>
<title>Test for Bug 445544</title>

<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<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">

var gTestWin;
var gTimeoutId;

function finish()
{
  gTestWin.close();
  OfflineTest.teardownAndFinish();
}

function error()
{
  OfflineTest.ok(false, "Part 2 did not successfully load.");
  finish();
}

function part2loaded()
{
  clearTimeout(gTimeoutId);
  OfflineTest.ok(true, "Part 2 successfully loaded.");
  finish();
}

function part1loaded(appCacheStatus)
{
  OfflineTest.ok(appCacheStatus > 0,
                 "Part 1 successfully loaded from the application cache.");

  // Loading part 2 (which is not part of that application
  // cache) should succeed...
  gTestWin.location = "445544_part2.html";

  // We won't be notified if the page fails to load, fail this test
  // in 10 seconds.
  gTimeoutId = setTimeout(error, 10000);
}

function manifestUpdated()
{
  // Open a new window that will be associated with this application
  // cache.  This will call part1loaded().
  gTestWin = window.open("445544_part1.html");
}

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

SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");

</script>

</head>

<body>

</body>
</html>