forked from mirrors/gecko-dev
Bug 1755032. Fix data race on imgRequest::mInnerWindowId. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D138623
This commit is contained in:
parent
39ae6761a9
commit
6846d0c094
2 changed files with 18 additions and 9 deletions
|
|
@ -57,7 +57,6 @@ imgRequest::imgRequest(imgLoader* aLoader, const ImageCacheKey& aCacheKey)
|
|||
mLoadId(nullptr),
|
||||
mFirstProxy(nullptr),
|
||||
mValidator(nullptr),
|
||||
mInnerWindowId(0),
|
||||
mCORSMode(CORS_NONE),
|
||||
mImageErrorCode(NS_OK),
|
||||
mImageAvailable(false),
|
||||
|
|
@ -65,6 +64,7 @@ imgRequest::imgRequest(imgLoader* aLoader, const ImageCacheKey& aCacheKey)
|
|||
mIsCrossSiteNoCORSRequest(false),
|
||||
mMutex("imgRequest"),
|
||||
mProgressTracker(new ProgressTracker()),
|
||||
mInnerWindowId(0),
|
||||
mIsMultiPartChannel(false),
|
||||
mIsInCache(false),
|
||||
mDecodeRequested(false),
|
||||
|
|
@ -276,6 +276,16 @@ nsresult imgRequest::RemoveProxy(imgRequestProxy* proxy, nsresult aStatus) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
uint64_t imgRequest::InnerWindowID() const {
|
||||
MutexAutoLock lock(mMutex);
|
||||
return mInnerWindowId;
|
||||
}
|
||||
|
||||
void imgRequest::SetInnerWindowID(uint64_t aInnerWindowId) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
mInnerWindowId = aInnerWindowId;
|
||||
}
|
||||
|
||||
void imgRequest::CancelAndAbort(nsresult aStatus) {
|
||||
LOG_SCOPE(gImgLog, "imgRequest::CancelAndAbort");
|
||||
|
||||
|
|
@ -960,6 +970,7 @@ imgRequest::OnDataAvailable(nsIRequest* aRequest, nsIInputStream* aInStr,
|
|||
RefPtr<ProgressTracker> progressTracker;
|
||||
bool isMultipart = false;
|
||||
bool newPartPending = false;
|
||||
uint64_t innerWindowId = 0;
|
||||
|
||||
// Retrieve and update our state.
|
||||
{
|
||||
|
|
@ -969,6 +980,7 @@ imgRequest::OnDataAvailable(nsIRequest* aRequest, nsIInputStream* aInStr,
|
|||
isMultipart = mIsMultiPartChannel;
|
||||
newPartPending = mNewPartPending;
|
||||
mNewPartPending = false;
|
||||
innerWindowId = mInnerWindowId;
|
||||
}
|
||||
|
||||
// If this is a new part, we need to sniff its content type and create an
|
||||
|
|
@ -976,7 +988,7 @@ imgRequest::OnDataAvailable(nsIRequest* aRequest, nsIInputStream* aInStr,
|
|||
if (newPartPending) {
|
||||
NewPartResult result =
|
||||
PrepareForNewPart(aRequest, aInStr, aCount, mURI, isMultipart, image,
|
||||
progressTracker, mInnerWindowId);
|
||||
progressTracker, innerWindowId);
|
||||
bool succeeded = result.mSucceeded;
|
||||
|
||||
if (result.mImage) {
|
||||
|
|
|
|||
|
|
@ -95,10 +95,8 @@ class imgRequest final : public nsIStreamListener,
|
|||
// Request that we start decoding the image as soon as data becomes available.
|
||||
void StartDecoding();
|
||||
|
||||
inline uint64_t InnerWindowID() const { return mInnerWindowId; }
|
||||
void SetInnerWindowID(uint64_t aInnerWindowId) {
|
||||
mInnerWindowId = aInnerWindowId;
|
||||
}
|
||||
uint64_t InnerWindowID() const;
|
||||
void SetInnerWindowID(uint64_t aInnerWindowId);
|
||||
|
||||
// Set the cache validation information (expiry time, whether we must
|
||||
// validate, etc) on the cache entry based on the request information.
|
||||
|
|
@ -263,9 +261,6 @@ class imgRequest final : public nsIStreamListener,
|
|||
nsCOMPtr<nsIAsyncVerifyRedirectCallback> mRedirectCallback;
|
||||
nsCOMPtr<nsIChannel> mNewRedirectChannel;
|
||||
|
||||
// The ID of the inner window origin, used for error reporting.
|
||||
uint64_t mInnerWindowId;
|
||||
|
||||
// The CORS mode (defined in imgIRequest) this image was loaded with. By
|
||||
// default, CORS_NONE.
|
||||
mozilla::CORSMode mCORSMode;
|
||||
|
|
@ -290,6 +285,8 @@ class imgRequest final : public nsIStreamListener,
|
|||
// must not be a part of this bitfield.
|
||||
RefPtr<ProgressTracker> mProgressTracker;
|
||||
RefPtr<Image> mImage;
|
||||
// The ID of the inner window origin, used for error reporting, profiles.
|
||||
uint64_t mInnerWindowId;
|
||||
bool mIsMultiPartChannel : 1;
|
||||
bool mIsInCache : 1;
|
||||
bool mDecodeRequested : 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue