Bug 1009531 - Failing to use preloaded cache for hosted applications over https, r=jduell

This commit is contained in:
Honza Bambas 2014-07-16 16:16:29 +02:00
parent 1f471feba2
commit 59d1573f6c
2 changed files with 10 additions and 7 deletions

View File

@ -2740,7 +2740,7 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appC
(appCache ||
(mCacheEntryIsReadOnly && !(mLoadFlags & nsIRequest::INHIBIT_CACHING)) ||
mFallbackChannel)) {
rv = OpenCacheInputStream(entry, true);
rv = OpenCacheInputStream(entry, true, !!appCache);
if (NS_SUCCEEDED(rv)) {
mCachedContentIsValid = true;
entry->MaybeMarkValid();
@ -2791,7 +2791,7 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appC
rv = MaybeSetupByteRangeRequest(size, contentLength);
mCachedContentIsPartial = NS_SUCCEEDED(rv) && mIsPartialRequest;
if (mCachedContentIsPartial) {
rv = OpenCacheInputStream(entry, false);
rv = OpenCacheInputStream(entry, false, !!appCache);
*aResult = ENTRY_NEEDS_REVALIDATION;
}
return rv;
@ -2987,7 +2987,7 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appC
}
if (mCachedContentIsValid || mDidReval) {
rv = OpenCacheInputStream(entry, mCachedContentIsValid);
rv = OpenCacheInputStream(entry, mCachedContentIsValid, !!appCache);
if (NS_FAILED(rv)) {
// If we can't get the entity then we have to act as though we
// don't have the cache entry.
@ -3379,7 +3379,8 @@ nsHttpChannel::ShouldUpdateOfflineCacheEntry()
}
nsresult
nsHttpChannel::OpenCacheInputStream(nsICacheEntry* cacheEntry, bool startBuffering)
nsHttpChannel::OpenCacheInputStream(nsICacheEntry* cacheEntry, bool startBuffering,
bool checkingAppCacheEntry)
{
nsresult rv;
@ -3399,8 +3400,9 @@ nsHttpChannel::OpenCacheInputStream(nsICacheEntry* cacheEntry, bool startBufferi
// XXX: We should not be skilling this check in the offline cache
// case, but we have to do so now to work around bug 794507.
MOZ_ASSERT(mCachedSecurityInfo || mLoadedFromApplicationCache);
if (!mCachedSecurityInfo && !mLoadedFromApplicationCache) {
bool mustHaveSecurityInfo = !mLoadedFromApplicationCache && !checkingAppCacheEntry;
MOZ_ASSERT(mCachedSecurityInfo || !mustHaveSecurityInfo);
if (!mCachedSecurityInfo && mustHaveSecurityInfo) {
LOG(("mCacheEntry->GetSecurityInfo returned success but did not "
"return the security info [channel=%p, entry=%p]",
this, cacheEntry));

View File

@ -328,7 +328,8 @@ private:
bool ignoreMissingPartialLen = false) const;
nsresult MaybeSetupByteRangeRequest(int64_t partialLen, int64_t contentLength);
nsresult SetupByteRangeRequest(int64_t partialLen);
nsresult OpenCacheInputStream(nsICacheEntry* cacheEntry, bool startBuffering);
nsresult OpenCacheInputStream(nsICacheEntry* cacheEntry, bool startBuffering,
bool checkingAppCacheEntry);
private:
nsCOMPtr<nsISupports> mSecurityInfo;