author | Ehsan Akhgari <ehsan@mozilla.com> |
Tue, 21 Apr 2015 21:13:30 -0400 | |
changeset 241223 | e0f7cbf55fdf504001b81475b9d1d38f2e9ce433 |
parent 241222 | 333aaffb8ad7eb94ff1a1cdc9f9e4cd76e16b61c |
child 241224 | b0480e99fa3838dedb90eb67fe38551177528b0e |
push id | 59053 |
push user | eakhgari@mozilla.com |
push date | Mon, 27 Apr 2015 17:04:38 +0000 |
treeherder | mozilla-inbound@5496344c05e9 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | michal |
bugs | 1156771, 1136780 |
milestone | 40.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
netwerk/protocol/http/nsHttpChannel.cpp | file | annotate | diff | comparison | revisions | |
netwerk/protocol/http/nsHttpChannel.h | file | annotate | diff | comparison | revisions |
--- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -78,16 +78,20 @@ #include "nsIX509Cert.h" #include "ScopedNSSTypes.h" #include "nsNullPrincipal.h" namespace mozilla { namespace net { namespace { +// Monotonically increasing ID for generating unique cache entries per +// intercepted channel. +static uint64_t gNumIntercepted = 0; + // True if the local cache should be bypassed when processing a request. #define BYPASS_LOCAL_CACHE(loadFlags) \ (loadFlags & (nsIRequest::LOAD_BYPASS_CACHE | \ nsICachingChannel::LOAD_BYPASS_LOCAL_CACHE)) #define RECOVER_FROM_CACHE_FILE_ERROR(result) \ ((result) == NS_ERROR_FILE_NOT_FOUND || \ (result) == NS_ERROR_FILE_CORRUPTED || \ @@ -218,16 +222,17 @@ AutoRedirectVetoNotifier::ReportRedirect nsHttpChannel::nsHttpChannel() : HttpAsyncAborter<nsHttpChannel>(this) , mLogicalOffset(0) , mPostID(0) , mRequestTime(0) , mOfflineCacheLastModifiedTime(0) , mInterceptCache(DO_NOT_INTERCEPT) + , mInterceptionID(gNumIntercepted++) , mCachedContentIsValid(false) , mCachedContentIsPartial(false) , mCacheOnlyMetadata(false) , mTransactionReplaced(false) , mAuthRetryPending(false) , mProxyAuthPending(false) , mResuming(false) , mInitedCacheEntry(false) @@ -2777,17 +2782,17 @@ nsHttpChannel::OpenCacheEntry(bool isHtt // When removed, remove the flags and related code snippets. if (mLoadFlags & LOAD_BYPASS_LOCAL_CACHE_IF_BUSY) cacheEntryOpenFlags |= nsICacheStorage::OPEN_BYPASS_IF_BUSY; if (mPostID) { extension.Append(nsPrintfCString("%d", mPostID)); } if (PossiblyIntercepted()) { - extension.Append('u'); + extension.Append(nsPrintfCString("u%lld", mInterceptionID)); } // If this channel should be intercepted, we do not open a cache entry for this channel // until the interception process is complete and the consumer decides what to do with it. if (mInterceptCache == MAYBE_INTERCEPT) { nsCOMPtr<nsICacheEntry> entry; rv = cacheStorage->OpenTruncate(openURI, extension, getter_AddRefs(entry)); NS_ENSURE_SUCCESS(rv, rv);
--- a/netwerk/protocol/http/nsHttpChannel.h +++ b/netwerk/protocol/http/nsHttpChannel.h @@ -413,16 +413,18 @@ private: nsCOMPtr<nsIHttpChannelAuthProvider> mAuthProvider; // States of channel interception enum { DO_NOT_INTERCEPT, // no interception will occur MAYBE_INTERCEPT, // interception in progress, but can be cancelled INTERCEPTED, // a synthesized response has been provided } mInterceptCache; + // Unique ID of this channel for the interception purposes. + const uint64_t mInterceptionID; bool PossiblyIntercepted() { return mInterceptCache != DO_NOT_INTERCEPT; } // If the channel is associated with a cache, and the URI matched // a fallback namespace, this will hold the key for the fallback // cache entry.