зеркало из https://github.com/mozilla/gecko-dev.git
Bug 477748 - app cache chooses namespaces in the wrong order. r=honzab, sr=bz
This commit is contained in:
Родитель
1f553a232a
Коммит
19961382d3
|
@ -65,6 +65,9 @@ _TEST_FILES = \
|
|||
test_bug474696.html \
|
||||
test_foreign.html \
|
||||
test_fallback.html \
|
||||
test_overlap.html \
|
||||
overlap.cacheManifest \
|
||||
overlap.cacheManifest^headers^ \
|
||||
test_updatingManifest.html \
|
||||
445544_part1.html \
|
||||
445544_part2.html \
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
CACHE MANIFEST
|
||||
|
||||
CACHE:
|
||||
http://localhost:8888/tests/SimpleTest/SimpleTest.js
|
||||
http://localhost:8888/MochiKit/packed.js
|
||||
http://localhost:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js
|
||||
|
||||
NETWORK:
|
||||
bogus/specific/
|
||||
|
||||
FALLBACK:
|
||||
# Fall back for a bogus namespace
|
||||
bogus/ fallback.html
|
|
@ -0,0 +1 @@
|
|||
Content-Type: text/cache-manifest
|
|
@ -0,0 +1,37 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://localhost:8888/tests/dom/tests/mochitest/ajax/offline/overlap.cacheManifest">
|
||||
<head>
|
||||
<title>overlapping namespaces 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" />
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function manifestUpdated()
|
||||
{
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "bogus/specific/test.html", false);
|
||||
xhr.send();
|
||||
|
||||
OfflineTest.is(xhr.status, 200, "Should have fallen back.");
|
||||
OfflineTest.teardown();
|
||||
OfflineTest.finish();
|
||||
}
|
||||
|
||||
if (OfflineTest.setup()) {
|
||||
applicationCache.onerror = OfflineTest.failEvent;
|
||||
applicationCache.oncached = OfflineTest.priv(manifestUpdated);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1771,26 +1771,40 @@ nsOfflineCacheDevice::GetMatchingNamespace(const nsCString &clientID,
|
|||
|
||||
*out = nsnull;
|
||||
|
||||
if (hasRows)
|
||||
PRBool found = PR_FALSE;
|
||||
nsCString nsSpec;
|
||||
PRInt32 nsType;
|
||||
nsCString nsData;
|
||||
|
||||
while (hasRows)
|
||||
{
|
||||
nsCString namespaceSpec;
|
||||
rv = statement->GetUTF8String(0, namespaceSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCString data;
|
||||
rv = statement->GetUTF8String(1, data);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 itemType;
|
||||
rv = statement->GetInt32(2, &itemType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!found || itemType > nsType)
|
||||
{
|
||||
nsType = itemType;
|
||||
|
||||
rv = statement->GetUTF8String(0, nsSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = statement->GetUTF8String(1, nsData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
found = PR_TRUE;
|
||||
}
|
||||
|
||||
rv = statement->ExecuteStep(&hasRows);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (found) {
|
||||
nsCOMPtr<nsIApplicationCacheNamespace> ns =
|
||||
new nsApplicationCacheNamespace();
|
||||
if (!ns)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = ns->Init(itemType, namespaceSpec, data);
|
||||
rv = ns->Init(nsType, nsSpec, nsData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ns.swap(*out);
|
||||
|
|
Загрузка…
Ссылка в новой задаче