зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1729329 - Remove impossible to hit OOM errors from XSLT code. r=farre
Differential Revision: https://phabricator.services.mozilla.com/D124679
This commit is contained in:
Родитель
e226bd2a93
Коммит
89dbebeac4
|
@ -172,8 +172,7 @@ nsresult txExprParser::createExprInternal(const nsAString& aExpression,
|
|||
|
||||
txXPathOptimizer optimizer;
|
||||
Expr* newExpr = nullptr;
|
||||
rv = optimizer.optimize(expr.get(), &newExpr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
optimizer.optimize(expr.get(), &newExpr);
|
||||
|
||||
*aExpr = newExpr ? newExpr : expr.release();
|
||||
|
||||
|
|
|
@ -46,9 +46,8 @@ class txEarlyEvalContext : public txIEvalContext {
|
|||
txResultRecycler* mRecycler;
|
||||
};
|
||||
|
||||
nsresult txXPathOptimizer::optimize(Expr* aInExpr, Expr** aOutExpr) {
|
||||
void txXPathOptimizer::optimize(Expr* aInExpr, Expr** aOutExpr) {
|
||||
*aOutExpr = nullptr;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// First check if the expression will produce the same result
|
||||
// under any context.
|
||||
|
@ -61,12 +60,12 @@ nsresult txXPathOptimizer::optimize(Expr* aInExpr, Expr** aOutExpr) {
|
|||
|
||||
// Don't throw if this fails since it could be that the expression
|
||||
// is or contains an error-expression.
|
||||
rv = aInExpr->evaluate(&context, getter_AddRefs(exprRes));
|
||||
nsresult rv = aInExpr->evaluate(&context, getter_AddRefs(exprRes));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aOutExpr = new txLiteralExpr(exprRes);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
// Then optimize sub expressions
|
||||
|
@ -74,8 +73,7 @@ nsresult txXPathOptimizer::optimize(Expr* aInExpr, Expr** aOutExpr) {
|
|||
Expr* subExpr;
|
||||
while ((subExpr = aInExpr->getSubExprAt(i))) {
|
||||
Expr* newExpr = nullptr;
|
||||
rv = optimize(subExpr, &newExpr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
optimize(subExpr, &newExpr);
|
||||
if (newExpr) {
|
||||
delete subExpr;
|
||||
aInExpr->setSubExprAt(i, newExpr);
|
||||
|
@ -87,22 +85,23 @@ nsresult txXPathOptimizer::optimize(Expr* aInExpr, Expr** aOutExpr) {
|
|||
// Finally see if current expression can be optimized
|
||||
switch (exprType) {
|
||||
case Expr::LOCATIONSTEP_EXPR:
|
||||
return optimizeStep(aInExpr, aOutExpr);
|
||||
optimizeStep(aInExpr, aOutExpr);
|
||||
return;
|
||||
|
||||
case Expr::PATH_EXPR:
|
||||
return optimizePath(aInExpr, aOutExpr);
|
||||
optimizePath(aInExpr, aOutExpr);
|
||||
return;
|
||||
|
||||
case Expr::UNION_EXPR:
|
||||
return optimizeUnion(aInExpr, aOutExpr);
|
||||
optimizeUnion(aInExpr, aOutExpr);
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult txXPathOptimizer::optimizeStep(Expr* aInExpr, Expr** aOutExpr) {
|
||||
void txXPathOptimizer::optimizeStep(Expr* aInExpr, Expr** aOutExpr) {
|
||||
LocationStep* step = static_cast<LocationStep*>(aInExpr);
|
||||
|
||||
if (step->getAxisIdentifier() == LocationStep::ATTRIBUTE_AXIS) {
|
||||
|
@ -114,7 +113,7 @@ nsresult txXPathOptimizer::optimizeStep(Expr* aInExpr, Expr** aOutExpr) {
|
|||
->mLocalName != nsGkAtoms::_asterisk) {
|
||||
*aOutExpr = new txNamedAttributeStep(
|
||||
nameTest->mNamespace, nameTest->mPrefix, nameTest->mLocalName);
|
||||
return NS_OK; // return since we no longer have a step-object.
|
||||
return; // return since we no longer have a step-object.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,11 +126,9 @@ nsresult txXPathOptimizer::optimizeStep(Expr* aInExpr, Expr** aOutExpr) {
|
|||
step->dropFirst();
|
||||
step->setNodeTest(predTest);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult txXPathOptimizer::optimizePath(Expr* aInExpr, Expr** aOutExpr) {
|
||||
void txXPathOptimizer::optimizePath(Expr* aInExpr, Expr** aOutExpr) {
|
||||
PathExpr* path = static_cast<PathExpr*>(aInExpr);
|
||||
|
||||
uint32_t i;
|
||||
|
@ -173,7 +170,7 @@ nsresult txXPathOptimizer::optimizePath(Expr* aInExpr, Expr** aOutExpr) {
|
|||
*aOutExpr = path->getSubExprAt(1);
|
||||
path->setSubExprAt(1, nullptr);
|
||||
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
// Just delete the '.' step and leave the rest of the PathExpr
|
||||
|
@ -181,11 +178,9 @@ nsresult txXPathOptimizer::optimizePath(Expr* aInExpr, Expr** aOutExpr) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult txXPathOptimizer::optimizeUnion(Expr* aInExpr, Expr** aOutExpr) {
|
||||
void txXPathOptimizer::optimizeUnion(Expr* aInExpr, Expr** aOutExpr) {
|
||||
UnionExpr* uni = static_cast<UnionExpr*>(aInExpr);
|
||||
|
||||
// Check for expressions like "foo | bar" and
|
||||
|
@ -245,9 +240,7 @@ nsresult txXPathOptimizer::optimizeUnion(Expr* aInExpr, Expr** aOutExpr) {
|
|||
*aOutExpr = currentStep;
|
||||
|
||||
// Return right away since we no longer have a union
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@ class txXPathOptimizer {
|
|||
* @param aOutExpr Resulting expression, null if optimization didn't
|
||||
* result in a new expression.
|
||||
*/
|
||||
nsresult optimize(Expr* aInExpr, Expr** aOutExpr);
|
||||
void optimize(Expr* aInExpr, Expr** aOutExpr);
|
||||
|
||||
private:
|
||||
// Helper methods for optimizing specific classes
|
||||
nsresult optimizeStep(Expr* aInExpr, Expr** aOutExpr);
|
||||
nsresult optimizePath(Expr* aInExpr, Expr** aOutExpr);
|
||||
nsresult optimizeUnion(Expr* aInExpr, Expr** aOutExpr);
|
||||
void optimizeStep(Expr* aInExpr, Expr** aOutExpr);
|
||||
void optimizePath(Expr* aInExpr, Expr** aOutExpr);
|
||||
void optimizeUnion(Expr* aInExpr, Expr** aOutExpr);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,18 +6,16 @@
|
|||
#include "txPatternOptimizer.h"
|
||||
#include "txXSLTPatterns.h"
|
||||
|
||||
nsresult txPatternOptimizer::optimize(txPattern* aInPattern,
|
||||
txPattern** aOutPattern) {
|
||||
void txPatternOptimizer::optimize(txPattern* aInPattern,
|
||||
txPattern** aOutPattern) {
|
||||
*aOutPattern = nullptr;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// First optimize sub expressions
|
||||
uint32_t i = 0;
|
||||
Expr* subExpr;
|
||||
while ((subExpr = aInPattern->getSubExprAt(i))) {
|
||||
Expr* newExpr = nullptr;
|
||||
rv = mXPathOptimizer.optimize(subExpr, &newExpr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mXPathOptimizer.optimize(subExpr, &newExpr);
|
||||
if (newExpr) {
|
||||
delete subExpr;
|
||||
aInPattern->setSubExprAt(i, newExpr);
|
||||
|
@ -31,8 +29,7 @@ nsresult txPatternOptimizer::optimize(txPattern* aInPattern,
|
|||
i = 0;
|
||||
while ((subPattern = aInPattern->getSubPatternAt(i))) {
|
||||
txPattern* newPattern = nullptr;
|
||||
rv = optimize(subPattern, &newPattern);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
optimize(subPattern, &newPattern);
|
||||
if (newPattern) {
|
||||
delete subPattern;
|
||||
aInPattern->setSubPatternAt(i, newPattern);
|
||||
|
@ -44,17 +41,16 @@ nsresult txPatternOptimizer::optimize(txPattern* aInPattern,
|
|||
// Finally see if current pattern can be optimized
|
||||
switch (aInPattern->getType()) {
|
||||
case txPattern::STEP_PATTERN:
|
||||
return optimizeStep(aInPattern, aOutPattern);
|
||||
optimizeStep(aInPattern, aOutPattern);
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult txPatternOptimizer::optimizeStep(txPattern* aInPattern,
|
||||
txPattern** aOutPattern) {
|
||||
void txPatternOptimizer::optimizeStep(txPattern* aInPattern,
|
||||
txPattern** aOutPattern) {
|
||||
txStepPattern* step = static_cast<txStepPattern*>(aInPattern);
|
||||
|
||||
// Test for predicates that can be combined into the nodetest
|
||||
|
@ -66,6 +62,4 @@ nsresult txPatternOptimizer::optimizeStep(txPattern* aInPattern,
|
|||
step->dropFirst();
|
||||
step->setNodeTest(predTest);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -18,11 +18,11 @@ class txPatternOptimizer {
|
|||
* @param aOutPattern Resulting pattern, null if optimization didn't
|
||||
* result in a new pattern.
|
||||
*/
|
||||
nsresult optimize(txPattern* aInPattern, txPattern** aOutPattern);
|
||||
void optimize(txPattern* aInPattern, txPattern** aOutPattern);
|
||||
|
||||
private:
|
||||
// Helper methods for optimizing specific classes
|
||||
nsresult optimizeStep(txPattern* aInPattern, txPattern** aOutPattern);
|
||||
void optimizeStep(txPattern* aInPattern, txPattern** aOutPattern);
|
||||
|
||||
txXPathOptimizer mXPathOptimizer;
|
||||
};
|
||||
|
|
|
@ -34,8 +34,7 @@ nsresult txPatternParser::createPattern(const nsString& aPattern,
|
|||
|
||||
txPatternOptimizer optimizer;
|
||||
txPattern* newPattern = nullptr;
|
||||
rv = optimizer.optimize(pattern.get(), &newPattern);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
optimizer.optimize(pattern.get(), &newPattern);
|
||||
|
||||
*aResult = newPattern ? newPattern : pattern.release();
|
||||
|
||||
|
@ -63,14 +62,7 @@ nsresult txPatternParser::createUnionPattern(txExprLexer& aLexer,
|
|||
}
|
||||
|
||||
txUnionPattern* unionPattern = new txUnionPattern();
|
||||
rv = unionPattern->addPattern(locPath);
|
||||
#if 0 // XXX addPattern can't fail yet, it doesn't check for mem
|
||||
if (NS_FAILED(rv)) {
|
||||
delete unionPattern;
|
||||
delete locPath;
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
unionPattern->addPattern(locPath);
|
||||
|
||||
aLexer.nextToken();
|
||||
do {
|
||||
|
@ -79,14 +71,7 @@ nsresult txPatternParser::createUnionPattern(txExprLexer& aLexer,
|
|||
delete unionPattern;
|
||||
return rv;
|
||||
}
|
||||
rv = unionPattern->addPattern(locPath);
|
||||
#if 0 // XXX addPattern can't fail yet, it doesn't check for mem
|
||||
if (NS_FAILED(rv)) {
|
||||
delete unionPattern;
|
||||
delete locPath;
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
unionPattern->addPattern(locPath);
|
||||
type = aLexer.nextToken()->mType;
|
||||
} while (type == Token::UNION_OP);
|
||||
|
||||
|
@ -158,21 +143,10 @@ nsresult txPatternParser::createLocPathPattern(txExprLexer& aLexer,
|
|||
root->setSerialize(false);
|
||||
#endif
|
||||
|
||||
rv = pathPattern->addStep(root, isChild);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete stepPattern;
|
||||
delete pathPattern;
|
||||
delete root;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
pathPattern->addStep(root, isChild);
|
||||
}
|
||||
|
||||
rv = pathPattern->addStep(stepPattern, isChild);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete stepPattern;
|
||||
delete pathPattern;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
pathPattern->addStep(stepPattern, isChild);
|
||||
stepPattern = 0; // stepPattern is part of pathPattern now
|
||||
|
||||
while (type == Token::PARENT_OP || type == Token::ANCESTOR_OP) {
|
||||
|
@ -183,12 +157,7 @@ nsresult txPatternParser::createLocPathPattern(txExprLexer& aLexer,
|
|||
delete pathPattern;
|
||||
return rv;
|
||||
}
|
||||
rv = pathPattern->addStep(stepPattern, isChild);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete stepPattern;
|
||||
delete pathPattern;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
pathPattern->addStep(stepPattern, isChild);
|
||||
stepPattern = 0; // stepPattern is part of pathPattern now
|
||||
type = aLexer.peek()->mType;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ static nsresult txFnStartLRE(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
nsAtom* aPrefix, txStylesheetAttr* aAttributes,
|
||||
int32_t aAttrCount,
|
||||
txStylesheetCompilerState& aState);
|
||||
static nsresult txFnEndLRE(txStylesheetCompilerState& aState);
|
||||
static void txFnEndLRE(txStylesheetCompilerState& aState);
|
||||
|
||||
#define TX_RETURN_IF_WHITESPACE(_str, _state) \
|
||||
do { \
|
||||
|
@ -348,9 +348,7 @@ static nsresult txFnStartElementIgnore(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndElementIgnore(txStylesheetCompilerState& aState) {
|
||||
return NS_OK;
|
||||
}
|
||||
static void txFnEndElementIgnore(txStylesheetCompilerState& aState) {}
|
||||
|
||||
static nsresult txFnStartElementSetIgnore(int32_t aNamespaceID,
|
||||
nsAtom* aLocalName, nsAtom* aPrefix,
|
||||
|
@ -366,9 +364,8 @@ static nsresult txFnStartElementSetIgnore(int32_t aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndElementSetIgnore(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndElementSetIgnore(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnStartElementError(int32_t aNamespaceID, nsAtom* aLocalName,
|
||||
|
@ -379,9 +376,8 @@ static nsresult txFnStartElementError(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_ERROR_XSLT_PARSE_FAILURE;
|
||||
}
|
||||
|
||||
static nsresult txFnEndElementError(txStylesheetCompilerState& aState) {
|
||||
NS_ERROR("txFnEndElementError shouldn't be called");
|
||||
return NS_ERROR_XSLT_PARSE_FAILURE;
|
||||
static void txFnEndElementError(txStylesheetCompilerState& aState) {
|
||||
MOZ_CRASH("txFnEndElementError shouldn't be called");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -412,9 +408,8 @@ static nsresult txFnStartStylesheet(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndStylesheet(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndStylesheet(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnStartElementContinueTopLevel(
|
||||
|
@ -451,17 +446,14 @@ static nsresult txFnStartLREStylesheet(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
aAttrCount, aState);
|
||||
}
|
||||
|
||||
static nsresult txFnEndLREStylesheet(txStylesheetCompilerState& aState) {
|
||||
nsresult rv = txFnEndLRE(aState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
static void txFnEndLREStylesheet(txStylesheetCompilerState& aState) {
|
||||
txFnEndLRE(aState);
|
||||
|
||||
aState.popHandlerTable();
|
||||
|
||||
aState.addInstruction(MakeUnique<txReturn>());
|
||||
|
||||
aState.closeInstructionContainer();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnStartEmbed(int32_t aNamespaceID, nsAtom* aLocalName,
|
||||
|
@ -480,13 +472,12 @@ static nsresult txFnStartEmbed(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
aAttrCount, aState);
|
||||
}
|
||||
|
||||
static nsresult txFnEndEmbed(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndEmbed(txStylesheetCompilerState& aState) {
|
||||
if (!aState.handleEmbeddedSheet()) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
nsresult rv = txFnEndStylesheet(aState);
|
||||
txFnEndStylesheet(aState);
|
||||
aState.doneEmbedding();
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -507,9 +498,8 @@ static nsresult txFnStartOtherTop(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndOtherTop(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndOtherTop(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// xsl:attribute-set
|
||||
|
@ -537,14 +527,12 @@ static nsresult txFnStartAttributeSet(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndAttributeSet(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndAttributeSet(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
aState.addInstruction(MakeUnique<txReturn>());
|
||||
|
||||
aState.closeInstructionContainer();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// xsl:decimal-format
|
||||
|
@ -617,10 +605,8 @@ static nsresult txFnStartDecimalFormat(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndDecimalFormat(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndDecimalFormat(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// xsl:import
|
||||
|
@ -648,10 +634,8 @@ static nsresult txFnStartImport(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndImport(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndImport(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// xsl:include
|
||||
|
@ -674,10 +658,8 @@ static nsresult txFnStartInclude(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndInclude(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndInclude(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// xsl:key
|
||||
|
@ -712,10 +694,8 @@ static nsresult txFnStartKey(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndKey(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndKey(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// xsl:namespace-alias
|
||||
|
@ -740,10 +720,8 @@ static nsresult txFnStartNamespaceAlias(int32_t aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndNamespaceAlias(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndNamespaceAlias(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// xsl:output
|
||||
|
@ -839,10 +817,8 @@ static nsresult txFnStartOutput(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndOutput(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndOutput(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// xsl:strip-space/xsl:preserve-space
|
||||
|
@ -897,12 +873,8 @@ static nsresult txFnStartStripSpace(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
ns = aState.mElementContext->mMappings->lookupNamespace(prefix);
|
||||
NS_ENSURE_TRUE(ns != kNameSpaceID_Unknown, NS_ERROR_FAILURE);
|
||||
}
|
||||
UniquePtr<txStripSpaceTest> sst(
|
||||
stripItem->addStripSpaceTest(
|
||||
new txStripSpaceTest(prefix, localName, ns, strip));
|
||||
rv = stripItem->addStripSpaceTest(sst.get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
Unused << sst.release();
|
||||
}
|
||||
|
||||
aState.addToplevelItem(stripItem.release());
|
||||
|
@ -912,10 +884,8 @@ static nsresult txFnStartStripSpace(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndStripSpace(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndStripSpace(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// xsl:template
|
||||
|
@ -955,14 +925,12 @@ static nsresult txFnStartTemplate(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndTemplate(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndTemplate(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
aState.addInstruction(MakeUnique<txReturn>());
|
||||
|
||||
aState.closeInstructionContainer();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// xsl:variable, xsl:param
|
||||
|
@ -999,7 +967,7 @@ static nsresult txFnStartTopVariable(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndTopVariable(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndTopVariable(txStylesheetCompilerState& aState) {
|
||||
txHandlerTable* prev = aState.mHandlerTable;
|
||||
aState.popHandlerTable();
|
||||
txVariableItem* var =
|
||||
|
@ -1015,8 +983,6 @@ static nsresult txFnEndTopVariable(txStylesheetCompilerState& aState) {
|
|||
}
|
||||
|
||||
aState.closeInstructionContainer();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnStartElementStartTopVar(int32_t aNamespaceID,
|
||||
|
@ -1090,10 +1056,8 @@ static nsresult txFnStartLRE(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndLRE(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndLRE(txStylesheetCompilerState& aState) {
|
||||
aState.addInstruction(MakeUnique<txEndElement>());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1129,10 +1093,8 @@ static nsresult txFnStartApplyImports(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndApplyImports(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndApplyImports(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1181,7 +1143,7 @@ static nsresult txFnStartApplyTemplates(int32_t aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndApplyTemplates(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndApplyTemplates(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
txPushNewContext* pushcontext =
|
||||
|
@ -1194,8 +1156,6 @@ static nsresult txFnEndApplyTemplates(txStylesheetCompilerState& aState) {
|
|||
aState.addInstruction(MakeUnique<txLoopNodeSet>(instr));
|
||||
|
||||
pushcontext->mBailTarget = aState.addInstruction(MakeUnique<txPopParams>());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1234,11 +1194,9 @@ static nsresult txFnStartAttribute(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndAttribute(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndAttribute(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
aState.addInstruction(popInstruction(aState));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1270,15 +1228,13 @@ static nsresult txFnStartCallTemplate(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndCallTemplate(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndCallTemplate(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
// txCallTemplate
|
||||
aState.addInstruction(popInstruction(aState));
|
||||
|
||||
aState.addInstruction(MakeUnique<txPopParams>());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1306,19 +1262,15 @@ static nsresult txFnStartChoose(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndChoose(txStylesheetCompilerState& aState) {
|
||||
nsresult rv = NS_OK;
|
||||
static void txFnEndChoose(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
txListIterator iter(aState.mChooseGotoList.get());
|
||||
txGoTo* gotoinstr;
|
||||
while ((gotoinstr = static_cast<txGoTo*>(iter.next()))) {
|
||||
rv = aState.addGotoTarget(&gotoinstr->mTarget);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
aState.addGotoTarget(&gotoinstr->mTarget);
|
||||
}
|
||||
|
||||
aState.popChooseGotoList();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1337,10 +1289,8 @@ static nsresult txFnStartComment(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndComment(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndComment(txStylesheetCompilerState& aState) {
|
||||
aState.addInstruction(MakeUnique<txComment>());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1361,11 +1311,11 @@ static nsresult txFnStartCopy(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return parseUseAttrSets(aAttributes, aAttrCount, false, aState);
|
||||
}
|
||||
|
||||
static nsresult txFnEndCopy(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndCopy(txStylesheetCompilerState& aState) {
|
||||
aState.addInstruction(MakeUnique<txEndElement>());
|
||||
|
||||
txCopy* copy = static_cast<txCopy*>(aState.popPtr(aState.eCopy));
|
||||
return aState.addGotoTarget(©->mBailTarget);
|
||||
aState.addGotoTarget(©->mBailTarget);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1391,9 +1341,8 @@ static nsresult txFnStartCopyOf(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndCopyOf(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndCopyOf(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1428,10 +1377,8 @@ static nsresult txFnStartElement(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndElement(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndElement(txStylesheetCompilerState& aState) {
|
||||
aState.addInstruction(MakeUnique<txEndElement>());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1451,12 +1398,11 @@ static nsresult txFnStartFallback(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndFallback(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndFallback(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
NS_ASSERTION(!aState.mSearchingForFallback,
|
||||
"bad nesting of unknown-instruction and fallback handlers");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1492,7 +1438,7 @@ static nsresult txFnStartForEach(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndForEach(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndForEach(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
// This is a txPushNullTemplateRule
|
||||
|
@ -1505,8 +1451,6 @@ static nsresult txFnEndForEach(txStylesheetCompilerState& aState) {
|
|||
txPushNewContext* pushcontext =
|
||||
static_cast<txPushNewContext*>(aState.popPtr(aState.ePushNewContext));
|
||||
aState.addGotoTarget(&pushcontext->mBailTarget);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnStartElementContinueTemplate(
|
||||
|
@ -1552,10 +1496,10 @@ static nsresult txFnStartIf(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndIf(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndIf(txStylesheetCompilerState& aState) {
|
||||
txConditionalGoto* condGoto =
|
||||
static_cast<txConditionalGoto*>(aState.popPtr(aState.eConditionalGoto));
|
||||
return aState.addGotoTarget(&condGoto->mTarget);
|
||||
aState.addGotoTarget(&condGoto->mTarget);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1581,10 +1525,8 @@ static nsresult txFnStartMessage(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndMessage(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndMessage(txStylesheetCompilerState& aState) {
|
||||
aState.addInstruction(popInstruction(aState));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1662,10 +1604,8 @@ static nsresult txFnStartNumber(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndNumber(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndNumber(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1683,11 +1623,9 @@ static nsresult txFnStartOtherwise(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndOtherwise(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndOtherwise(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
aState.mHandlerTable = gTxIgnoreHandler; // XXX should be gTxErrorHandler
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1732,7 +1670,7 @@ static nsresult txFnStartParam(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndParam(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndParam(txStylesheetCompilerState& aState) {
|
||||
UniquePtr<txSetVariable> var = popInstruction<txSetVariable>(aState);
|
||||
txHandlerTable* prev = aState.mHandlerTable;
|
||||
aState.popHandlerTable();
|
||||
|
@ -1743,16 +1681,13 @@ static nsresult txFnEndParam(txStylesheetCompilerState& aState) {
|
|||
var->mValue = MakeUnique<txLiteralExpr>(u""_ns);
|
||||
}
|
||||
|
||||
nsresult rv = aState.addVariable(var->mName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
aState.addVariable(var->mName);
|
||||
|
||||
aState.addInstruction(std::move(var));
|
||||
|
||||
txCheckParam* checkParam =
|
||||
static_cast<txCheckParam*>(aState.popPtr(aState.eCheckParam));
|
||||
aState.addGotoTarget(&checkParam->mBailTarget);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1778,10 +1713,8 @@ static nsresult txFnStartPI(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndPI(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndPI(txStylesheetCompilerState& aState) {
|
||||
aState.addInstruction(popInstruction(aState));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1834,10 +1767,8 @@ static nsresult txFnStartSort(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndSort(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndSort(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1864,10 +1795,9 @@ static nsresult txFnStartText(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndText(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndText(txStylesheetCompilerState& aState) {
|
||||
aState.mDOE = false;
|
||||
aState.popHandlerTable();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnTextText(const nsAString& aStr,
|
||||
|
@ -1905,9 +1835,8 @@ static nsresult txFnStartValueOf(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndValueOf(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndValueOf(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1948,7 +1877,7 @@ static nsresult txFnStartVariable(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndVariable(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndVariable(txStylesheetCompilerState& aState) {
|
||||
UniquePtr<txSetVariable> var = popInstruction<txSetVariable>(aState);
|
||||
|
||||
txHandlerTable* prev = aState.mHandlerTable;
|
||||
|
@ -1960,12 +1889,9 @@ static nsresult txFnEndVariable(txStylesheetCompilerState& aState) {
|
|||
var->mValue = MakeUnique<txLiteralExpr>(u""_ns);
|
||||
}
|
||||
|
||||
nsresult rv = aState.addVariable(var->mName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
aState.addVariable(var->mName);
|
||||
|
||||
aState.addInstruction(std::move(var));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnStartElementStartRTF(int32_t aNamespaceID,
|
||||
|
@ -2016,17 +1942,14 @@ static nsresult txFnStartWhen(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndWhen(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndWhen(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
aState.mChooseGotoList->add(
|
||||
aState.addInstruction(MakeUnique<txGoTo>(nullptr)));
|
||||
|
||||
txConditionalGoto* condGoto =
|
||||
static_cast<txConditionalGoto*>(aState.popPtr(aState.eConditionalGoto));
|
||||
nsresult rv = aState.addGotoTarget(&condGoto->mTarget);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
aState.addGotoTarget(&condGoto->mTarget);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2066,7 +1989,7 @@ static nsresult txFnStartWithParam(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndWithParam(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndWithParam(txStylesheetCompilerState& aState) {
|
||||
UniquePtr<txSetParam> var = popInstruction<txSetParam>(aState);
|
||||
txHandlerTable* prev = aState.mHandlerTable;
|
||||
aState.popHandlerTable();
|
||||
|
@ -2078,8 +2001,6 @@ static nsresult txFnEndWithParam(txStylesheetCompilerState& aState) {
|
|||
}
|
||||
|
||||
aState.addInstruction(std::move(var));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2108,7 +2029,7 @@ static nsresult txFnStartUnknownInstruction(int32_t aNamespaceID,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult txFnEndUnknownInstruction(txStylesheetCompilerState& aState) {
|
||||
static void txFnEndUnknownInstruction(txStylesheetCompilerState& aState) {
|
||||
aState.popHandlerTable();
|
||||
|
||||
if (aState.mSearchingForFallback) {
|
||||
|
@ -2116,8 +2037,6 @@ static nsresult txFnEndUnknownInstruction(txStylesheetCompilerState& aState) {
|
|||
}
|
||||
|
||||
aState.mSearchingForFallback = false;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ using HandleStartFn = nsresult (*)(int32_t aNamespaceID, nsAtom* aLocalName,
|
|||
txStylesheetAttr* aAttributes,
|
||||
int32_t aAttrCount,
|
||||
txStylesheetCompilerState& aState);
|
||||
using HandleEndFn = nsresult (*)(txStylesheetCompilerState& aState);
|
||||
using HandleEndFn = void (*)(txStylesheetCompilerState& aState);
|
||||
using HandleTextFn = nsresult (*)(const nsAString& aStr,
|
||||
txStylesheetCompilerState& aState);
|
||||
|
||||
|
|
|
@ -302,8 +302,7 @@ nsresult txStylesheetCompiler::endElement() {
|
|||
|
||||
const txElementHandler* handler = const_cast<const txElementHandler*>(
|
||||
static_cast<txElementHandler*>(popPtr(eElementHandler)));
|
||||
rv = (handler->mEndFunction)(*this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
(handler->mEndFunction)(*this);
|
||||
|
||||
if (!--mElementContext->mDepth) {
|
||||
// this will delete the old object
|
||||
|
@ -504,7 +503,6 @@ nsresult txStylesheetCompilerState::init(const nsAString& aStylesheetURI,
|
|||
}
|
||||
|
||||
mElementContext = MakeUnique<txElementContext>(aStylesheetURI);
|
||||
NS_ENSURE_TRUE(mElementContext->mMappings, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Push the "old" txElementContext
|
||||
pushObject(nullptr);
|
||||
|
@ -689,17 +687,12 @@ nsresult txStylesheetCompilerState::loadImportedStylesheet(
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult txStylesheetCompilerState::addGotoTarget(
|
||||
txInstruction** aTargetPointer) {
|
||||
void txStylesheetCompilerState::addGotoTarget(txInstruction** aTargetPointer) {
|
||||
mGotoTargetPointers.AppendElement(aTargetPointer);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult txStylesheetCompilerState::addVariable(const txExpandedName& aName) {
|
||||
void txStylesheetCompilerState::addVariable(const txExpandedName& aName) {
|
||||
mInScopeVariables.AppendElement(new txInScopeVariable(aName));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult txStylesheetCompilerState::resolveNamespacePrefix(nsAtom* aPrefix,
|
||||
|
|
|
@ -114,8 +114,8 @@ class txStylesheetCompilerState : public txIParseContext {
|
|||
txStylesheet::ImportFrame* aFrame);
|
||||
|
||||
// misc
|
||||
nsresult addGotoTarget(txInstruction** aTargetPointer);
|
||||
nsresult addVariable(const txExpandedName& aName);
|
||||
void addGotoTarget(txInstruction** aTargetPointer);
|
||||
void addVariable(const txExpandedName& aName);
|
||||
|
||||
// txIParseContext
|
||||
nsresult resolveNamespacePrefix(nsAtom* aPrefix, int32_t& aID) override;
|
||||
|
|
|
@ -27,11 +27,8 @@ txStripSpaceItem::~txStripSpaceItem() {
|
|||
}
|
||||
}
|
||||
|
||||
nsresult txStripSpaceItem::addStripSpaceTest(
|
||||
txStripSpaceTest* aStripSpaceTest) {
|
||||
void txStripSpaceItem::addStripSpaceTest(txStripSpaceTest* aStripSpaceTest) {
|
||||
mStripSpaceTests.AppendElement(aStripSpaceTest);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
TX_IMPL_GETTYPE(txTemplateItem, txToplevelItem::templ)
|
||||
|
|
|
@ -82,7 +82,7 @@ class txStripSpaceItem : public txToplevelItem {
|
|||
|
||||
TX_DECL_TOPLEVELITEM
|
||||
|
||||
nsresult addStripSpaceTest(txStripSpaceTest* aStripSpaceTest);
|
||||
void addStripSpaceTest(txStripSpaceTest* aStripSpaceTest);
|
||||
|
||||
nsTArray<txStripSpaceTest*> mStripSpaceTests;
|
||||
};
|
||||
|
|
|
@ -92,12 +92,10 @@ void txUnionPattern::toString(nsAString& aDest) {
|
|||
* (dealt with by the parser)
|
||||
*/
|
||||
|
||||
nsresult txLocPathPattern::addStep(txPattern* aPattern, bool isChild) {
|
||||
void txLocPathPattern::addStep(txPattern* aPattern, bool isChild) {
|
||||
Step* step = mSteps.AppendElement();
|
||||
step->pattern = WrapUnique(aPattern);
|
||||
step->isChild = isChild;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult txLocPathPattern::matches(const txXPathNode& aNode,
|
||||
|
|
|
@ -102,9 +102,8 @@ class txPattern {
|
|||
|
||||
class txUnionPattern : public txPattern {
|
||||
public:
|
||||
nsresult addPattern(txPattern* aPattern) {
|
||||
void addPattern(txPattern* aPattern) {
|
||||
mLocPathPatterns.AppendElement(aPattern);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
TX_DECL_PATTERN;
|
||||
|
@ -116,7 +115,7 @@ class txUnionPattern : public txPattern {
|
|||
|
||||
class txLocPathPattern : public txPattern {
|
||||
public:
|
||||
nsresult addStep(txPattern* aPattern, bool isChild);
|
||||
void addStep(txPattern* aPattern, bool isChild);
|
||||
|
||||
TX_DECL_PATTERN;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче