Bug 1011150 - HTTP cache v2: reimplement AsyncDoomURI for appcache storage, r=michal

This commit is contained in:
Honza Bambas 2014-05-18 20:03:57 +02:00
Родитель 9cb543b9fe
Коммит e72e80c669
4 изменённых файлов: 12 добавлений и 20 удалений

Просмотреть файл

@ -94,9 +94,9 @@ NS_IMETHODIMP AppCacheStorage::AsyncDoomURI(nsIURI *aURI, const nsACString & aId
return NS_ERROR_NOT_AVAILABLE;
}
// TODO - remove entry from app cache
// I think no one is using this...
return NS_ERROR_NOT_IMPLEMENTED;
nsRefPtr<_OldStorage> old = new _OldStorage(
LoadInfo(), WriteToDisk(), LookupAppCache(), true, mAppCache);
return old->AsyncDoomURI(aURI, aIdExtension, aCallback);
}
NS_IMETHODIMP AppCacheStorage::AsyncEvictStorage(nsICacheEntryDoomCallback* aCallback)
@ -131,12 +131,12 @@ NS_IMETHODIMP AppCacheStorage::AsyncEvictStorage(nsICacheEntryDoomCallback* aCal
}
else {
// Discard the group
nsAutoCString groupID;
rv = mAppCache->GetGroupID(groupID);
nsRefPtr<_OldStorage> old = new _OldStorage(
LoadInfo(), WriteToDisk(), LookupAppCache(), true, mAppCache);
rv = old->AsyncEvictStorage(aCallback);
NS_ENSURE_SUCCESS(rv, rv);
rv = appCacheService->DeactivateGroup(groupID);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
if (aCallback)

Просмотреть файл

@ -64,7 +64,6 @@ protected:
bool mLookupAppCache : 1;
public:
nsIApplicationCache* AppCache() const { return nullptr; }
nsILoadContextInfo* LoadInfo() const { return mLoadContextInfo; }
bool WriteToDisk() const { return mWriteToDisk && !mLoadContextInfo->IsPrivate(); }
bool LookupAppCache() const { return mLookupAppCache; }

Просмотреть файл

@ -94,9 +94,9 @@ function asyncOpenCacheEntry(key, where, flags, lci, callback, appcache)
(new CacheListener()).run();
}
function syncWithCacheIOThread(callback)
function syncWithCacheIOThread(callback, force)
{
if (!newCacheBackEndUsed()) {
if (!newCacheBackEndUsed() || force) {
asyncOpenCacheEntry(
"http://nonexistententry/", "disk", Ci.nsICacheStorage.OPEN_READONLY, null,
function(status, entry) {

Просмотреть файл

@ -154,7 +154,7 @@ function start_cache_nonpinned_app() {
break;
}
},
function (appcahe) {
function (appcache) {
do_print("app avail " + appcache + "\n");
});
}
@ -201,7 +201,7 @@ function check_evict_cache(appcache) {
kHttpLocation + "pages/foo3",
"appcache", Ci.nsICacheStorage.OPEN_READONLY, null,
function(status, entry, appcache) {
hold_entry_foo3 = entry;
var hold_entry_foo3 = entry;
// evict all documents.
let storage = get_cache_service().appCacheStorage(LoadContextInfo.default, appcache);
@ -254,20 +254,13 @@ function check_evict_cache(appcache) {
do_check_eq(file.exists(), false);
httpServer.stop(do_test_finished);
});
}, true /* force even with the new cache back end */);
},
appcache
);
}
function run_test() {
if (newCacheBackEndUsed()) {
// times out on storage.asyncDoomURI @ check_bug because that method is not implemented for appcache
// either revert the test changes or implement the method (former seems more reasonable)
do_check_true(true, "This test doesn't run with the new cache backend, the test or the cache needs to be fixed");
return;
}
if (typeof _XPCSHELL_PROCESS == "undefined" ||
_XPCSHELL_PROCESS != "child") {
init_profile();