More use of nsINode. Bug 325006, r=sicking, sr=peterv

This commit is contained in:
bzbarsky%mit.edu 2006-01-31 04:25:22 +00:00
Родитель 5767901ade
Коммит 7afd97edec
1 изменённых файлов: 10 добавлений и 14 удалений

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

@ -37,7 +37,7 @@
#include "nsDataDocumentContentPolicy.h"
#include "nsIDocument.h"
#include "nsIContent.h"
#include "nsINode.h"
#include "nsIDOMWindow.h"
#include "nsIDOMDocument.h"
@ -53,21 +53,17 @@ nsDataDocumentContentPolicy::ShouldLoad(PRUint32 aContentType,
PRInt16 *aDecision)
{
*aDecision = nsIContentPolicy::ACCEPT;
// Look for the document. In most cases, aRequestingContext is a
// content node.
// Look for the document. In most cases, aRequestingContext is a node.
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIContent> content = do_QueryInterface(aRequestingContext);
if (content) {
doc = content->GetOwnerDoc();
nsCOMPtr<nsINode> node = do_QueryInterface(aRequestingContext);
if (node) {
doc = node->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);
}
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(aRequestingContext);
if (window) {
nsCOMPtr<nsIDOMDocument> domDoc;
window->GetDocument(getter_AddRefs(domDoc));
doc = do_QueryInterface(domDoc);
}
}
if (doc && doc->IsLoadedAsData()) {