mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 01:55:44 +00:00
Bug 292503 Working images should not have alt text that says there is an error
r=biesi sr=jst
This commit is contained in:
parent
6b5d842c09
commit
e01adae362
@ -219,6 +219,20 @@ ImageListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
||||
imageLoader->RemoveObserver(imgDoc);
|
||||
}
|
||||
|
||||
|
||||
if (NS_FAILED(status) && imgDoc->mStringBundle) {
|
||||
nsCAutoString src;
|
||||
imgDoc->mDocumentURI->GetSpec(src);
|
||||
NS_ConvertUTF8toUCS2 srcString(src);
|
||||
const PRUnichar* formatString[1] = { srcString.get() };
|
||||
nsXPIDLString errorMsg;
|
||||
NS_NAMED_LITERAL_STRING(str, "InvalidImage");
|
||||
imgDoc->mStringBundle->FormatStringFromName(str.get(), formatString, 1,
|
||||
getter_Copies(errorMsg));
|
||||
|
||||
imgDoc->mImageContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::alt, errorMsg, PR_FALSE);
|
||||
}
|
||||
|
||||
return nsMediaDocumentStreamListener::OnStopRequest(request, ctxt, status);
|
||||
}
|
||||
|
||||
@ -613,16 +627,7 @@ nsImageDocument::CreateSyntheticDocument()
|
||||
// Make sure not to start the image load from here...
|
||||
imageLoader->SetLoadingEnabled(PR_FALSE);
|
||||
mImageContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::src, srcString, PR_FALSE);
|
||||
|
||||
if (mStringBundle) {
|
||||
const PRUnichar* formatString[1] = { srcString.get() };
|
||||
nsXPIDLString errorMsg;
|
||||
NS_NAMED_LITERAL_STRING(str, "InvalidImage");
|
||||
mStringBundle->FormatStringFromName(str.get(), formatString, 1,
|
||||
getter_Copies(errorMsg));
|
||||
|
||||
mImageContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::alt, errorMsg, PR_FALSE);
|
||||
}
|
||||
mImageContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::alt, srcString, PR_FALSE);
|
||||
|
||||
body->AppendChildTo(mImageContent, PR_FALSE);
|
||||
imageLoader->SetLoadingEnabled(PR_TRUE);
|
||||
|
Loading…
Reference in New Issue
Block a user