gecko/dom/tests/mochitest/ajax/offline/test_bug445544.html

73 lines
1.5 KiB
HTML

<html manifest="445544.cacheManifest">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=445544
-->
<head>
<title>Test for Bug 445544</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">
var gTestWin;
var gTimeoutId;
function finish()
{
gTestWin.close();
OfflineTest.teardown();
OfflineTest.finish();
}
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();
</script>
</head>
<body>
</body>
</html>