Bug 1259482 - Ensure that image loads are never dropped on the floor when queued for later. r=johns

This commit is contained in:
Josh Matthews
2016-03-30 12:39:59 -04:00
parent c9dd0eb7b5
commit 7dd3fd3633
5 changed files with 32 additions and 2 deletions

View File

@@ -98,6 +98,10 @@ public:
return NS_OK;
}
bool AlwaysLoad() {
return mAlwaysLoad;
}
private:
~ImageLoadTask() {}
RefPtr<HTMLImageElement> mElement;
@@ -899,7 +903,13 @@ HTMLImageElement::QueueImageLoadTask(bool aAlwaysLoad)
return;
}
nsCOMPtr<nsIRunnable> task = new ImageLoadTask(this, aAlwaysLoad);
// Ensure that we don't overwrite a previous load request that requires
// a complete load to occur.
bool alwaysLoad = aAlwaysLoad;
if (mPendingImageLoadTask) {
alwaysLoad = alwaysLoad || mPendingImageLoadTask->AlwaysLoad();
}
RefPtr<ImageLoadTask> task = new ImageLoadTask(this, alwaysLoad);
// The task checks this to determine if it was the last
// queued event, and so earlier tasks are implicitly canceled.
mPendingImageLoadTask = task;