Bug 1267075 - Part 2: bail out early if it's for data document. r=bz

Check the document earlier before calling into imageLoader, this could
save us tons of time if in the end the document isn't allowed to load images.
This commit is contained in:
Yoshi Huang 2017-01-19 11:48:00 +08:00
Родитель 5dcdd16255
Коммит 83ef929df9
1 изменённых файлов: 8 добавлений и 0 удалений

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

@ -809,6 +809,14 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI,
}
}
// Data documents, or documents from DOMParser shouldn't perform image loading.
if (aDocument->IsLoadedAsData()) {
SetBlockedRequest(nsIContentPolicy::REJECT_REQUEST);
FireEvent(NS_LITERAL_STRING("error"));
FireEvent(NS_LITERAL_STRING("loadend"));
return NS_OK;
}
// URI equality check.
//
// We skip the equality check if our current image was blocked, since in that