зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1387427) for crashtest assertions on a CLOSED TREE.
Backed out changeset ae0c53b70e5e (bug 1387427) Backed out changeset 45412efc0aff (bug 1387427) --HG-- extra : amend_source : c44efc692191faa5ad73b1142679f739f52fecfc
This commit is contained in:
Родитель
496d14a291
Коммит
cd554f1bcf
|
@ -152,7 +152,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXMLContentSink,
|
|||
const StackNode& node = tmp->mContentStack.ElementAt(i);
|
||||
cb.NoteXPCOMChild(node.mContent);
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentChildren)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
// nsIContentSink
|
||||
|
@ -294,7 +293,8 @@ nsXMLContentSink::DidBuildModel(bool aTerminated)
|
|||
}
|
||||
}
|
||||
|
||||
mXSLTProcessor->SetSourceContentModel(mDocument, mDocumentChildren);
|
||||
nsCOMPtr<nsIDOMDocument> currentDOMDoc(do_QueryInterface(mDocument));
|
||||
mXSLTProcessor->SetSourceContentModel(currentDOMDoc);
|
||||
// Since the processor now holds a reference to us we drop our reference
|
||||
// to it to avoid owning cycles
|
||||
mXSLTProcessor = nullptr;
|
||||
|
@ -358,9 +358,8 @@ NS_IMETHODIMP
|
|||
nsXMLContentSink::OnTransformDone(nsresult aResult,
|
||||
nsIDocument* aResultDocument)
|
||||
{
|
||||
MOZ_ASSERT(aResultDocument, "Don't notify about transform end without a document.");
|
||||
|
||||
mDocumentChildren.Clear();
|
||||
NS_ASSERTION(NS_FAILED(aResult) || aResultDocument,
|
||||
"Don't notify about transform success without a document.");
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aResultDocument);
|
||||
|
||||
|
@ -369,17 +368,28 @@ nsXMLContentSink::OnTransformDone(nsresult aResult,
|
|||
|
||||
if (NS_FAILED(aResult) && contentViewer) {
|
||||
// Transform failed.
|
||||
aResultDocument->SetMayStartLayout(false);
|
||||
// We have an error document.
|
||||
contentViewer->SetDOMDocument(domDoc);
|
||||
if (domDoc) {
|
||||
aResultDocument->SetMayStartLayout(false);
|
||||
// We have an error document.
|
||||
contentViewer->SetDOMDocument(domDoc);
|
||||
}
|
||||
else {
|
||||
// We don't have an error document, display the
|
||||
// untransformed source document.
|
||||
nsCOMPtr<nsIDOMDocument> document = do_QueryInterface(mDocument);
|
||||
contentViewer->SetDOMDocument(document);
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> originalDocument = mDocument;
|
||||
// Transform succeeded, or it failed and we have an error document to display.
|
||||
mDocument = aResultDocument;
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(mDocument);
|
||||
if (htmlDoc) {
|
||||
htmlDoc->SetDocWriteDisabled(false);
|
||||
if (NS_SUCCEEDED(aResult) || aResultDocument) {
|
||||
// Transform succeeded or it failed and we have an error
|
||||
// document to display.
|
||||
mDocument = aResultDocument;
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(mDocument);
|
||||
if (htmlDoc) {
|
||||
htmlDoc->SetDocWriteDisabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Notify document observers that all the content has been stuck
|
||||
|
@ -605,17 +615,12 @@ nsXMLContentSink::AddContentAsLeaf(nsIContent *aContent)
|
|||
{
|
||||
nsresult result = NS_OK;
|
||||
|
||||
if (mState == eXMLContentSinkState_InProlog) {
|
||||
NS_ASSERTION(mDocument, "Fragments have no prolog");
|
||||
mDocumentChildren.AppendElement(aContent);
|
||||
} else if (mState == eXMLContentSinkState_InEpilog) {
|
||||
NS_ASSERTION(mDocument, "Fragments have no epilog");
|
||||
if (mXSLTProcessor) {
|
||||
mDocumentChildren.AppendElement(aContent);
|
||||
} else {
|
||||
mDocument->AppendChildTo(aContent, false);
|
||||
}
|
||||
} else {
|
||||
if ((eXMLContentSinkState_InProlog == mState) ||
|
||||
(eXMLContentSinkState_InEpilog == mState)) {
|
||||
NS_ASSERTION(mDocument, "Fragments have no prolog or epilog");
|
||||
mDocument->AppendChildTo(aContent, false);
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIContent> parent = GetCurrentContent();
|
||||
|
||||
if (parent) {
|
||||
|
@ -870,20 +875,6 @@ nsXMLContentSink::SetDocElement(int32_t aNameSpaceID,
|
|||
if (mDocElement)
|
||||
return false;
|
||||
|
||||
mDocElement = aContent;
|
||||
|
||||
if (mXSLTProcessor) {
|
||||
mDocumentChildren.AppendElement(aContent);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mDocumentChildren.IsEmpty()) {
|
||||
for (nsIContent* child : mDocumentChildren) {
|
||||
mDocument->AppendChildTo(child, false);
|
||||
}
|
||||
mDocumentChildren.Clear();
|
||||
}
|
||||
|
||||
// check for root elements that needs special handling for
|
||||
// prettyprinting
|
||||
if ((aNameSpaceID == kNameSpaceID_XBL &&
|
||||
|
@ -902,6 +893,7 @@ nsXMLContentSink::SetDocElement(int32_t aNameSpaceID,
|
|||
}
|
||||
}
|
||||
|
||||
mDocElement = aContent;
|
||||
nsresult rv = mDocument->AppendChildTo(mDocElement, NotifyForDocElement());
|
||||
if (NS_FAILED(rv)) {
|
||||
// If we return false here, the caller will bail out because it won't
|
||||
|
@ -1009,17 +1001,17 @@ nsXMLContentSink::HandleStartElement(const char16_t *aName,
|
|||
mInMonolithicContainer++;
|
||||
}
|
||||
|
||||
if (!mXSLTProcessor) {
|
||||
if (content == mDocElement) {
|
||||
NotifyDocElementCreated(mDocument);
|
||||
if (content != mDocElement && !mCurrentHead) {
|
||||
// This isn't the root and we're not inside an XHTML <head>.
|
||||
// Might need to start layout
|
||||
MaybeStartLayout(false);
|
||||
}
|
||||
|
||||
if (aInterruptable && NS_SUCCEEDED(result) && mParser && !mParser->IsParserEnabled()) {
|
||||
return NS_ERROR_HTMLPARSER_BLOCK;
|
||||
}
|
||||
} else if (!mCurrentHead) {
|
||||
// This isn't the root and we're not inside an XHTML <head>.
|
||||
// Might need to start layout
|
||||
MaybeStartLayout(false);
|
||||
if (content == mDocElement) {
|
||||
NotifyDocElementCreated(mDocument);
|
||||
|
||||
if (aInterruptable && NS_SUCCEEDED(result) && mParser && !mParser->IsParserEnabled()) {
|
||||
return NS_ERROR_HTMLPARSER_BLOCK;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1183,9 +1175,9 @@ nsXMLContentSink::HandleDoctypeDecl(const nsAString & aSubset,
|
|||
nsCOMPtr<nsIContent> content = do_QueryInterface(docType);
|
||||
NS_ASSERTION(content, "doctype isn't content?");
|
||||
|
||||
mDocumentChildren.AppendElement(content);
|
||||
rv = mDocument->AppendChildTo(content, false);
|
||||
DidAddContent();
|
||||
return DidProcessATokenImpl();
|
||||
return NS_SUCCEEDED(rv) ? DidProcessATokenImpl() : rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1335,7 +1327,6 @@ nsXMLContentSink::ReportError(const char16_t* aErrorText,
|
|||
mIsDocumentObserver = false;
|
||||
|
||||
// Clear the current content
|
||||
mDocumentChildren.Clear();
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(mDocument));
|
||||
if (node) {
|
||||
for (;;) {
|
||||
|
|
|
@ -139,7 +139,7 @@ protected:
|
|||
|
||||
void DidAddContent()
|
||||
{
|
||||
if (!mXSLTProcessor && IsTimeToNotify()) {
|
||||
if (IsTimeToNotify()) {
|
||||
FlushTags();
|
||||
}
|
||||
}
|
||||
|
@ -191,12 +191,6 @@ protected:
|
|||
|
||||
nsCOMPtr<nsIDocumentTransformer> mXSLTProcessor;
|
||||
|
||||
// Holds the children in the prolog until the root element is added, after which they're
|
||||
// inserted in the document. However, if we're doing an XSLT transform this will
|
||||
// actually hold all the children of the source document, until the transform is
|
||||
// finished. After the transform is finished we'll just discard the children.
|
||||
nsTArray<nsCOMPtr<nsIContent>> mDocumentChildren;
|
||||
|
||||
static const int NS_ACCUMULATION_BUFFER_SIZE = 4096;
|
||||
// Our currently accumulated text that we have not flushed to a textnode yet.
|
||||
char16_t mText[NS_ACCUMULATION_BUFFER_SIZE];
|
||||
|
|
|
@ -43,9 +43,16 @@ void URIUtils::resolveHref(const nsAString& href, const nsAString& base,
|
|||
|
||||
// static
|
||||
void
|
||||
URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsINode *aSourceNode)
|
||||
URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> sourceDoc = aSourceNode->OwnerDoc();
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aSourceNode);
|
||||
if (!node) {
|
||||
// XXXbz passing nullptr as the first arg to Reset is illegal
|
||||
aNewDoc->Reset(nullptr, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> sourceDoc = node->OwnerDoc();
|
||||
nsIPrincipal* sourcePrincipal = sourceDoc->NodePrincipal();
|
||||
|
||||
// Copy the channel and loadgroup from the source document.
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "txCore.h"
|
||||
|
||||
class nsIDocument;
|
||||
class nsINode;
|
||||
class nsIDOMNode;
|
||||
|
||||
/**
|
||||
* A utility class for URI handling
|
||||
|
@ -22,7 +22,7 @@ public:
|
|||
/**
|
||||
* Reset the given document with the document of the source node
|
||||
*/
|
||||
static void ResetWithSource(nsIDocument *aNewDoc, nsINode *aSourceNode);
|
||||
static void ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode);
|
||||
|
||||
/**
|
||||
* Resolves the given href argument, using the given documentBase
|
||||
|
|
|
@ -8,12 +8,9 @@
|
|||
#include "nsISupports.h"
|
||||
#include "nsStringFwd.h"
|
||||
|
||||
template<class> class nsCOMPtr;
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIDOMNode;
|
||||
class nsIURI;
|
||||
template<class> class nsTArray;
|
||||
|
||||
#define NS_ITRANSFORMOBSERVER_IID \
|
||||
{ 0x04b2d17c, 0xe98d, 0x45f5, \
|
||||
|
@ -46,8 +43,7 @@ public:
|
|||
|
||||
NS_IMETHOD SetTransformObserver(nsITransformObserver* aObserver) = 0;
|
||||
NS_IMETHOD LoadStyleSheet(nsIURI* aUri, nsIDocument* aLoaderDocument) = 0;
|
||||
NS_IMETHOD SetSourceContentModel(nsIDocument* aDocument,
|
||||
const nsTArray<nsCOMPtr<nsIContent>>& aSource) = 0;
|
||||
NS_IMETHOD SetSourceContentModel(nsIDOMNode* aSource) = 0;
|
||||
NS_IMETHOD CancelLoads() = 0;
|
||||
|
||||
NS_IMETHOD AddXSLTParamNamespace(const nsString& aPrefix,
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
const int32_t txExecutionState::kMaxRecursionDepth = 20000;
|
||||
|
||||
nsresult
|
||||
txLoadedDocumentsHash::init(const txXPathNode& aSource)
|
||||
txLoadedDocumentsHash::init(txXPathNode* aSourceDocument)
|
||||
{
|
||||
mSourceDocument = txXPathNodeUtils::getOwnerDocument(aSource);
|
||||
mSourceDocument = aSourceDocument;
|
||||
|
||||
nsAutoString baseURI;
|
||||
nsresult rv = txXPathNodeUtils::getBaseURI(*mSourceDocument, baseURI);
|
||||
|
@ -27,14 +27,7 @@ txLoadedDocumentsHash::init(const txXPathNode& aSource)
|
|||
return rv;
|
||||
}
|
||||
|
||||
// Technically the hash holds documents, but we allow a document fragment too in case
|
||||
// we're transforming from one. In particular, the document() function uses this hash
|
||||
// and it can return the source document, but if we're transforming from a fragment it
|
||||
// makes more sense to return the real root of the source tree which is the fragment.
|
||||
MOZ_ASSERT(txXPathNodeUtils::getNodeType(aSource) == txXPathNodeType::DOCUMENT_NODE ||
|
||||
txXPathNodeUtils::getNodeType(aSource) == txXPathNodeType::DOCUMENT_FRAGMENT_NODE);
|
||||
|
||||
PutEntry(baseURI)->mDocument = txXPathNativeNode::createXPathNode(txXPathNativeNode::getNode(aSource));
|
||||
PutEntry(baseURI)->mDocument = mSourceDocument;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -123,7 +116,7 @@ txExecutionState::init(const txXPathNode& aNode,
|
|||
mOutputHandler->startDocument();
|
||||
|
||||
// Set up loaded-documents-hash
|
||||
rv = mLoadedDocuments.init(aNode);
|
||||
rv = mLoadedDocuments.init(txXPathNodeUtils::getOwnerDocument(aNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Init members
|
||||
|
|
|
@ -56,15 +56,16 @@ class txLoadedDocumentsHash : public nsTHashtable<txLoadedDocumentEntry>
|
|||
{
|
||||
public:
|
||||
txLoadedDocumentsHash()
|
||||
: nsTHashtable<txLoadedDocumentEntry>(4)
|
||||
: nsTHashtable<txLoadedDocumentEntry>(4),
|
||||
mSourceDocument(nullptr)
|
||||
{
|
||||
}
|
||||
~txLoadedDocumentsHash();
|
||||
MOZ_MUST_USE nsresult init(const txXPathNode& aSource);
|
||||
MOZ_MUST_USE nsresult init(txXPathNode* aSourceDocument);
|
||||
|
||||
private:
|
||||
friend class txExecutionState;
|
||||
nsAutoPtr<txXPathNode> mSourceDocument;
|
||||
txXPathNode* mSourceDocument;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -630,7 +630,8 @@ txSyncCompileObserver::loadURI(const nsAString& aUri,
|
|||
// make sense.
|
||||
nsCOMPtr<nsINode> source;
|
||||
if (mProcessor) {
|
||||
source = mProcessor->GetSourceContentModel();
|
||||
source =
|
||||
do_QueryInterface(mProcessor->GetSourceContentModel());
|
||||
}
|
||||
nsAutoSyncOperation sync(source ? source->OwnerDoc() : nullptr);
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
|
|
|
@ -121,7 +121,7 @@ txMozillaTextOutput::startDocument()
|
|||
}
|
||||
|
||||
nsresult
|
||||
txMozillaTextOutput::createResultDocument(nsIDocument* aSourceDocument,
|
||||
txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument,
|
||||
bool aLoadedAsData)
|
||||
{
|
||||
/*
|
||||
|
@ -148,9 +148,11 @@ txMozillaTextOutput::createResultDocument(nsIDocument* aSourceDocument,
|
|||
MOZ_ASSERT(mDocument->GetReadyStateEnum() ==
|
||||
nsIDocument::READYSTATE_UNINITIALIZED, "Bad readyState");
|
||||
mDocument->SetReadyStateInternal(nsIDocument::READYSTATE_LOADING);
|
||||
nsCOMPtr<nsIDocument> source = do_QueryInterface(aSourceDocument);
|
||||
NS_ENSURE_STATE(source);
|
||||
bool hasHadScriptObject = false;
|
||||
nsIScriptGlobalObject* sgo =
|
||||
aSourceDocument->GetScriptHandlingObject(hasHadScriptObject);
|
||||
source->GetScriptHandlingObject(hasHadScriptObject);
|
||||
NS_ENSURE_STATE(sgo || !hasHadScriptObject);
|
||||
|
||||
NS_ASSERTION(mDocument, "Need document");
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "nsWeakPtr.h"
|
||||
#include "txOutputFormat.h"
|
||||
|
||||
class nsIDOMDocument;
|
||||
class nsIDOMDocumentFragment;
|
||||
class nsITransformObserver;
|
||||
class nsIDocument;
|
||||
|
@ -26,7 +27,7 @@ public:
|
|||
TX_DECL_TXAXMLEVENTHANDLER
|
||||
TX_DECL_TXAOUTPUTXMLEVENTHANDLER
|
||||
|
||||
nsresult createResultDocument(nsIDocument* aSourceDocument,
|
||||
nsresult createResultDocument(nsIDOMDocument* aSourceDocument,
|
||||
bool aLoadedAsData);
|
||||
|
||||
private:
|
||||
|
|
|
@ -777,7 +777,7 @@ void txMozillaXMLOutput::processHTTPEquiv(nsAtom* aHeader, const nsString& aValu
|
|||
|
||||
nsresult
|
||||
txMozillaXMLOutput::createResultDocument(const nsAString& aName, int32_t aNsID,
|
||||
nsIDocument* aSourceDocument,
|
||||
nsIDOMDocument* aSourceDocument,
|
||||
bool aLoadedAsData)
|
||||
{
|
||||
nsresult rv;
|
||||
|
@ -800,9 +800,11 @@ txMozillaXMLOutput::createResultDocument(const nsAString& aName, int32_t aNsID,
|
|||
nsIDocument::READYSTATE_UNINITIALIZED, "Bad readyState");
|
||||
mDocument->SetReadyStateInternal(nsIDocument::READYSTATE_LOADING);
|
||||
mDocument->SetMayStartLayout(false);
|
||||
nsCOMPtr<nsIDocument> source = do_QueryInterface(aSourceDocument);
|
||||
NS_ENSURE_STATE(source);
|
||||
bool hasHadScriptObject = false;
|
||||
nsIScriptGlobalObject* sgo =
|
||||
aSourceDocument->GetScriptHandlingObject(hasHadScriptObject);
|
||||
source->GetScriptHandlingObject(hasHadScriptObject);
|
||||
NS_ENSURE_STATE(sgo || !hasHadScriptObject);
|
||||
|
||||
mCurrentNode = mDocument;
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
nsresult closePrevious(bool aFlushText);
|
||||
|
||||
nsresult createResultDocument(const nsAString& aName, int32_t aNsID,
|
||||
nsIDocument* aSourceDocument,
|
||||
nsIDOMDocument* aSourceDocument,
|
||||
bool aLoadedAsData);
|
||||
|
||||
private:
|
||||
|
|
|
@ -50,7 +50,7 @@ class txToDocHandlerFactory : public txAOutputHandlerFactory
|
|||
{
|
||||
public:
|
||||
txToDocHandlerFactory(txExecutionState* aEs,
|
||||
nsIDocument* aSourceDocument,
|
||||
nsIDOMDocument* aSourceDocument,
|
||||
nsITransformObserver* aObserver,
|
||||
bool aDocumentIsData)
|
||||
: mEs(aEs), mSourceDocument(aSourceDocument), mObserver(aObserver),
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
private:
|
||||
txExecutionState* mEs;
|
||||
nsCOMPtr<nsIDocument> mSourceDocument;
|
||||
nsCOMPtr<nsIDOMDocument> mSourceDocument;
|
||||
nsCOMPtr<nsITransformObserver> mObserver;
|
||||
bool mDocumentIsData;
|
||||
};
|
||||
|
@ -377,27 +377,15 @@ txMozillaXSLTProcessor::SetTransformObserver(nsITransformObserver* aObserver)
|
|||
}
|
||||
|
||||
nsresult
|
||||
txMozillaXSLTProcessor::SetSourceContentModel(nsIDocument* aDocument,
|
||||
const nsTArray<nsCOMPtr<nsIContent>>& aSource)
|
||||
txMozillaXSLTProcessor::SetSourceContentModel(nsIDOMNode* aSourceDOM)
|
||||
{
|
||||
mSource = aSourceDOM;
|
||||
|
||||
if (NS_FAILED(mTransformResult)) {
|
||||
notifyError();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mSource = aDocument->CreateDocumentFragment();
|
||||
|
||||
ErrorResult rv;
|
||||
for (nsIContent* child : aSource) {
|
||||
// XPath data model doesn't have DocumentType nodes.
|
||||
if (child->NodeType() != nsIDOMNode::DOCUMENT_TYPE_NODE) {
|
||||
mSource->AppendChild(*child, rv);
|
||||
if (rv.Failed()) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mStylesheet) {
|
||||
return DoTransform();
|
||||
}
|
||||
|
@ -564,7 +552,8 @@ public:
|
|||
|
||||
~nsTransformBlockerEvent()
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document = mProcessor->GetSourceContentModel()->OwnerDoc();
|
||||
nsCOMPtr<nsIDocument> document =
|
||||
do_QueryInterface(mProcessor->GetSourceContentModel());
|
||||
document->UnblockOnload(true);
|
||||
}
|
||||
|
||||
|
@ -583,9 +572,13 @@ txMozillaXSLTProcessor::DoTransform()
|
|||
NS_ASSERTION(mObserver, "no observer");
|
||||
NS_ASSERTION(NS_IsMainThread(), "should only be on main thread");
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDocument> document = do_QueryInterface(mSource, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIRunnable> event = new nsTransformBlockerEvent(this);
|
||||
mSource->OwnerDoc()->BlockOnload();
|
||||
nsresult rv = NS_DispatchToCurrentThread(event);
|
||||
document->BlockOnload();
|
||||
rv = NS_DispatchToCurrentThread(event);
|
||||
if (NS_FAILED(rv)) {
|
||||
// XXX Maybe we should just display the source document in this case?
|
||||
// Also, set up context information, see bug 204655.
|
||||
|
@ -650,7 +643,7 @@ txMozillaXSLTProcessor::TransformToDocument(nsIDOMNode *aSource,
|
|||
nsresult rv = ensureStylesheet();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mSource = do_QueryInterface(aSource);
|
||||
mSource = aSource;
|
||||
|
||||
return TransformToDoc(aResult, true);
|
||||
}
|
||||
|
@ -664,12 +657,18 @@ txMozillaXSLTProcessor::TransformToDoc(nsIDOMDocument **aResult,
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> sourceDOMDocument;
|
||||
mSource->GetOwnerDocument(getter_AddRefs(sourceDOMDocument));
|
||||
if (!sourceDOMDocument) {
|
||||
sourceDOMDocument = do_QueryInterface(mSource);
|
||||
}
|
||||
|
||||
txExecutionState es(mStylesheet, IsLoadDisabled());
|
||||
|
||||
// XXX Need to add error observers
|
||||
|
||||
// If aResult is non-null, we're a data document
|
||||
txToDocHandlerFactory handlerFactory(&es, mSource->OwnerDoc(), mObserver,
|
||||
txToDocHandlerFactory handlerFactory(&es, sourceDOMDocument, mObserver,
|
||||
aCreateDataDocument);
|
||||
es.mOutputHandlerFactory = &handlerFactory;
|
||||
|
||||
|
|
|
@ -75,8 +75,7 @@ public:
|
|||
// nsIDocumentTransformer interface
|
||||
NS_IMETHOD SetTransformObserver(nsITransformObserver* aObserver) override;
|
||||
NS_IMETHOD LoadStyleSheet(nsIURI* aUri, nsIDocument* aLoaderDocument) override;
|
||||
NS_IMETHOD SetSourceContentModel(nsIDocument* aDocument,
|
||||
const nsTArray<nsCOMPtr<nsIContent>>& aSource) override;
|
||||
NS_IMETHOD SetSourceContentModel(nsIDOMNode* aSource) override;
|
||||
NS_IMETHOD CancelLoads() override {return NS_OK;}
|
||||
NS_IMETHOD AddXSLTParamNamespace(const nsString& aPrefix,
|
||||
const nsString& aNamespace) override;
|
||||
|
@ -137,7 +136,7 @@ public:
|
|||
void reportError(nsresult aResult, const char16_t *aErrorText,
|
||||
const char16_t *aSourceText);
|
||||
|
||||
nsINode *GetSourceContentModel()
|
||||
nsIDOMNode *GetSourceContentModel()
|
||||
{
|
||||
return mSource;
|
||||
}
|
||||
|
@ -170,7 +169,7 @@ private:
|
|||
nsIDocument* mStylesheetDocument; // weak
|
||||
nsCOMPtr<nsIContent> mEmbeddedStylesheetRoot;
|
||||
|
||||
nsCOMPtr<nsINode> mSource;
|
||||
nsCOMPtr<nsIDOMNode> mSource;
|
||||
nsresult mTransformResult;
|
||||
nsresult mCompileResult;
|
||||
nsString mErrorText, mSourceText;
|
||||
|
|
Загрузка…
Ссылка в новой задаче