Skip to content

Commit

Permalink
Bug 1641682. Don't kick off a validation network request if the origi…
Browse files Browse the repository at this point in the history
…nal image network request hasn't finished. r=aosmond

Differential Revision: https://phabricator.services.mozilla.com/D78858
  • Loading branch information
tnikkel committed Jun 11, 2020
1 parent 2a1f38a commit 04d7907
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions image/imgLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1929,6 +1929,29 @@ bool imgLoader::ValidateEntry(
return false;
}

bool requestGotLoad = false;
RefPtr<ProgressTracker> tracker;
RefPtr<mozilla::image::Image> image = request->GetImage();
if (image) {
tracker = image->GetProgressTracker();
} else {
tracker = request->GetProgressTracker();
}
if (tracker) {
if ((tracker->GetProgress() & (FLAG_LOAD_COMPLETE | FLAG_HAS_ERROR)) ==
FLAG_LOAD_COMPLETE) {
requestGotLoad = true;
}
}
// If the original request is still transferring don't kick off a validation
// network request because it is a bit silly to issue a validation request if
// the original request hasn't even finished yet. So just return true
// indicating the caller can create a new proxy for the request and use it as
// is.
if (!requestGotLoad) {
return true;
}

if (validateRequest && aCanMakeNewChannel) {
LOG_SCOPE(gImgLog, "imgLoader::ValidateRequest |cache hit| must validate");

Expand Down

0 comments on commit 04d7907

Please sign in to comment.