mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 854799: Make image.src='' discard the image immediately even if the image is not in the document. r=jlebar
This commit is contained in:
parent
7709d7e26d
commit
c1ef5de8fc
@ -1326,21 +1326,34 @@ nsImageLoadingContent::UntrackImage(imgIRequest* aImage, uint32_t aFlags /* = 0
|
|||||||
MOZ_ASSERT(aImage == mCurrentRequest || aImage == mPendingRequest,
|
MOZ_ASSERT(aImage == mCurrentRequest || aImage == mPendingRequest,
|
||||||
"Why haven't we heard of this request?");
|
"Why haven't we heard of this request?");
|
||||||
|
|
||||||
// If GetOurDocument() returns null here, we've outlived our document.
|
// We may not be in the document. If we're not in the document because it
|
||||||
// That's fine, because the document empties out the tracker and unlocks
|
// has already been unlinked that's fine; the document empties out the tracker
|
||||||
// all locked images on destruction.
|
// and unlocks all locked images on destruction. If we were really not in the
|
||||||
|
// document we may need to force discarding the image here, since this is the
|
||||||
|
// only chance we have, even though we couldn't possibly have been in the
|
||||||
|
// tracker.
|
||||||
nsIDocument* doc = GetOurCurrentDoc();
|
nsIDocument* doc = GetOurCurrentDoc();
|
||||||
if (doc) {
|
if (aImage == mCurrentRequest) {
|
||||||
if (aImage == mCurrentRequest && (mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
|
if (doc && (mCurrentRequestFlags & REQUEST_IS_TRACKED)) {
|
||||||
mCurrentRequestFlags &= ~REQUEST_IS_TRACKED;
|
mCurrentRequestFlags &= ~REQUEST_IS_TRACKED;
|
||||||
doc->RemoveImage(mCurrentRequest,
|
doc->RemoveImage(mCurrentRequest,
|
||||||
(aFlags & REQUEST_DISCARD) ? nsIDocument::REQUEST_DISCARD : 0);
|
(aFlags & REQUEST_DISCARD) ? nsIDocument::REQUEST_DISCARD : 0);
|
||||||
}
|
}
|
||||||
if (aImage == mPendingRequest && (mPendingRequestFlags & REQUEST_IS_TRACKED)) {
|
else if (aFlags & REQUEST_DISCARD) {
|
||||||
|
// If we're not in the document we may still need to be discarded.
|
||||||
|
aImage->RequestDiscard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (aImage == mPendingRequest) {
|
||||||
|
if (doc && (mPendingRequestFlags & REQUEST_IS_TRACKED)) {
|
||||||
mPendingRequestFlags &= ~REQUEST_IS_TRACKED;
|
mPendingRequestFlags &= ~REQUEST_IS_TRACKED;
|
||||||
doc->RemoveImage(mPendingRequest,
|
doc->RemoveImage(mPendingRequest,
|
||||||
(aFlags & REQUEST_DISCARD) ? nsIDocument::REQUEST_DISCARD : 0);
|
(aFlags & REQUEST_DISCARD) ? nsIDocument::REQUEST_DISCARD : 0);
|
||||||
}
|
}
|
||||||
|
else if (aFlags & REQUEST_DISCARD) {
|
||||||
|
// If we're not in the document we may still need to be discarded.
|
||||||
|
aImage->RequestDiscard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user