зеркало из https://github.com/mozilla/pjs.git
Bug 422264: retrieving iterator of applicationCache throws NS_ERROR_DOM_INVALID_STATE_ERR. r+sr=jst
This commit is contained in:
Родитель
3dc9586ad1
Коммит
484e68ef46
|
@ -275,13 +275,14 @@ nsDOMOfflineResourceList::Disconnect()
|
|||
NS_IMETHODIMP
|
||||
nsDOMOfflineResourceList::GetLength(PRUint32 *aLength)
|
||||
{
|
||||
if (!mManifestURI) {
|
||||
*aLength = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!nsContentUtils::OfflineAppAllowed(mDocumentURI)) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
rv = CacheKeys();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -295,10 +296,6 @@ nsDOMOfflineResourceList::Item(PRUint32 aIndex, nsAString& aURI)
|
|||
nsresult rv = Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!nsContentUtils::OfflineAppAllowed(mDocumentURI)) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
SetDOMStringToNull(aURI);
|
||||
|
||||
rv = CacheKeys();
|
||||
|
|
|
@ -50,6 +50,7 @@ _TEST_FILES = \
|
|||
test_badManifestMagic.html \
|
||||
test_badManifestMime.html \
|
||||
test_missingFile.html \
|
||||
test_noManifest.html \
|
||||
test_simpleManifest.html \
|
||||
test_identicalManifest.html \
|
||||
test_changingManifest.html \
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>bad manifest content type</title>
|
||||
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function expectInvalidState(fn, desc) {
|
||||
var gotInvalidState = false;
|
||||
try {
|
||||
fn();
|
||||
} catch(e) {
|
||||
if (e.code == DOMException.INVALID_STATE_ERR) {
|
||||
gotInvalidState = true;
|
||||
}
|
||||
}
|
||||
|
||||
ok(gotInvalidState, desc);
|
||||
}
|
||||
|
||||
is(typeof(applicationCache), "object");
|
||||
is(applicationCache.length, 0, "applicationCache.length should be 0");
|
||||
is(applicationCache.status, 0, "applicationCache.status should be 0 (UNCACHED)");
|
||||
|
||||
expectInvalidState(function() { applicationCache.add("http://localhost:8888/MochiKit/packed.js"); },
|
||||
"applicationCache.add should throw INVALID_STATE_ERR");
|
||||
expectInvalidState(function() { applicationCache.remove("http://localhost:8888/MochiKit/packed.js"); },
|
||||
"applicationCache.remove should throw INVALID_STATE_ERR");
|
||||
expectInvalidState(function() { applicationCache.update(); },
|
||||
"applicationCache.update should throw INVALID_STATE_ERR");
|
||||
expectInvalidState(function() { applicationCache.swapCache(); },
|
||||
"applicationCache.update should throw INVALID_STATE_ERR");
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче