Backed out changeset e4062da24f6b (bug 1336828)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Mon, 20 Mar 2017 23:23:01 +0100
changeset 501797 4be6ea42dc48f0c534323b54707edf3c1e2f589b
parent 501796 e4062da24f6b02d3d6998088e82d780a07047e63
child 501798 112d7a5b1a0d3e673e3a434a99d9a99842f0850c
push id50127
push userna-g@nostrum.com
push dateTue, 21 Mar 2017 00:09:45 +0000
bugs1336828
milestone55.0a1
backs oute4062da24f6b02d3d6998088e82d780a07047e63
Backed out changeset e4062da24f6b (bug 1336828)
dom/xslt/crashtests/1336828.html
dom/xslt/crashtests/1336832.html
dom/xslt/crashtests/1338277.html
dom/xslt/crashtests/crashtests.list
dom/xslt/xpath/XPathExpression.cpp
dom/xslt/xpath/txExpr.h
dom/xslt/xpath/txForwardContext.cpp
dom/xslt/xpath/txIXPathContext.h
dom/xslt/xpath/txLocationStep.cpp
dom/xslt/xpath/txNameTest.cpp
dom/xslt/xpath/txNodeSetContext.cpp
dom/xslt/xpath/txNodeTypeTest.cpp
dom/xslt/xpath/txPathExpr.cpp
dom/xslt/xpath/txPredicatedNodeTest.cpp
dom/xslt/xpath/txSingleNodeContext.h
dom/xslt/xpath/txUnionNodeTest.cpp
dom/xslt/xpath/txXPathOptimizer.cpp
dom/xslt/xslt/txExecutionState.cpp
dom/xslt/xslt/txInstructions.cpp
dom/xslt/xslt/txKeyFunctionCall.cpp
dom/xslt/xslt/txMozillaXSLTProcessor.cpp
dom/xslt/xslt/txStylesheet.cpp
dom/xslt/xslt/txStylesheet.h
dom/xslt/xslt/txXSLTNumber.cpp
dom/xslt/xslt/txXSLTNumber.h
dom/xslt/xslt/txXSLTPatterns.cpp
dom/xslt/xslt/txXSLTPatterns.h
deleted file mode 100644
--- a/dom/xslt/crashtests/1336828.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="UTF-8">
-<script id=o_xml type="text/plain"><?xml version="1.0" encoding="UTF-8"?>
-<tag_name/>
-</script>
-<script id=o_xslt type="text/plain"><?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="42">
- <xsl:variable name="var_name"><xsl:template/></xsl:variable>
- <xsl:template match="tag_name[$var_name]"/>
-</xsl:stylesheet>
-</script>
-<script>
-window.onload = function(){
-  let doc = new DOMParser(), proc = new XSLTProcessor();
-  proc.importStylesheet(doc.parseFromString(document.getElementById('o_xslt').textContent, "text/xml"));
-  proc.transformToDocument(doc.parseFromString(document.getElementById('o_xml').textContent, "text/xml"));
-};
-</script>
-</head>
-</html>
deleted file mode 100644
--- a/dom/xslt/crashtests/1336832.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="UTF-8">
-<script id=o_xml type="text/plain"><?xml version="1.0" encoding="UTF-8"?>
-<tag_name/>
-</script>
-<script id=o_xslt type="text/plain"><?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-  <xsl:variable name="var_1">
-    <xsl:for-each select="/">
-      <xsl:value-of select="count()"/>
-    </xsl:for-each>
-  </xsl:variable>
-  <xsl:template match="/">
-    <xsl:value-of select="//*[1 = $var_1]"/>
-  </xsl:template>
-</xsl:stylesheet>
-</script>
-<script>
-window.onload = function(){
-  let doc = new DOMParser(), proc = new XSLTProcessor();
-  proc.importStylesheet(doc.parseFromString(document.getElementById('o_xslt').textContent, "text/xml"));
-  proc.transformToDocument(doc.parseFromString(document.getElementById('o_xml').textContent, "text/xml"));
-};
-</script>
-</head>
-</html>
deleted file mode 100644
--- a/dom/xslt/crashtests/1338277.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<script id=o_xml type="text/plain"><?xml version="1.0" encoding="UTF-8"?>
-<xb></xb>
-</script>
-<script id=o_xslt type="text/plain"><?xml version="1.0" encoding="UTF-8"?>
-<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-  <xsl:template match="xb[$v1]"></xsl:template>
-  <xsl:variable name="v1">
-    <xsl:attribute name="a1" namespace="z">
-      <xsl:variable name="v2" select="$v2"></xsl:variable>
-    </xsl:attribute>
-  </xsl:variable>
-</xsl:transform>
-</script>
-<script>
-addEventListener("DOMContentLoaded", function(){
-  let doc = new DOMParser();
-  let xsltPrs = new XSLTProcessor();
-  xsltPrs.importStylesheet(doc.parseFromString(o_xslt.textContent, "text/xml"));
-  xsltPrs.transformToDocument(doc.parseFromString(o_xml.textContent, "text/xml"));
-});
-</script>
--- a/dom/xslt/crashtests/crashtests.list
+++ b/dom/xslt/crashtests/crashtests.list
@@ -13,12 +13,9 @@ load 528963.xml
 load 545927.html
 load 601543.html
 load 602115.html
 load 603844.html
 load 667315.xml
 load 1089049.html
 load 1205163.xml
 load 1243337.xml
-load 1336828.html
 load 1336830.html
-load 1336832.html
-load 1338277.html
--- a/dom/xslt/xpath/XPathExpression.cpp
+++ b/dom/xslt/xpath/XPathExpression.cpp
@@ -201,22 +201,20 @@ nsresult
 EvalContextImpl::getVariable(int32_t aNamespace,
                              nsIAtom* aLName,
                              txAExprResult*& aResult)
 {
     aResult = 0;
     return NS_ERROR_INVALID_ARG;
 }
 
-nsresult
-EvalContextImpl::isStripSpaceAllowed(const txXPathNode& aNode, bool& aAllowed)
+bool
+EvalContextImpl::isStripSpaceAllowed(const txXPathNode& aNode)
 {
-    aAllowed = false;
-
-    return NS_OK;
+    return false;
 }
 
 void*
 EvalContextImpl::getPrivateContext()
 {
     // we don't have a private context here.
     return nullptr;
 }
--- a/dom/xslt/xpath/txExpr.h
+++ b/dom/xslt/xpath/txExpr.h
@@ -23,17 +23,16 @@
   Much of this code was ported from XSL:P.
 */
 
 class nsIAtom;
 class txIMatchContext;
 class txIEvalContext;
 class txNodeSet;
 class txXPathNode;
-class txXPathTreeWalker;
 
 /**
  * A Base Class for all XSL Expressions
 **/
 class Expr
 {
 public:
     Expr()
@@ -390,19 +389,18 @@ public:
     }
 
     /*
      * Virtual methods
      * pretty much a txPattern, but not supposed to be used 
      * standalone. The NodeTest node() is different to the
      * Pattern "node()" (document node isn't matched)
      */
-    virtual nsresult matches(const txXPathNode& aNode,
-                             txIMatchContext* aContext,
-                             bool& aMatched) = 0;
+    virtual bool matches(const txXPathNode& aNode,
+                           txIMatchContext* aContext) = 0;
     virtual double getDefaultPriority() = 0;
 
     /**
      * Returns the type of this nodetest.
      */
     enum NodeTestType {
         NAME_TEST,
         NODETYPE_TEST,
@@ -421,19 +419,17 @@ public:
 
 #ifdef TX_TO_STRING
     virtual void toString(nsAString& aDest) = 0;
 #endif
 };
 
 #define TX_DECL_NODE_TEST \
     TX_DECL_TOSTRING \
-    nsresult matches(const txXPathNode& aNode, \
-                     txIMatchContext* aContext, \
-                     bool& aMatched) override; \
+    bool matches(const txXPathNode& aNode, txIMatchContext* aContext) override; \
     double getDefaultPriority() override; \
     bool isSensitiveTo(Expr::ContextSensitivity aContext) override;
 
 /*
  * This class represents a NameTest as defined by the XPath spec
  */
 class txNameTest : public txNodeTest
 {
@@ -629,40 +625,20 @@ public:
         return mAxisIdentifier;
     }
     void setAxisIdentifier(LocationStepType aAxisIdentifier)
     {
         mAxisIdentifier = aAxisIdentifier;
     }
 
 private:
-    /**
-     * Append the current position of aWalker to aNodes if it matches mNodeTest,
-     * using aContext as the context for matching.
-     */
-    nsresult appendIfMatching(const txXPathTreeWalker& aWalker,
-                              txIMatchContext* aContext,
-                              txNodeSet* aNodes);
-
-    /**
-     * Append the descendants of the current position of aWalker to aNodes if
-     * they match mNodeTest, using aContext as the context for matching.
-     */
-    nsresult appendMatchingDescendants(const txXPathTreeWalker& aWalker,
-                                       txIMatchContext* aContext,
-                                       txNodeSet* aNodes);
-
-    /**
-     * Append the descendants of the current position of aWalker to aNodes in
-     * reverse order if they match mNodeTest, using aContext as the context for
-     * matching.
-     */
-    nsresult appendMatchingDescendantsRev(const txXPathTreeWalker& aWalker,
-                                          txIMatchContext* aContext,
-                                          txNodeSet* aNodes);
+    void fromDescendants(const txXPathNode& aNode, txIMatchContext* aCs,
+                         txNodeSet* aNodes);
+    void fromDescendantsRev(const txXPathNode& aNode, txIMatchContext* aCs,
+                            txNodeSet* aNodes);
 
     nsAutoPtr<txNodeTest> mNodeTest;
     LocationStepType mAxisIdentifier;
 };
 
 class FilterExpr : public Expr,
                    public PredicateList
 {
--- a/dom/xslt/xpath/txForwardContext.cpp
+++ b/dom/xslt/xpath/txForwardContext.cpp
@@ -25,21 +25,20 @@ uint32_t txForwardContext::position()
 
 nsresult txForwardContext::getVariable(int32_t aNamespace, nsIAtom* aLName,
                                        txAExprResult*& aResult)
 {
     NS_ASSERTION(mInner, "mInner is null!!!");
     return mInner->getVariable(aNamespace, aLName, aResult);
 }
 
-nsresult
-txForwardContext::isStripSpaceAllowed(const txXPathNode& aNode, bool& aAllowed)
+bool txForwardContext::isStripSpaceAllowed(const txXPathNode& aNode)
 {
     NS_ASSERTION(mInner, "mInner is null!!!");
-    return mInner->isStripSpaceAllowed(aNode, aAllowed);
+    return mInner->isStripSpaceAllowed(aNode);
 }
 
 void* txForwardContext::getPrivateContext()
 {
     NS_ASSERTION(mInner, "mInner is null!!!");
     return mInner->getPrivateContext();
 }
 
--- a/dom/xslt/xpath/txIXPathContext.h
+++ b/dom/xslt/xpath/txIXPathContext.h
@@ -83,18 +83,17 @@ public:
      */
     virtual nsresult getVariable(int32_t aNamespace, nsIAtom* aLName,
                                  txAExprResult*& aResult) = 0;
 
     /*
      * Is whitespace stripping allowed for the given node?
      * See http://www.w3.org/TR/xslt#strip
      */
-    virtual nsresult isStripSpaceAllowed(const txXPathNode& aNode,
-                                         bool& aAllowed) = 0;
+    virtual bool isStripSpaceAllowed(const txXPathNode& aNode) = 0;
 
     /**
      * Returns a pointer to the private context
      */
     virtual void* getPrivateContext() = 0;
 
     virtual txResultRecycler* recycler() = 0;
 
@@ -102,17 +101,17 @@ public:
      * Callback to be used by the expression/pattern if errors are detected.
      */
     virtual void receiveError(const nsAString& aMsg, nsresult aRes) = 0;
 };
 
 #define TX_DECL_MATCH_CONTEXT \
     nsresult getVariable(int32_t aNamespace, nsIAtom* aLName, \
                          txAExprResult*& aResult); \
-    nsresult isStripSpaceAllowed(const txXPathNode& aNode, bool& aAllowed); \
+    bool isStripSpaceAllowed(const txXPathNode& aNode); \
     void* getPrivateContext(); \
     txResultRecycler* recycler(); \
     void receiveError(const nsAString& aMsg, nsresult aRes)
 
 class txIEvalContext : public txIMatchContext
 {
 public:
     /*
--- a/dom/xslt/xpath/txLocationStep.cpp
+++ b/dom/xslt/xpath/txLocationStep.cpp
@@ -44,150 +44,155 @@ LocationStep::evaluate(txIEvalContext* a
             }
             MOZ_FALLTHROUGH;
         }
         case ANCESTOR_OR_SELF_AXIS:
         {
             nodes->setReverse();
 
             do {
-                rv = appendIfMatching(walker, aContext, nodes);
-                NS_ENSURE_SUCCESS(rv, rv);
+                if (mNodeTest->matches(walker.getCurrentPosition(), aContext)) {
+                    nodes->append(walker.getCurrentPosition());
+                }
             } while (walker.moveToParent());
 
             break;
         }
         case ATTRIBUTE_AXIS:
         {
             if (!walker.moveToFirstAttribute()) {
                 break;
             }
 
             do {
-                rv = appendIfMatching(walker, aContext, nodes);
-                NS_ENSURE_SUCCESS(rv, rv);
+                if (mNodeTest->matches(walker.getCurrentPosition(), aContext)) {
+                    nodes->append(walker.getCurrentPosition());
+                }
             } while (walker.moveToNextAttribute());
             break;
         }
         case DESCENDANT_OR_SELF_AXIS:
         {
-            rv = appendIfMatching(walker, aContext, nodes);
-            NS_ENSURE_SUCCESS(rv, rv);
+            if (mNodeTest->matches(walker.getCurrentPosition(), aContext)) {
+                nodes->append(walker.getCurrentPosition());
+            }
             MOZ_FALLTHROUGH;
         }
         case DESCENDANT_AXIS:
         {
-            rv = appendMatchingDescendants(walker, aContext, nodes);
-            NS_ENSURE_SUCCESS(rv, rv);
+            fromDescendants(walker.getCurrentPosition(), aContext, nodes);
             break;
         }
         case FOLLOWING_AXIS:
         {
             if (txXPathNodeUtils::isAttribute(walker.getCurrentPosition())) {
                 walker.moveToParent();
-                rv = appendMatchingDescendants(walker, aContext, nodes);
-                NS_ENSURE_SUCCESS(rv, rv);
+                fromDescendants(walker.getCurrentPosition(), aContext, nodes);
             }
             bool cont = true;
             while (!walker.moveToNextSibling()) {
                 if (!walker.moveToParent()) {
                     cont = false;
                     break;
                 }
             }
             while (cont) {
-                rv = appendIfMatching(walker, aContext, nodes);
-                NS_ENSURE_SUCCESS(rv, rv);
+                if (mNodeTest->matches(walker.getCurrentPosition(), aContext)) {
+                    nodes->append(walker.getCurrentPosition());
+                }
 
-                rv = appendMatchingDescendants(walker, aContext, nodes);
-                NS_ENSURE_SUCCESS(rv, rv);
+                fromDescendants(walker.getCurrentPosition(), aContext, nodes);
 
                 while (!walker.moveToNextSibling()) {
                     if (!walker.moveToParent()) {
                         cont = false;
                         break;
                     }
                 }
             }
             break;
         }
         case FOLLOWING_SIBLING_AXIS:
         {
             while (walker.moveToNextSibling()) {
-                rv = appendIfMatching(walker, aContext, nodes);
-                NS_ENSURE_SUCCESS(rv, rv);
+                if (mNodeTest->matches(walker.getCurrentPosition(), aContext)) {
+                    nodes->append(walker.getCurrentPosition());
+                }
             }
             break;
         }
         case NAMESPACE_AXIS: //-- not yet implemented
 #if 0
             // XXX DEBUG OUTPUT
             cout << "namespace axis not yet implemented"<<endl;
 #endif
             break;
         case PARENT_AXIS :
         {
-            if (walker.moveToParent()) {
-                rv = appendIfMatching(walker, aContext, nodes);
-                NS_ENSURE_SUCCESS(rv, rv);
+            if (walker.moveToParent() &&
+                mNodeTest->matches(walker.getCurrentPosition(), aContext)) {
+                nodes->append(walker.getCurrentPosition());
             }
             break;
         }
         case PRECEDING_AXIS:
         {
             nodes->setReverse();
 
             bool cont = true;
             while (!walker.moveToPreviousSibling()) {
                 if (!walker.moveToParent()) {
                     cont = false;
                     break;
                 }
             }
             while (cont) {
-                rv = appendMatchingDescendantsRev(walker, aContext, nodes);
-                NS_ENSURE_SUCCESS(rv, rv);
+                fromDescendantsRev(walker.getCurrentPosition(), aContext, nodes);
 
-                rv = appendIfMatching(walker, aContext, nodes);
-                NS_ENSURE_SUCCESS(rv, rv);
+                if (mNodeTest->matches(walker.getCurrentPosition(), aContext)) {
+                    nodes->append(walker.getCurrentPosition());
+                }
 
                 while (!walker.moveToPreviousSibling()) {
                     if (!walker.moveToParent()) {
                         cont = false;
                         break;
                     }
                 }
             }
             break;
         }
         case PRECEDING_SIBLING_AXIS:
         {
             nodes->setReverse();
 
             while (walker.moveToPreviousSibling()) {
-                rv = appendIfMatching(walker, aContext, nodes);
-                NS_ENSURE_SUCCESS(rv, rv);
+                if (mNodeTest->matches(walker.getCurrentPosition(), aContext)) {
+                    nodes->append(walker.getCurrentPosition());
+                }
             }
             break;
         }
         case SELF_AXIS:
         {
-            rv = appendIfMatching(walker, aContext, nodes);
-            NS_ENSURE_SUCCESS(rv, rv);
+            if (mNodeTest->matches(walker.getCurrentPosition(), aContext)) {
+                nodes->append(walker.getCurrentPosition());
+            }
             break;
         }
         default: // Children Axis
         {
             if (!walker.moveToFirstChild()) {
                 break;
             }
 
             do {
-                rv = appendIfMatching(walker, aContext, nodes);
-                NS_ENSURE_SUCCESS(rv, rv);
+                if (mNodeTest->matches(walker.getCurrentPosition(), aContext)) {
+                    nodes->append(walker.getCurrentPosition());
+                }
             } while (walker.moveToNextSibling());
             break;
         }
     }
 
     // Apply predicates
     if (!isEmpty()) {
         rv = evaluatePredicates(nodes, aContext);
@@ -196,72 +201,52 @@ LocationStep::evaluate(txIEvalContext* a
 
     nodes->unsetReverse();
 
     NS_ADDREF(*aResult = nodes);
 
     return NS_OK;
 }
 
-nsresult
-LocationStep::appendIfMatching(const txXPathTreeWalker& aWalker,
-                               txIMatchContext* aContext,
-                               txNodeSet* aNodes)
+void LocationStep::fromDescendants(const txXPathNode& aNode,
+                                   txIMatchContext* aCs,
+                                   txNodeSet* aNodes)
 {
-    bool matched;
-    const txXPathNode& child = aWalker.getCurrentPosition();
-    nsresult rv = mNodeTest->matches(child, aContext, matched);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (matched) {
-        aNodes->append(child);
-    }
-    return NS_OK;
-}
-
-nsresult
-LocationStep::appendMatchingDescendants(const txXPathTreeWalker& aWalker,
-                                        txIMatchContext* aContext,
-                                        txNodeSet* aNodes)
-{
-    txXPathTreeWalker walker(aWalker);
+    txXPathTreeWalker walker(aNode);
     if (!walker.moveToFirstChild()) {
-        return NS_OK;
+        return;
     }
 
     do {
-        nsresult rv = appendIfMatching(walker, aContext, aNodes);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        rv = appendMatchingDescendants(walker, aContext, aNodes);
-        NS_ENSURE_SUCCESS(rv, rv);
+        const txXPathNode& child = walker.getCurrentPosition();
+        if (mNodeTest->matches(child, aCs)) {
+            aNodes->append(child);
+        }
+        fromDescendants(child, aCs, aNodes);
     } while (walker.moveToNextSibling());
-
-    return NS_OK;
 }
 
-nsresult
-LocationStep::appendMatchingDescendantsRev(const txXPathTreeWalker& aWalker,
-                                           txIMatchContext* aContext,
-                                           txNodeSet* aNodes)
+void LocationStep::fromDescendantsRev(const txXPathNode& aNode,
+                                      txIMatchContext* aCs,
+                                      txNodeSet* aNodes)
 {
-    txXPathTreeWalker walker(aWalker);
+    txXPathTreeWalker walker(aNode);
     if (!walker.moveToLastChild()) {
-        return NS_OK;
+        return;
     }
 
     do {
-        nsresult rv = appendMatchingDescendantsRev(walker, aContext, aNodes);
-        NS_ENSURE_SUCCESS(rv, rv);
+        const txXPathNode& child = walker.getCurrentPosition();
+        fromDescendantsRev(child, aCs, aNodes);
 
-        rv = appendIfMatching(walker, aContext, aNodes);
-        NS_ENSURE_SUCCESS(rv, rv);
+        if (mNodeTest->matches(child, aCs)) {
+            aNodes->append(child);
+        }
+
     } while (walker.moveToPreviousSibling());
-
-    return NS_OK;
 }
 
 Expr::ExprType
 LocationStep::getType()
 {
   return LOCATIONSTEP_EXPR;
 }
 
--- a/dom/xslt/xpath/txNameTest.cpp
+++ b/dom/xslt/xpath/txNameTest.cpp
@@ -18,54 +18,44 @@ txNameTest::txNameTest(nsIAtom* aPrefix,
         mPrefix = nullptr;
     NS_ASSERTION(aLocalName, "txNameTest without a local name?");
     NS_ASSERTION(aNodeType == txXPathNodeType::DOCUMENT_NODE ||
                  aNodeType == txXPathNodeType::ELEMENT_NODE ||
                  aNodeType == txXPathNodeType::ATTRIBUTE_NODE,
                  "Go fix txNameTest::matches");
 }
 
-nsresult
-txNameTest::matches(const txXPathNode& aNode, txIMatchContext* aContext,
-                    bool& aMatched)
+bool txNameTest::matches(const txXPathNode& aNode, txIMatchContext* aContext)
 {
     if ((mNodeType == txXPathNodeType::ELEMENT_NODE &&
          !txXPathNodeUtils::isElement(aNode)) ||
         (mNodeType == txXPathNodeType::ATTRIBUTE_NODE &&
          !txXPathNodeUtils::isAttribute(aNode)) ||
         (mNodeType == txXPathNodeType::DOCUMENT_NODE &&
          !txXPathNodeUtils::isRoot(aNode))) {
-        aMatched = false;
-        return NS_OK;
+        return false;
     }
 
     // Totally wild?
-    if (mLocalName == nsGkAtoms::_asterisk && !mPrefix) {
-        aMatched = true;
-        return NS_OK;
-    }
+    if (mLocalName == nsGkAtoms::_asterisk && !mPrefix)
+        return true;
 
     // Compare namespaces
     if (mNamespace != txXPathNodeUtils::getNamespaceID(aNode) 
         && !(mNamespace == kNameSpaceID_None &&
              txXPathNodeUtils::isHTMLElementInHTMLDocument(aNode))
-       ) {
-        aMatched = false;
-        return NS_OK;
-    }
+       )
+        return false;
 
     // Name wild?
-    if (mLocalName == nsGkAtoms::_asterisk) {
-        aMatched = true;
-        return NS_OK;
-    }
+    if (mLocalName == nsGkAtoms::_asterisk)
+        return true;
 
     // Compare local-names
-    aMatched = txXPathNodeUtils::localNameEquals(aNode, mLocalName);
-    return NS_OK;
+    return txXPathNodeUtils::localNameEquals(aNode, mLocalName);
 }
 
 /*
  * Returns the default priority of this txNodeTest
  */
 double txNameTest::getDefaultPriority()
 {
     if (mLocalName == nsGkAtoms::_asterisk) {
--- a/dom/xslt/xpath/txNodeSetContext.cpp
+++ b/dom/xslt/xpath/txNodeSetContext.cpp
@@ -24,21 +24,20 @@ uint32_t txNodeSetContext::position()
 
 nsresult txNodeSetContext::getVariable(int32_t aNamespace, nsIAtom* aLName,
                                        txAExprResult*& aResult)
 {
     NS_ASSERTION(mInner, "mInner is null!!!");
     return mInner->getVariable(aNamespace, aLName, aResult);
 }
 
-nsresult
-txNodeSetContext::isStripSpaceAllowed(const txXPathNode& aNode, bool& aAllowed)
+bool txNodeSetContext::isStripSpaceAllowed(const txXPathNode& aNode)
 {
     NS_ASSERTION(mInner, "mInner is null!!!");
-    return mInner->isStripSpaceAllowed(aNode, aAllowed);
+    return mInner->isStripSpaceAllowed(aNode);
 }
 
 void* txNodeSetContext::getPrivateContext()
 {
     NS_ASSERTION(mInner, "mInner is null!!!");
     return mInner->getPrivateContext();
 }
 
--- a/dom/xslt/xpath/txNodeTypeTest.cpp
+++ b/dom/xslt/xpath/txNodeTypeTest.cpp
@@ -3,61 +3,42 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "txExpr.h"
 #include "nsIAtom.h"
 #include "txIXPathContext.h"
 #include "txXPathTreeWalker.h"
 
-nsresult
-txNodeTypeTest::matches(const txXPathNode& aNode, txIMatchContext* aContext,
-                        bool& aMatched)
+bool txNodeTypeTest::matches(const txXPathNode& aNode,
+                               txIMatchContext* aContext)
 {
     switch (mNodeType) {
         case COMMENT_TYPE:
         {
-            aMatched = txXPathNodeUtils::isComment(aNode);
-            return NS_OK;
+            return txXPathNodeUtils::isComment(aNode);
         }
         case TEXT_TYPE:
         {
-            aMatched = txXPathNodeUtils::isText(aNode);
-            if (aMatched) {
-                bool allowed;
-                nsresult rv = aContext->isStripSpaceAllowed(aNode, allowed);
-                NS_ENSURE_SUCCESS(rv, rv);
-
-                aMatched = !allowed;
-            }
-            return NS_OK;
+            return txXPathNodeUtils::isText(aNode) &&
+                   !aContext->isStripSpaceAllowed(aNode);
         }
         case PI_TYPE:
         {
-            aMatched = txXPathNodeUtils::isProcessingInstruction(aNode) &&
-                       (!mNodeName ||
-                        txXPathNodeUtils::localNameEquals(aNode, mNodeName));
-            return NS_OK;
+            return txXPathNodeUtils::isProcessingInstruction(aNode) &&
+                   (!mNodeName ||
+                    txXPathNodeUtils::localNameEquals(aNode, mNodeName));
         }
         case NODE_TYPE:
         {
-            if (txXPathNodeUtils::isText(aNode)) {
-                bool allowed;
-                nsresult rv = aContext->isStripSpaceAllowed(aNode, allowed);
-                NS_ENSURE_SUCCESS(rv, rv);
-
-                aMatched = !allowed;
-            } else {
-                aMatched = true;
-            }
-            return NS_OK;
+            return !txXPathNodeUtils::isText(aNode) ||
+                   !aContext->isStripSpaceAllowed(aNode);
         }
     }
-
-    NS_NOTREACHED("Didn't deal with all values of the NodeType enum!");
+    return true;
 }
 
 txNodeTest::NodeTestType
 txNodeTypeTest::getType()
 {
     return NODETYPE_TEST;
 }
 
--- a/dom/xslt/xpath/txPathExpr.cpp
+++ b/dom/xslt/xpath/txPathExpr.cpp
@@ -155,19 +155,17 @@ PathExpr::evalDescendants(Expr* aStep, c
                                    (static_cast<txAExprResult*>(res));
     RefPtr<txNodeSet> newSet;
     rv = aContext->recycler()->getNonSharedNodeSet(oldSet,
                                                    getter_AddRefs(newSet));
     NS_ENSURE_SUCCESS(rv, rv);
 
     resNodes->addAndTransfer(newSet);
 
-    bool filterWS;
-    rv = aContext->isStripSpaceAllowed(aNode, filterWS);
-    NS_ENSURE_SUCCESS(rv, rv);
+    bool filterWS = aContext->isStripSpaceAllowed(aNode);
 
     txXPathTreeWalker walker(aNode);
     if (!walker.moveToFirstChild()) {
         return NS_OK;
     }
 
     do {
         const txXPathNode& node = walker.getCurrentPosition();
--- a/dom/xslt/xpath/txPredicatedNodeTest.cpp
+++ b/dom/xslt/xpath/txPredicatedNodeTest.cpp
@@ -11,35 +11,30 @@ txPredicatedNodeTest::txPredicatedNodeTe
                                            Expr* aPredicate)
     : mNodeTest(aNodeTest),
       mPredicate(aPredicate)
 {
     NS_ASSERTION(!mPredicate->isSensitiveTo(Expr::NODESET_CONTEXT),
                  "predicate must not be context-nodeset-sensitive");
 }
 
-nsresult
+bool
 txPredicatedNodeTest::matches(const txXPathNode& aNode,
-                              txIMatchContext* aContext,
-                              bool& aMatched)
+                              txIMatchContext* aContext)
 {
-    nsresult rv = mNodeTest->matches(aNode, aContext, aMatched);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (!aMatched) {
-        return NS_OK;
+    if (!mNodeTest->matches(aNode, aContext)) {
+        return false;
     }
 
     txSingleNodeContext context(aNode, aContext);
     RefPtr<txAExprResult> res;
-    rv = mPredicate->evaluate(&context, getter_AddRefs(res));
-    NS_ENSURE_SUCCESS(rv, rv);
+    nsresult rv = mPredicate->evaluate(&context, getter_AddRefs(res));
+    NS_ENSURE_SUCCESS(rv, false);
 
-    aMatched = res->booleanValue();
-    return NS_OK;
+    return res->booleanValue();
 }
 
 double
 txPredicatedNodeTest::getDefaultPriority()
 {
     return 0.5;
 }
 
--- a/dom/xslt/xpath/txSingleNodeContext.h
+++ b/dom/xslt/xpath/txSingleNodeContext.h
@@ -22,21 +22,20 @@ public:
 
     nsresult getVariable(int32_t aNamespace, nsIAtom* aLName,
                          txAExprResult*& aResult) override
     {
         NS_ASSERTION(mInner, "mInner is null!!!");
         return mInner->getVariable(aNamespace, aLName, aResult);
     }
 
-    nsresult isStripSpaceAllowed(const txXPathNode& aNode,
-                                 bool& aAllowed) override
+    bool isStripSpaceAllowed(const txXPathNode& aNode) override
     {
         NS_ASSERTION(mInner, "mInner is null!!!");
-        return mInner->isStripSpaceAllowed(aNode, aAllowed);
+        return mInner->isStripSpaceAllowed(aNode);
     }
 
     void* getPrivateContext() override
     {
         NS_ASSERTION(mInner, "mInner is null!!!");
         return mInner->getPrivateContext();
     }
 
--- a/dom/xslt/xpath/txUnionNodeTest.cpp
+++ b/dom/xslt/xpath/txUnionNodeTest.cpp
@@ -5,32 +5,28 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/FloatingPoint.h"
 
 #include "txExpr.h"
 #include "txExprResult.h"
 #include "txSingleNodeContext.h"
 
-nsresult
-txUnionNodeTest::matches(const txXPathNode& aNode, txIMatchContext* aContext,
-                         bool& aMatched)
+bool
+txUnionNodeTest::matches(const txXPathNode& aNode,
+                         txIMatchContext* aContext)
 {
     uint32_t i, len = mNodeTests.Length();
     for (i = 0; i < len; ++i) {
-        nsresult rv = mNodeTests[i]->matches(aNode, aContext, aMatched);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        if (aMatched) {
-            return NS_OK;
+        if (mNodeTests[i]->matches(aNode, aContext)) {
+            return true;
         }
     }
 
-    aMatched = false;
-    return NS_OK;
+    return false;
 }
 
 double
 txUnionNodeTest::getDefaultPriority()
 {
     NS_ERROR("Don't call getDefaultPriority on txUnionPattern");
     return mozilla::UnspecifiedNaN<double>();
 }
--- a/dom/xslt/xpath/txXPathOptimizer.cpp
+++ b/dom/xslt/xpath/txXPathOptimizer.cpp
@@ -21,17 +21,17 @@ public:
     }
 
     // txIEvalContext
     nsresult getVariable(int32_t aNamespace, nsIAtom* aLName,
                          txAExprResult*& aResult)
     {
         MOZ_CRASH("shouldn't depend on this context");
     }
-    nsresult isStripSpaceAllowed(const txXPathNode& aNode, bool& aAllowed)
+    bool isStripSpaceAllowed(const txXPathNode& aNode)
     {
         MOZ_CRASH("shouldn't depend on this context");
     }
     void* getPrivateContext()
     {
         MOZ_CRASH("shouldn't depend on this context");
     }
     txResultRecycler* recycler()
--- a/dom/xslt/xslt/txExecutionState.cpp
+++ b/dom/xslt/xslt/txExecutionState.cpp
@@ -133,21 +133,18 @@ txExecutionState::init(const txXPathNode
     // The actual value here doesn't really matter since noone should use this
     // value. But lets put something errorlike in just in case
     mGlobalVarPlaceholderValue = new StringResult(NS_LITERAL_STRING("Error"), nullptr);
 
     // Initiate first instruction. This has to be done last since findTemplate
     // might use us.
     txStylesheet::ImportFrame* frame = 0;
     txExpandedName nullName;
-    txInstruction* templ;
-    rv = mStylesheet->findTemplate(aNode, nullName, this, nullptr, &templ,
-                                   &frame);
-    NS_ENSURE_SUCCESS(rv, rv);
-
+    txInstruction* templ = mStylesheet->findTemplate(aNode, nullName,
+                                                     this, nullptr, &frame);
     pushTemplateRule(frame, nullName, nullptr);
 
     return runTemplate(templ);
 }
 
 nsresult
 txExecutionState::end(nsresult aResult)
 {
@@ -290,20 +287,20 @@ txExecutionState::getVariable(int32_t aN
         NS_RELEASE(aResult);
 
         return rv;
     }
 
     return NS_OK;
 }
 
-nsresult
-txExecutionState::isStripSpaceAllowed(const txXPathNode& aNode, bool& aAllowed)
+bool
+txExecutionState::isStripSpaceAllowed(const txXPathNode& aNode)
 {
-    return mStylesheet->isStripSpaceAllowed(aNode, this, aAllowed);
+    return mStylesheet->isStripSpaceAllowed(aNode, this);
 }
 
 void*
 txExecutionState::getPrivateContext()
 {
     return this;
 }
 
--- a/dom/xslt/xslt/txInstructions.cpp
+++ b/dom/xslt/xslt/txInstructions.cpp
@@ -22,21 +22,19 @@
 using mozilla::Move;
 
 nsresult
 txApplyDefaultElementTemplate::execute(txExecutionState& aEs)
 {
     txExecutionState::TemplateRule* rule = aEs.getCurrentTemplateRule();
     txExpandedName mode(rule->mModeNsId, rule->mModeLocalName);
     txStylesheet::ImportFrame* frame = 0;
-    txInstruction* templ;
-    nsresult rv =
+    txInstruction* templ =
         aEs.mStylesheet->findTemplate(aEs.getEvalContext()->getContextNode(),
-                                      mode, &aEs, nullptr, &templ, &frame);
-    NS_ENSURE_SUCCESS(rv, rv);
+                                      mode, &aEs, nullptr, &frame);
 
     aEs.pushTemplateRule(frame, mode, aEs.mTemplateParams);
 
     return aEs.runTemplate(templ);
 }
 
 nsresult
 txApplyImports::execute(txExecutionState& aEs)
@@ -50,21 +48,19 @@ txApplyImports::execute(txExecutionState
         return NS_ERROR_XSLT_EXECUTION_FAILURE;
     }
 
     nsresult rv = aEs.pushParamMap(rule->mParams);
     NS_ENSURE_SUCCESS(rv, rv);
 
     txStylesheet::ImportFrame* frame = 0;
     txExpandedName mode(rule->mModeNsId, rule->mModeLocalName);
-    txInstruction* templ;
-    rv = aEs.mStylesheet->findTemplate(aEs.getEvalContext()->getContextNode(),
-                                       mode, &aEs, rule->mFrame, &templ,
-                                       &frame);
-    NS_ENSURE_SUCCESS(rv, rv);
+    txInstruction* templ =
+        aEs.mStylesheet->findTemplate(aEs.getEvalContext()->getContextNode(),
+                                      mode, &aEs, rule->mFrame, &frame);
 
     aEs.pushTemplateRule(frame, mode, rule->mParams);
 
     rv = aEs.runTemplate(templ);
 
     aEs.popTemplateRule();
     aEs.popParamMap();
 
@@ -75,21 +71,19 @@ txApplyTemplates::txApplyTemplates(const
     : mMode(aMode)
 {
 }
 
 nsresult
 txApplyTemplates::execute(txExecutionState& aEs)
 {
     txStylesheet::ImportFrame* frame = 0;
-    txInstruction* templ;
-    nsresult rv =
+    txInstruction* templ =
         aEs.mStylesheet->findTemplate(aEs.getEvalContext()->getContextNode(),
-                                      mMode, &aEs, nullptr, &templ, &frame);
-    NS_ENSURE_SUCCESS(rv, rv);
+                                      mMode, &aEs, nullptr, &frame);
 
     aEs.pushTemplateRule(frame, mMode, aEs.mTemplateParams);
 
     return aEs.runTemplate(templ);
 }
 
 txAttribute::txAttribute(nsAutoPtr<Expr>&& aName, nsAutoPtr<Expr>&& aNamespace,
                          txNamespaceMap* aMappings)
--- a/dom/xslt/xslt/txKeyFunctionCall.cpp
+++ b/dom/xslt/xslt/txKeyFunctionCall.cpp
@@ -333,21 +333,17 @@ nsresult txXSLKey::indexTree(const txXPa
 nsresult txXSLKey::testNode(const txXPathNode& aNode,
                             txKeyValueHashKey& aKey,
                             txKeyValueHash& aKeyValueHash,
                             txExecutionState& aEs)
 {
     nsAutoString val;
     uint32_t currKey, numKeys = mKeys.Length();
     for (currKey = 0; currKey < numKeys; ++currKey) {
-        bool matched;
-        nsresult rv = mKeys[currKey].matchPattern->matches(aNode, &aEs, matched);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        if (matched) {
+        if (mKeys[currKey].matchPattern->matches(aNode, &aEs)) {
             txSingleNodeContext *evalContext =
                 new txSingleNodeContext(aNode, &aEs);
             NS_ENSURE_TRUE(evalContext, NS_ERROR_OUT_OF_MEMORY);
 
             nsresult rv = aEs.pushEvalContext(evalContext);
             NS_ENSURE_SUCCESS(rv, rv);
 
             RefPtr<txAExprResult> exprResult;
--- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
+++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
@@ -436,21 +436,19 @@ public:
 
     // txIEvalContext
     nsresult getVariable(int32_t aNamespace, nsIAtom* aLName,
                          txAExprResult*& aResult)
     {
         aResult = nullptr;
         return NS_ERROR_INVALID_ARG;
     }
-    nsresult isStripSpaceAllowed(const txXPathNode& aNode, bool& aAllowed)
+    bool isStripSpaceAllowed(const txXPathNode& aNode)
     {
-        aAllowed = false;
-
-        return NS_OK;
+        return false;
     }
     void* getPrivateContext()
     {
         return nullptr;
     }
     txResultRecycler* recycler()
     {
         return mRecycler;
--- a/dom/xslt/xslt/txStylesheet.cpp
+++ b/dom/xslt/xslt/txStylesheet.cpp
@@ -83,79 +83,74 @@ txStylesheet::~txStylesheet()
     // We can't make the map own its values because then we wouldn't be able
     // to merge attributesets of the same name
     txExpandedNameMap<txInstruction>::iterator attrSetIter(mAttributeSets);
     while (attrSetIter.next()) {
         delete attrSetIter.value();
     }
 }
 
-nsresult
+txInstruction*
 txStylesheet::findTemplate(const txXPathNode& aNode,
                            const txExpandedName& aMode,
                            txIMatchContext* aContext,
                            ImportFrame* aImportedBy,
-                           txInstruction** aTemplate,
                            ImportFrame** aImportFrame)
 {
     NS_ASSERTION(aImportFrame, "missing ImportFrame pointer");
 
-    *aTemplate = nullptr;
     *aImportFrame = nullptr;
+    txInstruction* matchTemplate = nullptr;
     ImportFrame* endFrame = nullptr;
     txListIterator frameIter(&mImportFrames);
 
     if (aImportedBy) {
         ImportFrame* curr = static_cast<ImportFrame*>(frameIter.next());
         while (curr != aImportedBy) {
                curr = static_cast<ImportFrame*>(frameIter.next());
         }
         endFrame = aImportedBy->mFirstNotImported;
     }
 
 #if defined(TX_TO_STRING)
     txPattern* match = 0;
 #endif
 
     ImportFrame* frame;
-    while (!*aTemplate &&
+    while (!matchTemplate &&
            (frame = static_cast<ImportFrame*>(frameIter.next())) &&
            frame != endFrame) {
 
         // get templatelist for this mode
         nsTArray<MatchableTemplate>* templates =
             frame->mMatchableTemplates.get(aMode);
 
         if (templates) {
             // Find template with highest priority
             uint32_t i, len = templates->Length();
-            for (i = 0; i < len && !*aTemplate; ++i) {
+            for (i = 0; i < len && !matchTemplate; ++i) {
                 MatchableTemplate& templ = (*templates)[i];
-                bool matched;
-                nsresult rv = templ.mMatch->matches(aNode, aContext, matched);
-                NS_ENSURE_SUCCESS(rv, rv);
-
-                if (matched) {
-                    *aTemplate = templ.mFirstInstruction;
+                if (templ.mMatch->matches(aNode, aContext)) {
+                    matchTemplate = templ.mFirstInstruction;
                     *aImportFrame = frame;
 #if defined(TX_TO_STRING)
                     match = templ.mMatch;
 #endif
                 }
             }
         }
     }
 
     if (MOZ_LOG_TEST(txLog::xslt, LogLevel::Debug)) {
       nsAutoString mode, nodeName;
       if (aMode.mLocalName) {
           aMode.mLocalName->ToString(mode);
       }
       txXPathNodeUtils::getNodeName(aNode, nodeName);
-      if (*aTemplate) {
+      if (matchTemplate) {
           nsAutoString matchAttr;
 #ifdef TX_TO_STRING
           match->toString(matchAttr);
 #endif
           MOZ_LOG(txLog::xslt, LogLevel::Debug,
                  ("MatchTemplate, Pattern %s, Mode %s, Node %s\n",
                   NS_LossyConvertUTF16toASCII(matchAttr).get(),
                   NS_LossyConvertUTF16toASCII(mode).get(),
@@ -164,33 +159,33 @@ txStylesheet::findTemplate(const txXPath
       else {
           MOZ_LOG(txLog::xslt, LogLevel::Debug,
                  ("No match, Node %s, Mode %s\n", 
                   NS_LossyConvertUTF16toASCII(nodeName).get(),
                   NS_LossyConvertUTF16toASCII(mode).get()));
       }
     }
 
-    if (!*aTemplate) {
+    if (!matchTemplate) {
         // Test for these first since a node can be both a text node
         // and a root (if it is orphaned)
         if (txXPathNodeUtils::isAttribute(aNode) ||
             txXPathNodeUtils::isText(aNode)) {
-            *aTemplate = mCharactersTemplate;
+            matchTemplate = mCharactersTemplate;
         }
         else if (txXPathNodeUtils::isElement(aNode) ||
                  txXPathNodeUtils::isRoot(aNode)) {
-            *aTemplate = mContainerTemplate;
+            matchTemplate = mContainerTemplate;
         }
         else {
-            *aTemplate = mEmptyTemplate;
+            matchTemplate = mEmptyTemplate;
         }
     }
 
-    return NS_OK;
+    return matchTemplate;
 }
 
 txDecimalFormat*
 txStylesheet::getDecimalFormat(const txExpandedName& aName)
 {
     return mDecimalFormats.get(aName);
 }
 
@@ -219,63 +214,47 @@ txStylesheet::getGlobalVariable(const tx
 }
 
 const txOwningExpandedNameMap<txXSLKey>&
 txStylesheet::getKeyMap()
 {
     return mKeys;
 }
 
-nsresult
-txStylesheet::isStripSpaceAllowed(const txXPathNode& aNode,
-                                  txIMatchContext* aContext, bool& aAllowed)
+bool
+txStylesheet::isStripSpaceAllowed(const txXPathNode& aNode, txIMatchContext* aContext)
 {
     int32_t frameCount = mStripSpaceTests.Length();
     if (frameCount == 0) {
-        aAllowed = false;
-
-        return NS_OK;
+        return false;
     }
 
     txXPathTreeWalker walker(aNode);
 
     if (txXPathNodeUtils::isText(walker.getCurrentPosition()) &&
         (!txXPathNodeUtils::isWhitespace(aNode) || !walker.moveToParent())) {
-        aAllowed = false;
-
-        return NS_OK;
+        return false;
     }
 
     const txXPathNode& node = walker.getCurrentPosition();
 
     if (!txXPathNodeUtils::isElement(node)) {
-        aAllowed = false;
-
-        return NS_OK;
+        return false;
     }
 
     // check Whitespace stipping handling list against given Node
     int32_t i;
     for (i = 0; i < frameCount; ++i) {
         txStripSpaceTest* sst = mStripSpaceTests[i];
-        bool matched;
-        nsresult rv = sst->matches(node, aContext, matched);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        if (matched) {
-            aAllowed = sst->stripsSpace() &&
-                       !XMLUtils::getXMLSpacePreserve(node);
-
-            return NS_OK;
+        if (sst->matches(node, aContext)) {
+            return sst->stripsSpace() && !XMLUtils::getXMLSpacePreserve(node);
         }
     }
 
-    aAllowed = false;
-
-    return NS_OK;
+    return false;
 }
 
 nsresult
 txStylesheet::doneCompiling()
 {
     nsresult rv = NS_OK;
     // Collect all importframes into a single ordered list
     txListIterator frameIter(&mImportFrames);
--- a/dom/xslt/xslt/txStylesheet.h
+++ b/dom/xslt/xslt/txStylesheet.h
@@ -30,31 +30,29 @@ public:
     // To be able to do some cleaning up in destructor
     friend class ImportFrame;
 
     txStylesheet();
     nsresult init();
     
     NS_INLINE_DECL_REFCOUNTING(txStylesheet)
 
-    nsresult findTemplate(const txXPathNode& aNode,
-                          const txExpandedName& aMode,
-                          txIMatchContext* aContext,
-                          ImportFrame* aImportedBy,
-                          txInstruction** aTemplate,
-                          ImportFrame** aImportFrame);
+    txInstruction* findTemplate(const txXPathNode& aNode,
+                                const txExpandedName& aMode,
+                                txIMatchContext* aContext,
+                                ImportFrame* aImportedBy,
+                                ImportFrame** aImportFrame);
     txDecimalFormat* getDecimalFormat(const txExpandedName& aName);
     txInstruction* getAttributeSet(const txExpandedName& aName);
     txInstruction* getNamedTemplate(const txExpandedName& aName);
     txOutputFormat* getOutputFormat();
     GlobalVariable* getGlobalVariable(const txExpandedName& aName);
     const txOwningExpandedNameMap<txXSLKey>& getKeyMap();
-    nsresult isStripSpaceAllowed(const txXPathNode& aNode,
-                                 txIMatchContext* aContext,
-                                 bool& aAllowed);
+    bool isStripSpaceAllowed(const txXPathNode& aNode,
+                               txIMatchContext* aContext);
 
     /**
      * Called by the stylesheet compiler once all stylesheets has been read.
      */
     nsresult doneCompiling();
 
     /**
      * Add a key to the stylesheet
@@ -163,20 +161,18 @@ class txStripSpaceTest {
 public:
     txStripSpaceTest(nsIAtom* aPrefix, nsIAtom* aLocalName, int32_t aNSID,
                      bool stripSpace)
         : mNameTest(aPrefix, aLocalName, aNSID, txXPathNodeType::ELEMENT_NODE),
           mStrips(stripSpace)
     {
     }
 
-    nsresult matches(const txXPathNode& aNode, txIMatchContext* aContext,
-                     bool& aMatched)
-    {
-        return mNameTest.matches(aNode, aContext, aMatched);
+    bool matches(const txXPathNode& aNode, txIMatchContext* aContext) {
+        return mNameTest.matches(aNode, aContext);
     }
 
     bool stripsSpace() {
         return mStrips;
     }
 
     double getDefaultPriority() {
         return mNameTest.getDefaultPriority();
--- a/dom/xslt/xslt/txXSLTNumber.cpp
+++ b/dom/xslt/xslt/txXSLTNumber.cpp
@@ -103,22 +103,23 @@ txXSLTNumber::getValueList(Expr* aValueE
         aValues.add(NS_INT32_TO_PTR((int32_t)floor(value + 0.5)));
         return NS_OK;
     }
 
 
     // Otherwise use count/from/level
 
     txPattern* countPattern = aCountPattern;
-    nsAutoPtr<txPattern> newCountPattern;
+    bool ownsCountPattern = false;
     const txXPathNode& currNode = aContext->getContextNode();
 
     // Parse count- and from-attributes
 
     if (!aCountPattern) {
+        ownsCountPattern = true;
         txNodeTest* nodeTest;
         uint16_t nodeType = txXPathNodeUtils::getNodeType(currNode);
         switch (nodeType) {
             case txXPathNodeType::ELEMENT_NODE:
             {
                 nsCOMPtr<nsIAtom> localName =
                     txXPathNodeUtils::getLocalName(currNode);
                 int32_t namespaceID = txXPathNodeUtils::getNamespaceID(currNode);
@@ -154,102 +155,71 @@ txXSLTNumber::getValueList(Expr* aValueE
                 // this won't match anything as we walk up the tree
                 // but it's what the spec says to do
                 nodeTest = new txNameTest(0, nsGkAtoms::_asterisk, 0,
                                           nodeType);
                 break;
             }
         }
         MOZ_ASSERT(nodeTest);
-        countPattern = newCountPattern = new txStepPattern(nodeTest, false);
+        countPattern = new txStepPattern(nodeTest, false);
     }
 
 
     // Generate list of values depending on the value of the level-attribute
 
     // level = "single"
     if (aLevel == eLevelSingle) {
         txXPathTreeWalker walker(currNode);
         do {
-            if (aFromPattern && !walker.isOnNode(currNode)) {
-                bool matched;
-                rv = aFromPattern->matches(walker.getCurrentPosition(),
-                                           aContext, matched);
-                NS_ENSURE_SUCCESS(rv, rv);
-
-                if (matched) {
-                    break;
-                }
+            if (aFromPattern && !walker.isOnNode(currNode) &&
+                aFromPattern->matches(walker.getCurrentPosition(), aContext)) {
+                break;
             }
 
-            bool matched;
-            rv = countPattern->matches(walker.getCurrentPosition(), aContext,
-                                       matched);
-            NS_ENSURE_SUCCESS(rv, rv);
-
-            if (matched) {
-                int32_t count;
-                rv = getSiblingCount(walker, countPattern, aContext, &count);
-                NS_ENSURE_SUCCESS(rv, rv);
-
-                aValues.add(NS_INT32_TO_PTR(count));
+            if (countPattern->matches(walker.getCurrentPosition(), aContext)) {
+                aValues.add(NS_INT32_TO_PTR(getSiblingCount(walker, countPattern,
+                                                            aContext)));
                 break;
             }
 
         } while (walker.moveToParent());
 
         // Spec says to only match ancestors that are decendants of the
         // ancestor that matches the from-pattern, so keep going to make
         // sure that there is an ancestor that does.
         if (aFromPattern && aValues.getLength()) {
             bool hasParent;
             while ((hasParent = walker.moveToParent())) {
-                bool matched;
-                rv = aFromPattern->matches(walker.getCurrentPosition(),
-                                           aContext, matched);
-                NS_ENSURE_SUCCESS(rv, rv);
-
-                if (matched) {
+                if (aFromPattern->matches(walker.getCurrentPosition(), aContext)) {
                     break;
                 }
             }
 
             if (!hasParent) {
                 aValues.clear();
             }
         }
     }
     // level = "multiple"
     else if (aLevel == eLevelMultiple) {
         // find all ancestor-or-selfs that matches count until...
         txXPathTreeWalker walker(currNode);
         bool matchedFrom = false;
         do {
-            if (aFromPattern && !walker.isOnNode(currNode)) {
-                rv = aFromPattern->matches(walker.getCurrentPosition(),
-                                           aContext, matchedFrom);
-                NS_ENSURE_SUCCESS(rv, rv);
-
-                if (matchedFrom) {
-                    //... we find one that matches from
-                    break;
-                }
+            if (aFromPattern && !walker.isOnNode(currNode) &&
+                aFromPattern->matches(walker.getCurrentPosition(), aContext)) {
+                //... we find one that matches from
+                matchedFrom = true;
+                break;
             }
 
-            bool matched;
-            rv = countPattern->matches(walker.getCurrentPosition(), aContext,
-                                       matched);
-            NS_ENSURE_SUCCESS(rv, rv);
-
-            if (matched) {
-                int32_t count;
-                rv = getSiblingCount(walker, countPattern, aContext, &count);
-                NS_ENSURE_SUCCESS(rv, rv);
-
-                aValues.add(NS_INT32_TO_PTR(count));
+            if (countPattern->matches(walker.getCurrentPosition(), aContext)) {
+                aValues.add(NS_INT32_TO_PTR(getSiblingCount(walker, countPattern,
+                                                            aContext)));
             }
         } while (walker.moveToParent());
 
         // Spec says to only match ancestors that are decendants of the
         // ancestor that matches the from-pattern, so if none did then
         // we shouldn't search anything
         if (aFromPattern && !matchedFrom) {
             aValues.clear();
@@ -257,32 +227,23 @@ txXSLTNumber::getValueList(Expr* aValueE
     }
     // level = "any"
     else if (aLevel == eLevelAny) {
         int32_t value = 0;
         bool matchedFrom = false;
 
         txXPathTreeWalker walker(currNode);
         do {
-            if (aFromPattern && !walker.isOnNode(currNode)) {
-                rv = aFromPattern->matches(walker.getCurrentPosition(),
-                                           aContext, matchedFrom);
-                NS_ENSURE_SUCCESS(rv, rv);
-
-                if (matchedFrom) {
-                    break;
-                }
+            if (aFromPattern && !walker.isOnNode(currNode) &&
+                aFromPattern->matches(walker.getCurrentPosition(), aContext)) {
+                matchedFrom = true;
+                break;
             }
 
-            bool matched;
-            rv = countPattern->matches(walker.getCurrentPosition(), aContext,
-                                       matched);
-            NS_ENSURE_SUCCESS(rv, rv);
-
-            if (matched) {
+            if (countPattern->matches(walker.getCurrentPosition(), aContext)) {
                 ++value;
             }
 
         } while (getPrevInDocumentOrder(walker));
 
         // Spec says to only count nodes that follows the first node that
         // matches the from pattern. So so if none did then we shouldn't
         // count any
@@ -290,16 +251,20 @@ txXSLTNumber::getValueList(Expr* aValueE
             value = 0;
         }
 
         if (value) {
             aValues.add(NS_INT32_TO_PTR(value));
         }
     }
 
+    if (ownsCountPattern) {
+        delete countPattern;
+    }
+    
     return NS_OK;
 }
 
 
 nsresult
 txXSLTNumber::getCounters(Expr* aGroupSize, Expr* aGroupSeparator,
                           Expr* aFormat, txIEvalContext* aContext,
                           txList& aCounters, nsAString& aHead,
@@ -418,37 +383,28 @@ txXSLTNumber::getCounters(Expr* aGroupSi
             aCounters.clear();
             return rv;
         }
     }
     
     return NS_OK;
 }
 
-nsresult
+int32_t
 txXSLTNumber::getSiblingCount(txXPathTreeWalker& aWalker,
                               txPattern* aCountPattern,
-                              txIMatchContext* aContext,
-                              int32_t* aCount)
+                              txIMatchContext* aContext)
 {
     int32_t value = 1;
     while (aWalker.moveToPreviousSibling()) {
-        bool matched;
-        nsresult rv = aCountPattern->matches(aWalker.getCurrentPosition(),
-                                             aContext, matched);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        if (matched) {
+        if (aCountPattern->matches(aWalker.getCurrentPosition(), aContext)) {
             ++value;
         }
     }
-
-    *aCount = value;
-
-    return NS_OK;
+    return value;
 }
 
 bool
 txXSLTNumber::getPrevInDocumentOrder(txXPathTreeWalker& aWalker)
 {
     if (aWalker.moveToPreviousSibling()) {
         while (aWalker.moveToLastChild()) {
             // do nothing
--- a/dom/xslt/xslt/txXSLTNumber.h
+++ b/dom/xslt/xslt/txXSLTNumber.h
@@ -41,20 +41,19 @@ private:
                                 txList& aCounters, nsAString& aHead,
                                 nsAString& aTail);
 
     /**
      * getSiblingCount uses aWalker to walk the siblings of aWalker's current
      * position.
      *
      */
-    static nsresult getSiblingCount(txXPathTreeWalker& aWalker,
-                                    txPattern* aCountPattern,
-                                    txIMatchContext* aContext,
-                                    int32_t* aCount);
+    static int32_t getSiblingCount(txXPathTreeWalker& aWalker,
+                                   txPattern* aCountPattern,
+                                   txIMatchContext* aContext);
     
     static bool getPrevInDocumentOrder(txXPathTreeWalker& aWalker);
 
     static bool isAlphaNumeric(char16_t ch);
 };
 
 class txFormattedCounter {
 public:
--- a/dom/xslt/xslt/txXSLTPatterns.cpp
+++ b/dom/xslt/xslt/txXSLTPatterns.cpp
@@ -27,35 +27,25 @@ double txUnionPattern::getDefaultPriorit
 }
 
 /*
  * Determines whether this Pattern matches the given node within
  * the given context
  * This should be called on the simple patterns for xsl:template,
  * but is fine for xsl:key and xsl:number
  */
-nsresult
-txUnionPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext,
-                        bool& aMatched)
+bool txUnionPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
 {
     uint32_t i, len = mLocPathPatterns.Length();
     for (i = 0; i < len; ++i) {
-        nsresult rv = mLocPathPatterns[i]->matches(aNode, aContext, aMatched);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        if (aMatched) {
-            aMatched = true;
-
-            return NS_OK;
+        if (mLocPathPatterns[i]->matches(aNode, aContext)) {
+            return true;
         }
     }
-
-    aMatched = false;
-
-    return NS_OK;
+    return false;
 }
 
 txPattern::Type
 txUnionPattern::getType()
 {
   return UNION_PATTERN;
 }
 
@@ -108,19 +98,17 @@ nsresult txLocPathPattern::addStep(txPat
         return NS_ERROR_OUT_OF_MEMORY;
 
     step->pattern = aPattern;
     step->isChild = isChild;
 
     return NS_OK;
 }
 
-nsresult
-txLocPathPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext,
-                          bool& aMatched)
+bool txLocPathPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
 {
     NS_ASSERTION(mSteps.Length() > 1, "Internal error");
 
     /*
      * The idea is to split up a path into blocks separated by descendant
      * operators. For example "foo/bar//baz/bop//ying/yang" is split up into
      * three blocks. The "ying/yang" block is handled by the first while-loop
      * and the "foo/bar" and "baz/bop" blocks are handled by the second
@@ -128,90 +116,60 @@ txLocPathPattern::matches(const txXPathN
      * A block is considered matched when we find a list of ancestors that
      * match the block. If there are more than one list of ancestors that
      * match a block we only need to find the one furthermost down in the
      * tree.
      */
 
     uint32_t pos = mSteps.Length();
     Step* step = &mSteps[--pos];
-    nsresult rv = step->pattern->matches(aNode, aContext, aMatched);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (!aMatched) {
-        return NS_OK;
-    }
+    if (!step->pattern->matches(aNode, aContext))
+        return false;
 
     txXPathTreeWalker walker(aNode);
     bool hasParent = walker.moveToParent();
 
     while (step->isChild) {
-        if (!pos) {
-            aMatched = true;
-
-            return NS_OK; // all steps matched
-        }
-
-        if (!hasParent) {
-            // no more ancestors
-            aMatched = false;
-
-            return NS_OK;
-        }
-
+        if (!pos)
+            return true; // all steps matched
         step = &mSteps[--pos];
-        rv = step->pattern->matches(walker.getCurrentPosition(), aContext,
-                                    aMatched);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        if (!aMatched) {
-            // no match
-            return NS_OK;
-        }
+        if (!hasParent || !step->pattern->matches(walker.getCurrentPosition(), aContext))
+            return false; // no more ancestors or no match
 
         hasParent = walker.moveToParent();
     }
 
     // We have at least one // path separator
     txXPathTreeWalker blockWalker(walker);
     uint32_t blockPos = pos;
 
     while (pos) {
-        if (!hasParent) {
-            aMatched = false; // There are more steps in the current block
-                              // than ancestors of the tested node
-            return NS_OK;
-        }
+        if (!hasParent)
+            return false; // There are more steps in the current block 
+                             // than ancestors of the tested node
 
         step = &mSteps[--pos];
-        bool matched;
-        rv = step->pattern->matches(walker.getCurrentPosition(), aContext,
-                                    matched);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        if (!matched) {
+        if (!step->pattern->matches(walker.getCurrentPosition(), aContext)) {
             // Didn't match. We restart at beginning of block using a new
             // start node
             pos = blockPos;
             hasParent = blockWalker.moveToParent();
             walker.moveTo(blockWalker);
         }
         else {
             hasParent = walker.moveToParent();
             if (!step->isChild) {
                 // We've matched an entire block. Set new start pos and start node
                 blockPos = pos;
                 blockWalker.moveTo(walker);
             }
         }
     }
 
-    aMatched = true;
-
-    return NS_OK;
+    return true;
 } // txLocPathPattern::matches
 
 double txLocPathPattern::getDefaultPriority()
 {
     NS_ASSERTION(mSteps.Length() > 1, "Internal error");
 
     return 0.5;
 }
@@ -255,23 +213,19 @@ txLocPathPattern::toString(nsAString& aD
 #endif
 
 /*
  * txRootPattern
  *
  * a txPattern matching the document node, or '/'
  */
 
-nsresult
-txRootPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext,
-                       bool& aMatched)
+bool txRootPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
 {
-    aMatched = txXPathNodeUtils::isRoot(aNode);
-
-    return NS_OK;
+    return txXPathNodeUtils::isRoot(aNode);
 }
 
 double txRootPattern::getDefaultPriority()
 {
     return 0.5;
 }
 
 TX_IMPL_PATTERN_STUBS_NO_SUB_EXPR(txRootPattern)
@@ -305,34 +259,28 @@ txIdPattern::txIdPattern(const nsSubstri
     nsWhitespaceTokenizer tokenizer(aString);
     while (tokenizer.hasMoreTokens()) {
         // this can fail, XXX move to a Init(aString) method
         nsCOMPtr<nsIAtom> atom = NS_Atomize(tokenizer.nextToken());
         mIds.AppendObject(atom);
     }
 }
 
-nsresult
-txIdPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext,
-                     bool& aMatched)
+bool txIdPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
 {
     if (!txXPathNodeUtils::isElement(aNode)) {
-        aMatched = false;
-
-        return NS_OK;
+        return false;
     }
 
     // Get a ID attribute, if there is
     nsIContent* content = txXPathNativeNode::getContent(aNode);
     NS_ASSERTION(content, "a Element without nsIContent");
 
     nsIAtom* id = content->GetID();
-    aMatched = id && mIds.IndexOf(id) > -1;
-
-    return NS_OK;
+    return id && mIds.IndexOf(id) > -1;
 }
 
 double txIdPattern::getDefaultPriority()
 {
     return 0.5;
 }
 
 TX_IMPL_PATTERN_STUBS_NO_SUB_EXPR(txIdPattern)
@@ -367,32 +315,28 @@ txIdPattern::toString(nsAString& aDest)
  * txKeyPattern
  *
  * txKeyPattern matches if the given node is in the evalation of 
  * the key() function
  * This resembles the key() function, but may only have LITERALs as
  * argument.
  */
 
-nsresult
-txKeyPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext,
-                      bool& aMatched)
+bool txKeyPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
 {
     txExecutionState* es = (txExecutionState*)aContext->getPrivateContext();
     nsAutoPtr<txXPathNode> contextDoc(txXPathNodeUtils::getOwnerDocument(aNode));
-    NS_ENSURE_TRUE(contextDoc, NS_ERROR_FAILURE);
+    NS_ENSURE_TRUE(contextDoc, false);
 
     RefPtr<txNodeSet> nodes;
     nsresult rv = es->getKeyNodes(mName, *contextDoc, mValue, true,
                                   getter_AddRefs(nodes));
-    NS_ENSURE_SUCCESS(rv, rv);
+    NS_ENSURE_SUCCESS(rv, false);
 
-    aMatched = nodes->contains(aNode);
-
-    return NS_OK;
+    return nodes->contains(aNode);
 }
 
 double txKeyPattern::getDefaultPriority()
 {
     return 0.5;
 }
 
 TX_IMPL_PATTERN_STUBS_NO_SUB_EXPR(txKeyPattern)
@@ -424,42 +368,31 @@ txKeyPattern::toString(nsAString& aDest)
 #endif
 
 /*
  * txStepPattern
  *
  * a txPattern to hold the NodeTest and the Predicates of a StepPattern
  */
 
-nsresult
-txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext,
-                       bool& aMatched)
+bool txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
 {
     NS_ASSERTION(mNodeTest, "Internal error");
 
-    nsresult rv = mNodeTest->matches(aNode, aContext, aMatched);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (!aMatched) {
-        return NS_OK;
-    }
+    if (!mNodeTest->matches(aNode, aContext))
+        return false;
 
     txXPathTreeWalker walker(aNode);
     if ((!mIsAttr &&
          txXPathNodeUtils::isAttribute(walker.getCurrentPosition())) ||
         !walker.moveToParent()) {
-        aMatched = false;
-
-        return NS_OK;
+        return false;
     }
-
     if (isEmpty()) {
-        aMatched = true;
-
-        return NS_OK;
+        return true;
     }
 
     /*
      * Evaluate Predicates
      *
      * Copy all siblings/attributes matching mNodeTest to nodes
      * Up to the last Predicate do
      *  Foreach node in nodes
@@ -472,48 +405,44 @@ txStepPattern::matches(const txXPathNode
      *
      * For the last Predicate, evaluate Predicate with aNode as
      *  context node, if the result is a number, check the position,
      *  otherwise return the result converted to boolean
      */
 
     // Create the context node set for evaluating the predicates
     RefPtr<txNodeSet> nodes;
-    rv = aContext->recycler()->getNodeSet(getter_AddRefs(nodes));
-    NS_ENSURE_SUCCESS(rv, rv);
+    nsresult rv = aContext->recycler()->getNodeSet(getter_AddRefs(nodes));
+    NS_ENSURE_SUCCESS(rv, false);
 
     bool hasNext = mIsAttr ? walker.moveToFirstAttribute() :
                                walker.moveToFirstChild();
     while (hasNext) {
-        bool matched;
-        rv = mNodeTest->matches(walker.getCurrentPosition(), aContext, matched);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        if (matched) {
+        if (mNodeTest->matches(walker.getCurrentPosition(), aContext)) {
             nodes->append(walker.getCurrentPosition());
         }
         hasNext = mIsAttr ? walker.moveToNextAttribute() :
                             walker.moveToNextSibling();
     }
 
     Expr* predicate = mPredicates[0];
     RefPtr<txNodeSet> newNodes;
     rv = aContext->recycler()->getNodeSet(getter_AddRefs(newNodes));
-    NS_ENSURE_SUCCESS(rv, rv);
+    NS_ENSURE_SUCCESS(rv, false);
 
     uint32_t i, predLen = mPredicates.Length();
     for (i = 1; i < predLen; ++i) {
         newNodes->clear();
         bool contextIsInPredicate = false;
         txNodeSetContext predContext(nodes, aContext);
         while (predContext.hasNext()) {
             predContext.next();
             RefPtr<txAExprResult> exprResult;
             rv = predicate->evaluate(&predContext, getter_AddRefs(exprResult));
-            NS_ENSURE_SUCCESS(rv, rv);
+            NS_ENSURE_SUCCESS(rv, false);
 
             switch(exprResult->getResultType()) {
                 case txAExprResult::NUMBER:
                     // handle default, [position() == numberValue()]
                     if ((double)predContext.position() ==
                         exprResult->numberValue()) {
                         const txXPathNode& tmp = predContext.getContextNode();
                         if (tmp == aNode)
@@ -530,35 +459,30 @@ txStepPattern::matches(const txXPathNode
                     }
                     break;
             }
         }
         // Move new NodeSet to the current one
         nodes->clear();
         nodes->append(*newNodes);
         if (!contextIsInPredicate) {
-            aMatched = false;
-
-            return NS_OK;
+            return false;
         }
         predicate = mPredicates[i];
     }
     txForwardContext evalContext(aContext, aNode, nodes);
     RefPtr<txAExprResult> exprResult;
     rv = predicate->evaluate(&evalContext, getter_AddRefs(exprResult));
-    NS_ENSURE_SUCCESS(rv, rv);
+    NS_ENSURE_SUCCESS(rv, false);
 
-    if (exprResult->getResultType() == txAExprResult::NUMBER) {
+    if (exprResult->getResultType() == txAExprResult::NUMBER)
         // handle default, [position() == numberValue()]
-        aMatched = ((double)evalContext.position() == exprResult->numberValue());
-    } else {
-        aMatched = exprResult->booleanValue();
-    }
+        return ((double)evalContext.position() == exprResult->numberValue());
 
-    return NS_OK;
+    return exprResult->booleanValue();
 } // matches
 
 double txStepPattern::getDefaultPriority()
 {
     if (isEmpty())
         return mNodeTest->getDefaultPriority();
     return 0.5;
 }
--- a/dom/xslt/xslt/txXSLTPatterns.h
+++ b/dom/xslt/xslt/txXSLTPatterns.h
@@ -21,19 +21,18 @@ public:
     virtual ~txPattern()
     {
         MOZ_COUNT_DTOR(txPattern);
     }
 
     /*
      * Determines whether this Pattern matches the given node.
      */
-    virtual nsresult matches(const txXPathNode& aNode,
-                             txIMatchContext* aContext,
-                             bool& aMatched) = 0;
+    virtual bool matches(const txXPathNode& aNode,
+                          txIMatchContext* aContext) = 0;
 
     /*
      * Returns the default priority of this Pattern.
      *
      * Simple Patterns return the values as specified in XPath 5.5.
      * Returns -Inf for union patterns, as it shouldn't be called on them.
      */
     virtual double getDefaultPriority() = 0;
@@ -82,18 +81,17 @@ public:
      * other #toString() methods for Patterns.
      * @return the String representation of this Pattern.
      */
     virtual void toString(nsAString& aDest) = 0;
 #endif
 };
 
 #define TX_DECL_PATTERN_BASE \
-    nsresult matches(const txXPathNode& aNode, txIMatchContext* aContext, \
-                     bool& aMatched) override; \
+    bool matches(const txXPathNode& aNode, txIMatchContext* aContext) override; \
     double getDefaultPriority() override; \
     virtual Expr* getSubExprAt(uint32_t aPos) override; \
     virtual void setSubExprAt(uint32_t aPos, Expr* aExpr) override; \
     virtual txPattern* getSubPatternAt(uint32_t aPos) override; \
     virtual void setSubPatternAt(uint32_t aPos, txPattern* aPattern) override
 
 #ifndef TX_TO_STRING
 #define TX_DECL_PATTERN TX_DECL_PATTERN_BASE