From bfa2ef5fe41997f622944bfe4699f915d44a08c0 Mon Sep 17 00:00:00 2001 From: "axel%pike.org" Date: Tue, 17 Sep 2002 20:31:43 +0000 Subject: [PATCH] better errorcodes, api should be null-proof git-svn-id: svn://10.0.0.236/branches/XSLTPROCESSOR_REFACTOR_20020630_BRANCH@129816 18797224-902f-48f8-a5cc-f745e15eee43 --- .../source/xslt/txMozillaXSLTProcessor.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/mozilla/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.cpp b/mozilla/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.cpp index d17281f2410..169707ffb83 100644 --- a/mozilla/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.cpp @@ -236,10 +236,10 @@ txMozillaXSLTProcessor::TransformDocument(nsIDOMNode* aSourceDOM, nsITransformObserver* aObserver, nsIDOMDocument** aOutputDoc) { - NS_ASSERTION(aSourceDOM, "missing source document"); - NS_ASSERTION(aStyleDOM, "missing style document"); - NS_ASSERTION(aObserver, "missing observer"); - NS_ASSERTION(aOutputDoc, "bad return-pointer"); + NS_ENSURE_ARG(aSourceDOM); + NS_ENSURE_ARG(aStyleDOM); + NS_ASSERTION(aObserver, "no observer"); + NS_ENSURE_ARG_POINTER(aOutputDoc); // Do we really need this now that this is not a scriptable function? if (!URIUtils::CanCallerAccess(aSourceDOM) || @@ -321,7 +321,7 @@ txMozillaXSLTProcessor::Init(nsIDOMNode *aStyle) aStyle->GetNodeType(&type); NS_ENSURE_TRUE(type == nsIDOMNode::ELEMENT_NODE || type == nsIDOMNode::DOCUMENT_NODE, - NS_ERROR_FAILURE); + NS_ERROR_INVALID_ARG); mStylesheet = aStyle; return NS_OK; @@ -331,9 +331,9 @@ NS_IMETHODIMP txMozillaXSLTProcessor::TransformToDocument(nsIDOMNode *aSource, nsIDOMDocument **aResult) { - NS_ASSERTION(aSource, "missing source document"); - NS_ASSERTION(aResult, "bad return-pointer"); - NS_ENSURE_TRUE(mStylesheet, NS_ERROR_FAILURE); + NS_ENSURE_ARG(aSource); + NS_ENSURE_ARG_POINTER(aResult); + NS_ENSURE_TRUE(mStylesheet, NS_ERROR_NOT_INITIALIZED); if (!URIUtils::CanCallerAccess(aSource)) { return NS_ERROR_DOM_SECURITY_ERR; @@ -408,7 +408,8 @@ txMozillaXSLTProcessor::TransformToFragment(nsIDOMNode *aSource, { NS_ENSURE_ARG(aSource); NS_ENSURE_ARG(aOutput); - NS_ENSURE_TRUE(mStylesheet, NS_ERROR_FAILURE); + NS_ENSURE_ARG_POINTER(aResult); + NS_ENSURE_TRUE(mStylesheet, NS_ERROR_NOT_INITIALIZED); if (!URIUtils::CanCallerAccess(aSource) || !URIUtils::CanCallerAccess(aOutput)) {