mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1460940 - Convert nsSyncLoadService::LoadDocument to use nsIDocument. r=bz
MozReview-Commit-ID: LtFdEVXDvLw --HG-- extra : rebase_source : 9fe20ccaa54525b8b10b6fbad74968a497929193
This commit is contained in:
parent
4fca802957
commit
b3a78c6c93
@ -18,7 +18,6 @@
|
||||
#include "nsString.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsContentUtils.h" // for kLoadAsData
|
||||
#include "nsThreadUtils.h"
|
||||
@ -47,7 +46,7 @@ public:
|
||||
nsresult LoadDocument(nsIChannel* aChannel,
|
||||
bool aChannelIsSync, bool aForceToXML,
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
nsIDOMDocument** aResult);
|
||||
nsIDocument** aResult);
|
||||
|
||||
NS_FORWARD_NSISTREAMLISTENER(mListener->)
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
@ -135,7 +134,7 @@ nsSyncLoader::LoadDocument(nsIChannel* aChannel,
|
||||
bool aChannelIsSync,
|
||||
bool aForceToXML,
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
nsIDOMDocument **aResult)
|
||||
nsIDocument **aResult)
|
||||
{
|
||||
NS_ENSURE_ARG(aChannel);
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
@ -211,7 +210,9 @@ nsSyncLoader::LoadDocument(nsIChannel* aChannel,
|
||||
|
||||
NS_ENSURE_TRUE(document->GetRootElement(), NS_ERROR_FAILURE);
|
||||
|
||||
return CallQueryInterface(document, aResult);
|
||||
document.forget(aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -313,7 +314,7 @@ nsSyncLoadService::LoadDocument(nsIURI *aURI,
|
||||
nsILoadGroup *aLoadGroup,
|
||||
bool aForceToXML,
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
nsIDOMDocument** aResult)
|
||||
nsIDocument** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
nsresult rv = NS_NewChannel(getter_AddRefs(channel),
|
||||
|
@ -19,7 +19,7 @@ class nsILoadGroup;
|
||||
class nsIStreamListener;
|
||||
class nsIURI;
|
||||
class nsIPrincipal;
|
||||
class nsIDOMDocument;
|
||||
class nsIDocument;
|
||||
class nsIChannel;
|
||||
|
||||
class nsSyncLoadService
|
||||
@ -46,7 +46,7 @@ public:
|
||||
nsILoadGroup *aLoadGroup,
|
||||
bool aForceToXML,
|
||||
mozilla::net::ReferrerPolicy aReferrerPolicy,
|
||||
nsIDOMDocument** aResult);
|
||||
nsIDocument** aResult);
|
||||
|
||||
/**
|
||||
* Read input stream aIn in chunks and deliver synchronously to aListener.
|
||||
|
@ -102,7 +102,7 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument,
|
||||
NS_LITERAL_CSTRING("chrome://global/content/xml/XMLPrettyPrint.xsl"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> xslDocument;
|
||||
nsCOMPtr<nsIDocument> xslDocument;
|
||||
rv = nsSyncLoadService::LoadDocument(xslUri, nsIContentPolicy::TYPE_XSLT,
|
||||
nsContentUtils::GetSystemPrincipal(),
|
||||
nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
|
||||
@ -113,8 +113,7 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument,
|
||||
// Transform the document
|
||||
RefPtr<txMozillaXSLTProcessor> transformer = new txMozillaXSLTProcessor();
|
||||
ErrorResult err;
|
||||
nsCOMPtr<nsIDocument> xslDoc = do_QueryInterface(xslDocument);
|
||||
transformer->ImportStylesheet(*xslDoc, err);
|
||||
transformer->ImportStylesheet(*xslDocument, err);
|
||||
if (NS_WARN_IF(err.Failed())) {
|
||||
return err.StealNSResult();
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ txParseDocumentFromURI(const nsAString& aHref,
|
||||
|
||||
// Raw pointer, we want the resulting txXPathNode to hold a reference to
|
||||
// the document.
|
||||
nsIDOMDocument* theDocument = nullptr;
|
||||
nsIDocument* theDocument = nullptr;
|
||||
nsAutoSyncOperation sync(loaderDocument);
|
||||
rv = nsSyncLoadService::LoadDocument(documentURI,
|
||||
nsIContentPolicy::TYPE_INTERNAL_XMLHTTPREQUEST,
|
||||
@ -52,7 +52,8 @@ txParseDocumentFromURI(const nsAString& aHref,
|
||||
return NS_FAILED(rv) ? rv : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*aResult = txXPathNativeNode::createXPathNode(theDocument);
|
||||
nsCOMPtr<nsIDOMDocument> domDocument = do_QueryInterface(theDocument);
|
||||
*aResult = txXPathNativeNode::createXPathNode(domDocument);
|
||||
if (!*aResult) {
|
||||
NS_RELEASE(theDocument);
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -635,7 +635,7 @@ txSyncCompileObserver::loadURI(const nsAString& aUri,
|
||||
source = mProcessor->GetSourceContentModel();
|
||||
}
|
||||
nsAutoSyncOperation sync(source ? source->OwnerDoc() : nullptr);
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
|
||||
rv = nsSyncLoadService::LoadDocument(uri, nsIContentPolicy::TYPE_XSLT,
|
||||
referrerPrincipal,
|
||||
@ -645,8 +645,7 @@ txSyncCompileObserver::loadURI(const nsAString& aUri,
|
||||
getter_AddRefs(document));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(document);
|
||||
rv = handleNode(doc, aCompiler);
|
||||
rv = handleNode(document, aCompiler);
|
||||
if (NS_FAILED(rv)) {
|
||||
nsAutoCString spec;
|
||||
uri->GetSpec(spec);
|
||||
|
Loading…
Reference in New Issue
Block a user