зеркало из https://github.com/mozilla/gecko-dev.git
Bug 189201: Hold a reference to the document-node even for embedded stylesheets to make sure that the document doesn't go away.
r=peterv sr=bz
This commit is contained in:
Родитель
f64fe362bf
Коммит
896567a22b
|
@ -397,11 +397,21 @@ txMozillaXSLTProcessor::ImportStylesheet(nsIDOMNode *aStyle)
|
||||||
|
|
||||||
PRUint16 type = 0;
|
PRUint16 type = 0;
|
||||||
aStyle->GetNodeType(&type);
|
aStyle->GetNodeType(&type);
|
||||||
NS_ENSURE_TRUE(type == nsIDOMNode::ELEMENT_NODE ||
|
switch (type) {
|
||||||
type == nsIDOMNode::DOCUMENT_NODE,
|
case nsIDOMNode::ELEMENT_NODE:
|
||||||
NS_ERROR_INVALID_ARG);
|
aStyle->GetOwnerDocument(getter_AddRefs(mStylesheetDocument));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nsIDOMNode::DOCUMENT_NODE:
|
||||||
|
mStylesheetDocument = do_QueryInterface(aStyle);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return NS_ERROR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
mStylesheet = aStyle;
|
mStylesheet = aStyle;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,12 +439,7 @@ txMozillaXSLTProcessor::TransformToDocument(nsIDOMNode *aSource,
|
||||||
NS_ENSURE_TRUE(sourceNode, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(sourceNode, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
// Create wrapper for the style document.
|
// Create wrapper for the style document.
|
||||||
nsCOMPtr<nsIDOMDocument> styleDOMDocument;
|
Document xslDocument(mStylesheetDocument);
|
||||||
mStylesheet->GetOwnerDocument(getter_AddRefs(styleDOMDocument));
|
|
||||||
if (!styleDOMDocument) {
|
|
||||||
styleDOMDocument = do_QueryInterface(mStylesheet);
|
|
||||||
}
|
|
||||||
Document xslDocument(styleDOMDocument);
|
|
||||||
|
|
||||||
// Create a new ProcessorState. Must be done after creating the documents
|
// Create a new ProcessorState. Must be done after creating the documents
|
||||||
// so that C++ will ensure that it is destroyed before the documents.
|
// so that C++ will ensure that it is destroyed before the documents.
|
||||||
|
@ -502,12 +507,7 @@ txMozillaXSLTProcessor::TransformToFragment(nsIDOMNode *aSource,
|
||||||
NS_ENSURE_TRUE(sourceNode, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(sourceNode, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
// Create wrapper for the style document.
|
// Create wrapper for the style document.
|
||||||
nsCOMPtr<nsIDOMDocument> styleDOMDocument;
|
Document xslDocument(mStylesheetDocument);
|
||||||
mStylesheet->GetOwnerDocument(getter_AddRefs(styleDOMDocument));
|
|
||||||
if (!styleDOMDocument) {
|
|
||||||
styleDOMDocument = do_QueryInterface(mStylesheet);
|
|
||||||
}
|
|
||||||
Document xslDocument(styleDOMDocument);
|
|
||||||
|
|
||||||
// Create a new ProcessorState. Must be done after creating the documents
|
// Create a new ProcessorState. Must be done after creating the documents
|
||||||
// so that C++ will ensure that it is destroyed before the documents.
|
// so that C++ will ensure that it is destroyed before the documents.
|
||||||
|
|
|
@ -140,6 +140,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsCOMPtr<nsIDOMNode> mStylesheet;
|
nsCOMPtr<nsIDOMNode> mStylesheet;
|
||||||
|
nsCOMPtr<nsIDOMDocument> mStylesheetDocument;
|
||||||
txExpandedNameMap mVariables;
|
txExpandedNameMap mVariables;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче