From 7d0dd55d2d8a94c88809294812e24aa140a8e7b9 Mon Sep 17 00:00:00 2001 From: Peter Van der Beken Date: Sat, 21 Nov 2009 15:48:49 +0100 Subject: [PATCH] Back out c5619fbfb2b1 to fix orange. --- content/xslt/crashtests/528300.xml | 22 --------------- content/xslt/crashtests/528488.xml | 19 ------------- content/xslt/crashtests/crashtests.list | 2 -- content/xslt/src/xpath/txCoreFunctionCall.cpp | 28 +++++-------------- content/xslt/src/xpath/txExpr.h | 3 +- content/xslt/src/xpath/txFunctionCall.cpp | 12 +++----- .../src/xpath/txXPCOMExtensionFunction.cpp | 6 +--- .../src/xslt/txFormatNumberFunctionCall.cpp | 5 ++-- 8 files changed, 15 insertions(+), 82 deletions(-) delete mode 100644 content/xslt/crashtests/528300.xml delete mode 100644 content/xslt/crashtests/528488.xml diff --git a/content/xslt/crashtests/528300.xml b/content/xslt/crashtests/528300.xml deleted file mode 100644 index 8902bb373e80..000000000000 --- a/content/xslt/crashtests/528300.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - -]> - - - - - - - - - - - - - diff --git a/content/xslt/crashtests/528488.xml b/content/xslt/crashtests/528488.xml deleted file mode 100644 index 904b34561230..000000000000 --- a/content/xslt/crashtests/528488.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - -]> - - - - - - - - - diff --git a/content/xslt/crashtests/crashtests.list b/content/xslt/crashtests/crashtests.list index 4b0350c88a86..b6c5c98307e0 100644 --- a/content/xslt/crashtests/crashtests.list +++ b/content/xslt/crashtests/crashtests.list @@ -6,5 +6,3 @@ load 406106-1.html load 483444.xml load 485217.xml load 485286.xml -load 528300.xml -load 528488.xml diff --git a/content/xslt/src/xpath/txCoreFunctionCall.cpp b/content/xslt/src/xpath/txCoreFunctionCall.cpp index 46236cb53fc3..03ce61a74069 100644 --- a/content/xslt/src/xpath/txCoreFunctionCall.cpp +++ b/content/xslt/src/xpath/txCoreFunctionCall.cpp @@ -387,9 +387,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) rv = mParams[0]->evaluateToString(aContext, src); NS_ENSURE_SUCCESS(rv, rv); - double start; - rv = evaluateToNumber(mParams[1], aContext, &start); - NS_ENSURE_SUCCESS(rv, rv); + double start = evaluateToNumber(mParams[1], aContext); // check for NaN or +/-Inf if (Double::isNaN(start) || @@ -404,10 +402,8 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) double end; if (mParams.Length() == 3) { - rv = evaluateToNumber(mParams[2], aContext, &end); - NS_ENSURE_SUCCESS(rv, rv); - - end += start; + end = start + evaluateToNumber(mParams[2], + aContext); if (Double::isNaN(end) || end < 0) { aContext->recycler()->getEmptyStringResult(aResult); @@ -535,8 +531,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) { double res; if (!mParams.IsEmpty()) { - rv = evaluateToNumber(mParams[0], aContext, &res); - NS_ENSURE_SUCCESS(rv, rv); + res = evaluateToNumber(mParams[0], aContext); } else { nsAutoString resultStr; @@ -548,10 +543,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) } case ROUND: { - double dbl; - rv = evaluateToNumber(mParams[0], aContext, &dbl); - NS_ENSURE_SUCCESS(rv, rv); - + double dbl = evaluateToNumber(mParams[0], aContext); if (!Double::isNaN(dbl) && !Double::isInfinite(dbl)) { if (Double::isNeg(dbl) && dbl >= -0.5) { dbl *= 0; @@ -565,10 +557,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) } case FLOOR: { - double dbl; - rv = evaluateToNumber(mParams[0], aContext, &dbl); - NS_ENSURE_SUCCESS(rv, rv); - + double dbl = evaluateToNumber(mParams[0], aContext); if (!Double::isNaN(dbl) && !Double::isInfinite(dbl) && !(dbl == 0 && Double::isNeg(dbl))) { @@ -579,10 +568,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) } case CEILING: { - double dbl; - rv = evaluateToNumber(mParams[0], aContext, &dbl); - NS_ENSURE_SUCCESS(rv, rv); - + double dbl = evaluateToNumber(mParams[0], aContext); if (!Double::isNaN(dbl) && !Double::isInfinite(dbl)) { if (Double::isNeg(dbl) && dbl > -1) { dbl *= 0; diff --git a/content/xslt/src/xpath/txExpr.h b/content/xslt/src/xpath/txExpr.h index a859c660d70f..26d8cd4013ff 100644 --- a/content/xslt/src/xpath/txExpr.h +++ b/content/xslt/src/xpath/txExpr.h @@ -330,8 +330,7 @@ protected: /* * Evaluates the given Expression and converts its result to a number. */ - static nsresult evaluateToNumber(Expr* aExpr, txIEvalContext* aContext, - double* aResult); + static double evaluateToNumber(Expr* aExpr, txIEvalContext* aContext); /* * Evaluates the given Expression and converts its result to a NodeSet. diff --git a/content/xslt/src/xpath/txFunctionCall.cpp b/content/xslt/src/xpath/txFunctionCall.cpp index d3d8d0a08aa7..2e6df285f090 100644 --- a/content/xslt/src/xpath/txFunctionCall.cpp +++ b/content/xslt/src/xpath/txFunctionCall.cpp @@ -52,19 +52,15 @@ /* * Evaluates the given Expression and converts its result to a number. */ -// static -nsresult -FunctionCall::evaluateToNumber(Expr* aExpr, txIEvalContext* aContext, - double* aResult) +double FunctionCall::evaluateToNumber(Expr* aExpr, txIEvalContext* aContext) { NS_ASSERTION(aExpr, "missing expression"); nsRefPtr exprResult; nsresult rv = aExpr->evaluate(aContext, getter_AddRefs(exprResult)); - NS_ENSURE_SUCCESS(rv, rv); + if (NS_FAILED(rv)) + return Double::NaN; - *aResult = exprResult->numberValue(); - - return NS_OK; + return exprResult->numberValue(); } /* diff --git a/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp b/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp index f7822b5b1040..8975aa55c44f 100644 --- a/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp +++ b/content/xslt/src/xpath/txXPCOMExtensionFunction.cpp @@ -479,11 +479,7 @@ txXPCOMExtensionFunctionCall::evaluate(txIEvalContext* aContext, } case eNUMBER: { - double dbl; - rv = evaluateToNumber(mParams[0], aContext, &dbl); - NS_ENSURE_SUCCESS(rv, rv); - - invokeParam.val.d = dbl; + invokeParam.val.d = evaluateToNumber(expr, aContext); break; } case eSTRING: diff --git a/content/xslt/src/xslt/txFormatNumberFunctionCall.cpp b/content/xslt/src/xslt/txFormatNumberFunctionCall.cpp index 93ca46ea64e2..ac9fd8edce1f 100644 --- a/content/xslt/src/xslt/txFormatNumberFunctionCall.cpp +++ b/content/xslt/src/xslt/txFormatNumberFunctionCall.cpp @@ -84,11 +84,10 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext, double value; txExpandedName formatName; - nsresult rv = evaluateToNumber(mParams[0], aContext, &value); - NS_ENSURE_SUCCESS(rv, rv); + value = evaluateToNumber(mParams[0], aContext); nsAutoString formatStr; - rv = mParams[1]->evaluateToString(aContext, formatStr); + nsresult rv = mParams[1]->evaluateToString(aContext, formatStr); NS_ENSURE_SUCCESS(rv, rv); if (mParams.Length() == 3) {