mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-19 07:26:26 +00:00
Bug 1416774 - Ensure that imgRequestProxy::CancelAndForgetObserver removes itself from the cache validator. r=tnikkel
An imgRequestProxy may defer notifications when it needs to block on an imgCacheValidator. It may also be cancelled before the validator has completed its operation, but before this change, we did not remove the request from the set of proxies, imgCacheValidator::mProxies. When the deferral was completed, it would assert to ensure each proxy was still expecting a deferral before issuing the notifications. Cancelling a request can actually reset that state, which means we fail the assert. Failing the assert is actually harmless; in release we suffer no negative consequences as a result of this sequence of events. Now we just remove the proxy from the validator set to avoid asserting.
This commit is contained in:
parent
3898a0e472
commit
a230c70963
@ -2908,6 +2908,12 @@ imgCacheValidator::AddProxy(imgRequestProxy* aProxy)
|
||||
mProxies.AppendObject(aProxy);
|
||||
}
|
||||
|
||||
void
|
||||
imgCacheValidator::RemoveProxy(imgRequestProxy* aProxy)
|
||||
{
|
||||
mProxies.RemoveObject(aProxy);
|
||||
}
|
||||
|
||||
/** nsIRequestObserver methods **/
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -555,6 +555,7 @@ public:
|
||||
bool forcePrincipalCheckForCacheEntry);
|
||||
|
||||
void AddProxy(imgRequestProxy* aProxy);
|
||||
void RemoveProxy(imgRequestProxy* aProxy);
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
|
||||
|
@ -517,8 +517,14 @@ imgRequestProxy::CancelAndForgetObserver(nsresult aStatus)
|
||||
mCanceled = true;
|
||||
mForceDispatchLoadGroup = true;
|
||||
|
||||
if (GetOwner()) {
|
||||
GetOwner()->RemoveProxy(this, aStatus);
|
||||
imgRequest* owner = GetOwner();
|
||||
if (owner) {
|
||||
imgCacheValidator* validator = owner->GetValidator();
|
||||
if (validator) {
|
||||
validator->RemoveProxy(this);
|
||||
}
|
||||
|
||||
owner->RemoveProxy(this, aStatus);
|
||||
}
|
||||
|
||||
RemoveFromLoadGroup();
|
||||
|
Loading…
x
Reference in New Issue
Block a user