Fixing bug 269125. Make image.onerror fire for non-existent files. Patch by trev@gtchat.de, r=jst@mozilla.org, sr=bzbarsky@mit.edu

This commit is contained in:
jst%mozilla.jstenback.com 2005-08-17 23:01:09 +00:00
Родитель 9e4767d66b
Коммит 87858f62d4
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -398,6 +398,7 @@ nsImageLoadingContent::ImageURIChanged(const nsAString& aNewURI,
PRBool aForce)
{
if (!mLoadingEnabled) {
FireEvent(NS_LITERAL_STRING("error"));
return NS_OK;
}
@ -454,6 +455,7 @@ nsImageLoadingContent::ImageURIChanged(const nsAString& aNewURI,
if (!loadImage) {
// Don't actually load anything! This was blocked by CanLoadImage.
FireEvent(NS_LITERAL_STRING("error"));
return NS_OK;
}
@ -473,6 +475,11 @@ nsImageLoadingContent::ImageURIChanged(const nsAString& aNewURI,
rv = nsContentUtils::LoadImage(imageURI, doc, doc->GetDocumentURI(),
this, nsIRequest::LOAD_NORMAL,
getter_AddRefs(req));
if (NS_FAILED(rv)) {
FireEvent(NS_LITERAL_STRING("error"));
return NS_OK;
}
// If we now have a current request, we don't need to store the URI, since
// we can get it off the request. Release it.
if (mCurrentRequest) {