Bug 1264768 - Dispatch error event when image loads for URLs that fail to resolve, r=hsivonen

--HG--
extra : rebase_source : 109914a4204a4dcf2f21e861da269e5bb476acf0
This commit is contained in:
bentian 2016-06-10 15:35:51 +08:00
Родитель 472523ec05
Коммит 33cf3aca7f
1 изменённых файлов: 7 добавлений и 2 удалений

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

@ -748,10 +748,15 @@ nsImageLoadingContent::LoadImage(const nsAString& aNewURI,
return NS_OK;
}
// Second, parse the URI string to get image URI
nsCOMPtr<nsIURI> imageURI;
nsresult rv = StringToURI(aNewURI, doc, getter_AddRefs(imageURI));
NS_ENSURE_SUCCESS(rv, rv);
// XXXbiesi fire onerror if that failed?
if (NS_FAILED(rv)) {
// Cancel image requests and fire error event per spec
CancelImageRequests(aNotify);
FireEvent(NS_LITERAL_STRING("error"));
return NS_OK;
}
bool equal;