diff --git a/configure.in b/configure.in index 66528278c83d..bec544ae8e39 100644 --- a/configure.in +++ b/configure.in @@ -3815,13 +3815,16 @@ AC_ARG_ENABLE(verbose-config-defs, VERBOSE_CONFIG_DEFS= fi]) -dnl New cache is not yet enabled by default. This is a temporary -dnl option for testing -MOZ_ARG_ENABLE_BOOL(new-cache, -[ --enable-new-cache Enable new cache], - MOZ_NEW_CACHE=1 - AC_DEFINE(MOZ_NEW_CACHE)) - +dnl New cache is now enabled by default. +MOZ_NEW_CACHE=1 +dnl The new cache may be optionally disabled in favor of the old cache +dnl for performance testing. +MOZ_ARG_DISABLE_BOOL(new-cache, +[ --disable-new-cache Disable new cache], + MOZ_NEW_CACHE=0) +if test "$MOZ_NEW_CACHE" = "1"; then + AC_DEFINE(MOZ_NEW_CACHE) +fi AC_SUBST(MOZ_NEW_CACHE) dnl New image library is not yet enabled by default. This is a temporary diff --git a/netwerk/protocol/http/src/nsHTTPChannel.cpp b/netwerk/protocol/http/src/nsHTTPChannel.cpp index b0fe8ea72677..0ceb5e7667ee 100644 --- a/netwerk/protocol/http/src/nsHTTPChannel.cpp +++ b/netwerk/protocol/http/src/nsHTTPChannel.cpp @@ -1387,8 +1387,17 @@ nsHTTPChannel::CacheReceivedResponse(nsIStreamListener *aListener, // Store secure data in memory only nsCOMPtr securityInfo; rv = GetSecurityInfo(getter_AddRefs(securityInfo)); - if (NS_SUCCEEDED(rv) && securityInfo) - mCacheEntry->SetSecurityInfo(securityInfo); + if (NS_SUCCEEDED(rv) && securityInfo) { + rv = mCacheEntry->SetSecurityInfo(securityInfo); + if (NS_FAILED(rv)) return rv; + } + + // For HTTPS connections, the storage policy will already be IN_MEMORY. + // We are concerned instead about load attributes which may have changed. + if (mLoadAttributes & nsIChannel::INHIBIT_PERSISTENT_CACHING) { + rv = mCacheEntry->SetStoragePolicy(nsICache::STORE_IN_MEMORY); + if (NS_FAILED(rv)) return rv; + } // Set the expiration time for this cache entry rv = UpdateExpirationTime(); @@ -2414,6 +2423,10 @@ nsresult nsHTTPChannel::ResponseCompleted(nsIStreamListener *aListener, "OnStopRequest to consumer failed! Status:%x\n", this, rv)); } +#ifdef MOZ_NEW_CACHE + mResponseDataListener = 0; +#endif + // Release the cache entry as soon as we are done. This helps as it can // flush any cache records and do maintenance. But do this only after // stopRequest has been fired as the stopListeners could want to use @@ -2438,7 +2451,9 @@ nsresult nsHTTPChannel::ResponseCompleted(nsIStreamListener *aListener, // it needs to be valid for the life of the channel // mResponseContext = 0; +#ifndef MOZ_NEW_CACHE mResponseDataListener = 0; +#endif NS_IF_RELEASE(mCachedResponse); return rv;