mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
ace5a3bf61
* * *
97 lines
3.4 KiB
HTML
97 lines
3.4 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://localhost:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
|
|
<head>
|
|
<title>simple manifest test</title>
|
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
|
<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 gGotChecking = false;
|
|
var gGotDownloading = false;
|
|
|
|
function addFinished()
|
|
{
|
|
// Check that the entry was added successfully
|
|
OfflineTest.checkCache("http://localhost:8888/tests/SimpleTest/EventUtils.js",
|
|
true);
|
|
|
|
OfflineTest.ok(applicationCache.length == 1, "applicationCache should have one dynamic entry");
|
|
OfflineTest.ok(applicationCache.item(0) == "http://localhost:8888/tests/SimpleTest/EventUtils.js",
|
|
"applicationCache's dynamic entry should be the one we expect");
|
|
|
|
// Now test that removes work
|
|
applicationCache.remove("http://localhost:8888/tests/SimpleTest/EventUtils.js");
|
|
|
|
OfflineTest.checkCache("http://localhost:8888/tests/SimpleTest/EventUtils.js",
|
|
false);
|
|
OfflineTest.ok(applicationCache.length == 0,
|
|
"applicationCache should have no dynamic entries");
|
|
|
|
// We're done
|
|
|
|
OfflineTest.teardown();
|
|
|
|
OfflineTest.finish();
|
|
}
|
|
|
|
function manifestUpdated()
|
|
{
|
|
OfflineTest.ok(gGotChecking, "Should get a checking event");
|
|
OfflineTest.ok(gGotDownloading, "Should get a downloading event");
|
|
|
|
// The manifest itself should be in the cache
|
|
OfflineTest.checkCache("http://localhost:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest", true);
|
|
|
|
// The document that requested the manifest should be in the cache
|
|
OfflineTest.checkCache(window.location.href, true);
|
|
|
|
// The entries from the manifest should be in the cache
|
|
OfflineTest.checkCache("http://localhost:8888/tests/SimpleTest/SimpleTest.js", true);
|
|
OfflineTest.checkCache("http://localhost:8888/MochiKit/packed.js", true);
|
|
OfflineTest.checkCache("http://localhost:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true);
|
|
|
|
// The bad entries from the manifest should not be in the cache
|
|
OfflineTest.checkCache("https://localhost:8888/MochiKit/packed.js", false);
|
|
OfflineTest.checkCache("bad:/uri/invalid", false);
|
|
|
|
applicationCache.swapCache();
|
|
|
|
// XXX: make sure that the previous version went away after the swapCache().
|
|
|
|
// Now add a file using the applicationCache API
|
|
applicationCache.add("http://localhost:8888/tests/SimpleTest/EventUtils.js");
|
|
|
|
// Wait for the add() to be downloaded
|
|
OfflineTest.waitForAdd("http://localhost:8888/tests/SimpleTest/EventUtils.js",
|
|
OfflineTest.priv(addFinished));
|
|
}
|
|
|
|
if (OfflineTest.setup()) {
|
|
OfflineTest.ok(applicationCache instanceof EventTarget,
|
|
"applicationCache should be an event target");
|
|
|
|
applicationCache.onerror = OfflineTest.failEvent;
|
|
|
|
applicationCache.addEventListener("checking", function() {
|
|
OfflineTest.is(applicationCache.status, 2, "CHECKING state while checking");
|
|
gGotChecking = true;
|
|
}, true);
|
|
applicationCache.ondownloading = function() {
|
|
OfflineTest.is(applicationCache.status, 3, "DOWNLOADING state while checking")
|
|
gGotDownloading = true; };
|
|
applicationCache.oncached = OfflineTest.priv(manifestUpdated);
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
</body>
|
|
</html>
|