Bug 1163911 - Make responsive images block the document load event while the load task is queued. r=jst

This commit is contained in:
Josh Matthews
2015-06-06 09:21:56 -04:00
parent 40c4f44d62
commit 51dbdd345c
2 changed files with 7 additions and 3 deletions

View File

@@ -85,7 +85,10 @@ class ImageLoadTask : public nsRunnable
public:
explicit ImageLoadTask(HTMLImageElement *aElement) :
mElement(aElement)
{}
{
mDocument = aElement->OwnerDoc();
mDocument->BlockOnload();
}
NS_IMETHOD Run()
{
@@ -93,12 +96,14 @@ public:
mElement->mPendingImageLoadTask = nullptr;
mElement->LoadSelectedImage(true, true);
}
mDocument->UnblockOnload(false);
return NS_OK;
}
private:
~ImageLoadTask() {}
nsRefPtr<HTMLImageElement> mElement;
nsCOMPtr<nsIDocument> mDocument;
};
HTMLImageElement::HTMLImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)