fix an assert M1416774

This commit is contained in:
Cameron Kaiser 2018-10-27 17:45:28 -07:00
parent 3926185105
commit c9ed275af7
3 changed files with 17 additions and 4 deletions

View File

@ -2757,6 +2757,12 @@ imgCacheValidator::AddProxy(imgRequestProxy* aProxy)
mProxies.AppendObject(aProxy);
}
void
imgCacheValidator::RemoveProxy(imgRequestProxy* aProxy)
{
mProxies.RemoveObject(aProxy);
}
/** nsIRequestObserver methods **/
NS_IMETHODIMP

View File

@ -529,6 +529,7 @@ public:
bool forcePrincipalCheckForCacheEntry);
void AddProxy(imgRequestProxy* aProxy);
void RemoveProxy(imgRequestProxy* aProxy);
NS_DECL_ISUPPORTS
NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER

View File

@ -338,14 +338,20 @@ imgRequestProxy::CancelAndForgetObserver(nsresult aStatus)
mCanceled = true;
imgRequest* owner = GetOwner();
if (owner) {
imgCacheValidator* validator = owner->GetValidator();
if (validator) {
validator->RemoveProxy(this);
}
owner->RemoveProxy(this, aStatus);
}
// Now cheat and make sure our removal from loadgroup happens async
bool oldIsInLoadGroup = mIsInLoadGroup;
mIsInLoadGroup = false;
if (GetOwner()) {
GetOwner()->RemoveProxy(this, aStatus);
}
mIsInLoadGroup = oldIsInLoadGroup;
if (mIsInLoadGroup) {