Fix bug 325005. r=sicking, sr=jst

This commit is contained in:
bzbarsky%mit.edu 2006-01-31 01:47:30 +00:00
Родитель 6d2a2d10dd
Коммит 2ba1e3e5e0
1 изменённых файлов: 18 добавлений и 21 удалений

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

@ -53,30 +53,27 @@ nsDataDocumentContentPolicy::ShouldLoad(PRUint32 aContentType,
PRInt16 *aDecision)
{
*aDecision = nsIContentPolicy::ACCEPT;
if (aContentType == nsIContentPolicy::TYPE_IMAGE ||
aContentType == nsIContentPolicy::TYPE_STYLESHEET ||
aContentType == nsIContentPolicy::TYPE_SCRIPT) {
// Look for the document. In most cases, aRequestingContext is a
// content node.
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIContent> content = do_QueryInterface(aRequestingContext);
if (content) {
doc = content->GetOwnerDoc();
} else {
doc = do_QueryInterface(aRequestingContext);
if (!doc) {
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(aRequestingContext);
if (window) {
nsCOMPtr<nsIDOMDocument> domDoc;
window->GetDocument(getter_AddRefs(domDoc));
doc = do_QueryInterface(domDoc);
}
// Look for the document. In most cases, aRequestingContext is a
// content node.
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIContent> content = do_QueryInterface(aRequestingContext);
if (content) {
doc = content->GetOwnerDoc();
} else {
doc = do_QueryInterface(aRequestingContext);
if (!doc) {
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(aRequestingContext);
if (window) {
nsCOMPtr<nsIDOMDocument> domDoc;
window->GetDocument(getter_AddRefs(domDoc));
doc = do_QueryInterface(domDoc);
}
}
if (doc && doc->IsLoadedAsData()) {
*aDecision = nsIContentPolicy::REJECT_TYPE;
}
}
if (doc && doc->IsLoadedAsData()) {
*aDecision = nsIContentPolicy::REJECT_TYPE;
}
return NS_OK;
}