зеркало из https://github.com/mozilla/pjs.git
More use of nsINode. Bug 325006, r=sicking, sr=peterv
This commit is contained in:
Родитель
5767901ade
Коммит
7afd97edec
|
@ -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()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче