Fix for bug 151002 (abstract the content by a treewalker). Patch by me, with parts by Pike and sicking. r=sicking, sr=jst.
git-svn-id: svn://10.0.0.236/trunk@149516 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -33,8 +33,8 @@
|
||||
#include "FunctionLib.h"
|
||||
#include "txAtoms.h"
|
||||
#include "txIXPathContext.h"
|
||||
#include "XMLDOMUtils.h"
|
||||
#include "XMLUtils.h"
|
||||
#include "txXPathTreeWalker.h"
|
||||
#include <math.h>
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
@@ -105,8 +105,8 @@ StringFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
||||
if (iter.hasNext())
|
||||
evaluateToString((Expr*)iter.next(), aContext, resultStr);
|
||||
else
|
||||
XMLDOMUtils::getNodeValue(aContext->getContextNode(),
|
||||
resultStr);
|
||||
txXPathNodeUtils::appendNodeValue(aContext->getContextNode(),
|
||||
resultStr);
|
||||
|
||||
nsRefPtr<StringResult> strRes;
|
||||
rv = aContext->recycler()->getStringResult(getter_AddRefs(strRes));
|
||||
@@ -164,8 +164,8 @@ StringFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
||||
if (iter.hasNext())
|
||||
evaluateToString((Expr*)iter.next(), aContext, resultStr);
|
||||
else
|
||||
XMLDOMUtils::getNodeValue(aContext->getContextNode(),
|
||||
resultStr);
|
||||
txXPathNodeUtils::appendNodeValue(aContext->getContextNode(),
|
||||
resultStr);
|
||||
rv = aContext->recycler()->getNumberResult(resultStr.Length(),
|
||||
aResult);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@@ -280,7 +280,12 @@ StringFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
||||
|
||||
nsAutoString src;
|
||||
evaluateToString((Expr*)iter.next(), aContext, src);
|
||||
if (src.IsEmpty()) {
|
||||
aContext->recycler()->getEmptyStringResult(aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<StringResult> strRes;
|
||||
rv = aContext->recycler()->getStringResult(getter_AddRefs(strRes));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@@ -318,8 +323,8 @@ StringFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
||||
if (iter.hasNext())
|
||||
evaluateToString((Expr*)iter.next(), aContext, strRes->mValue);
|
||||
else
|
||||
XMLDOMUtils::getNodeValue(aContext->getContextNode(),
|
||||
strRes->mValue);
|
||||
txXPathNodeUtils::appendNodeValue(aContext->getContextNode(),
|
||||
strRes->mValue);
|
||||
*aResult = strRes;
|
||||
NS_ADDREF(*aResult);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user