mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-03 13:57:31 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
88
dom/tests/mochitest/ajax/offline/test_refetchManifest.html
Normal file
88
dom/tests/mochitest/ajax/offline/test_refetchManifest.html
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/changingManifest.sjs">
|
||||
<head>
|
||||
<title>refetch manifest 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>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function finish()
|
||||
{
|
||||
OfflineTest.teardownAndFinish();
|
||||
}
|
||||
|
||||
function failAndFinish(e)
|
||||
{
|
||||
OfflineTest.ok(false, "Unexpected event: " + e.type);
|
||||
finish();
|
||||
}
|
||||
|
||||
function manifestUpdated()
|
||||
{
|
||||
// Replace this manifest with a new one.
|
||||
|
||||
// XXX: After this put, we will no longer have Cache-Control:
|
||||
// no-cache on the manifest, so future updates will just use the
|
||||
// cached manifest.
|
||||
|
||||
// Get the initial contents of the first two files.
|
||||
fetcher = new OfflineCacheContents([g1SecUrl, g1HourUrl]);
|
||||
fetcher.fetch(function(contents) {
|
||||
gCacheContents = contents;
|
||||
|
||||
// Now make sure applicationCache.update() does what we expect.
|
||||
applicationCache.onupdateready = OfflineTest.priv(manifestUpdatedAgain);
|
||||
applicationCache.onnoupdate = failAndFinish;
|
||||
applicationCache.oncached = failAndFinish;
|
||||
|
||||
gGotChecking = false;
|
||||
gGotDownloading = false;
|
||||
|
||||
// The changing versions give out a new version each second,
|
||||
// make sure it has time to grab a new version, and for the
|
||||
// 1-second cache timeout to pass.
|
||||
window.setTimeout("applicationCache.update()", 5000);
|
||||
});
|
||||
}
|
||||
|
||||
function replaceManifest()
|
||||
{
|
||||
// If we replace the manifest after a downloading event, the update
|
||||
// should fail when it revalidates the manifest at the end of the update.
|
||||
OfflineTest.setSJSState("changingManifest.sjs", "2");
|
||||
}
|
||||
|
||||
function cached()
|
||||
{
|
||||
OfflineTest.ok(true, "Got the expected cached event.");
|
||||
finish();
|
||||
}
|
||||
|
||||
function gotError()
|
||||
{
|
||||
OfflineTest.ok(true, "Got the expected error event.");
|
||||
|
||||
// Now this update will be rescheduled, and it should succeed.
|
||||
applicationCache.onerror = failAndFinish;
|
||||
applicationCache.oncached = cached;
|
||||
}
|
||||
|
||||
if (OfflineTest.setup()) {
|
||||
applicationCache.onerror = gotError;
|
||||
applicationCache.onnoupdate = failAndFinish;
|
||||
|
||||
applicationCache.ondownloading = replaceManifest;
|
||||
applicationCache.oncached = failAndFinish;
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue