mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 544462 - HTML5 Offline features - Asterisk (*) not supported in network section of manifest file, r=jst, a2.0=jst
This commit is contained in:
parent
79786ca2a3
commit
8c7ff59e05
@ -63,6 +63,7 @@ _TEST_FILES = \
|
||||
test_bug445544.html \
|
||||
test_bug460353.html \
|
||||
test_bug474696.html \
|
||||
test_bug544462.html \
|
||||
test_foreign.html \
|
||||
test_fallback.html \
|
||||
test_overlap.html \
|
||||
@ -109,6 +110,8 @@ _TEST_FILES = \
|
||||
redirects.sjs \
|
||||
simpleManifest.cacheManifest \
|
||||
simpleManifest.cacheManifest^headers^ \
|
||||
wildcardManifest.cacheManifest \
|
||||
wildcardManifest.cacheManifest^headers^ \
|
||||
updatingManifest.sjs \
|
||||
simpleManifest.notmanifest \
|
||||
changing1Sec.sjs \
|
||||
@ -118,6 +121,7 @@ _TEST_FILES = \
|
||||
test_xhtmlManifest.xhtml \
|
||||
test_missingManifest.html \
|
||||
missing.html \
|
||||
jupiter.jpg \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
BIN
dom/tests/mochitest/ajax/offline/jupiter.jpg
Normal file
BIN
dom/tests/mochitest/ajax/offline/jupiter.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
55
dom/tests/mochitest/ajax/offline/test_bug544462.html
Normal file
55
dom/tests/mochitest/ajax/offline/test_bug544462.html
Normal file
@ -0,0 +1,55 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/wildcardManifest.cacheManifest">
|
||||
<head>
|
||||
<title>wildcard in network section 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>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
|
||||
<style>
|
||||
img {
|
||||
max-width: 400px;
|
||||
max-height: 400px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var gImageLoaded = [];
|
||||
|
||||
function imageOnLoad(idx)
|
||||
{
|
||||
gImageLoaded[idx] = true;
|
||||
}
|
||||
|
||||
function manifestUpdated()
|
||||
{
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
function finishTheTest()
|
||||
{
|
||||
OfflineTest.is(gImageLoaded[1], true, "Image from a different origin not cointained in the offline cache has loaded");
|
||||
OfflineTest.is(gImageLoaded[2], true, "Image not cointained in the offline cache has loaded");
|
||||
OfflineTest.teardown();
|
||||
OfflineTest.finish();
|
||||
}
|
||||
|
||||
if (OfflineTest.setup()) {
|
||||
applicationCache.onerror = OfflineTest.failEvent;
|
||||
applicationCache.oncached = OfflineTest.priv(manifestUpdated);
|
||||
applicationCache.onnoupdate = OfflineTest.priv(finishTheTest);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<img src="http://example.com/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg" onload="imageOnLoad(1)" />
|
||||
<img src="jupiter.jpg" onload="imageOnLoad(2)" />
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,8 @@
|
||||
CACHE MANIFEST
|
||||
|
||||
http://mochi.test:8888/tests/SimpleTest/SimpleTest.js
|
||||
http://mochi.test:8888/MochiKit/packed.js
|
||||
http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
|
||||
NETWORK:
|
||||
*
|
@ -0,0 +1,2 @@
|
||||
Content-Type: text/cache-manifest
|
||||
|
@ -927,6 +927,18 @@ nsOfflineManifestItem::HandleManifestLine(const nsCString::const_iterator &aBegi
|
||||
}
|
||||
|
||||
case PARSE_BYPASS_ENTRIES: {
|
||||
if (line[0] == '*' && (line.Length() == 1 || line[1] == ' ' || line[1] == '\t'))
|
||||
{
|
||||
// '*' indicates to make the online whitelist wildcard flag open,
|
||||
// i.e. do allow load of resources not present in the offline cache
|
||||
// or not conforming any namespace.
|
||||
// We achive that simply by adding an 'empty' - i.e. universal
|
||||
// namespace of BYPASS type into the cache.
|
||||
AddNamespace(nsIApplicationCacheNamespace::NAMESPACE_BYPASS,
|
||||
EmptyCString(), EmptyCString());
|
||||
break;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> bypassURI;
|
||||
rv = NS_NewURI(getter_AddRefs(bypassURI), line, nsnull, mURI);
|
||||
if (NS_FAILED(rv))
|
||||
|
Loading…
Reference in New Issue
Block a user