Bug 1729329 - Mark txUnionNodeTest::addNodeTest as infallible. r=farre

Differential Revision: https://phabricator.services.mozilla.com/D124665
This commit is contained in:
Peter Van der Beken 2021-10-22 15:00:36 +00:00
Родитель 089504dc85
Коммит 750cd9da88
2 изменённых файлов: 3 добавлений и 7 удалений

Просмотреть файл

@ -817,9 +817,8 @@ class txNamedAttributeStep : public Expr {
*/
class txUnionNodeTest : public txNodeTest {
public:
nsresult addNodeTest(txNodeTest* aNodeTest) {
void addNodeTest(txNodeTest* aNodeTest) {
mNodeTests.AppendElement(aNodeTest);
return NS_OK;
}
TX_DECL_NODE_TEST

Просмотреть файл

@ -191,7 +191,6 @@ nsresult txXPathOptimizer::optimizeUnion(Expr* aInExpr, Expr** aOutExpr) {
// Check for expressions like "foo | bar" and
// "descendant::foo | descendant::bar"
nsresult rv;
uint32_t current;
Expr* subExpr;
for (current = 0; (subExpr = uni->getSubExprAt(current)); ++current) {
@ -222,16 +221,14 @@ nsresult txXPathOptimizer::optimizeUnion(Expr* aInExpr, Expr** aOutExpr) {
// Create a txUnionNodeTest if needed
if (!unionTest) {
UniquePtr<txNodeTest> owner(unionTest = new txUnionNodeTest);
rv = unionTest->addNodeTest(currentStep->getNodeTest());
NS_ENSURE_SUCCESS(rv, rv);
unionTest->addNodeTest(currentStep->getNodeTest());
currentStep->setNodeTest(unionTest);
Unused << owner.release();
}
// Merge the nodetest into the union
rv = unionTest->addNodeTest(step->getNodeTest());
NS_ENSURE_SUCCESS(rv, rv);
unionTest->addNodeTest(step->getNodeTest());
step->setNodeTest(nullptr);