From c284b3bba6b2958edc3f42eaedf7bb53df50e12d Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Mon, 27 Apr 2020 09:18:33 +0000 Subject: [PATCH] Bug 1632613 - Part 4b: Swap out nsAutoPtr type for UniquePtr. r=peterv This is essentially: ``` find dom/xslt -type f -n '*.h' | xargs sed -i -e 's/nsAutoPtr oldValue; + mozilla::UniquePtr oldValue; return setItem(aKey, (void*)aValue, getter_Transfers(oldValue)); } diff --git a/dom/xslt/xpath/XPathEvaluator.cpp b/dom/xslt/xpath/XPathEvaluator.cpp index b4891396b533..3709b9bc497a 100644 --- a/dom/xslt/xpath/XPathEvaluator.cpp +++ b/dom/xslt/xpath/XPathEvaluator.cpp @@ -88,7 +88,7 @@ XPathExpression* XPathEvaluator::CreateExpression(const nsAString& aExpression, mRecycler = new txResultRecycler; } - nsAutoPtr expression; + UniquePtr expression; aRv = txExprParser::createExpr(PromiseFlatString(aExpression), aContext, getter_Transfers(expression)); if (aRv.Failed()) { @@ -118,7 +118,7 @@ already_AddRefed XPathEvaluator::Evaluate( JSContext* aCx, const nsAString& aExpression, nsINode& aContextNode, XPathNSResolver* aResolver, uint16_t aType, JS::Handle aResult, ErrorResult& rv) { - nsAutoPtr expression( + UniquePtr expression( CreateExpression(aExpression, aResolver, rv)); if (rv.Failed()) { return nullptr; diff --git a/dom/xslt/xpath/XPathExpression.cpp b/dom/xslt/xpath/XPathExpression.cpp index c48265e865f1..89b6616d4435 100644 --- a/dom/xslt/xpath/XPathExpression.cpp +++ b/dom/xslt/xpath/XPathExpression.cpp @@ -44,7 +44,7 @@ class EvalContextImpl : public txIEvalContext { RefPtr mRecycler; }; -XPathExpression::XPathExpression(nsAutoPtr&& aExpression, +XPathExpression::XPathExpression(UniquePtr&& aExpression, txResultRecycler* aRecycler, Document* aDocument) : mExpression(std::move(aExpression)), @@ -122,7 +122,7 @@ already_AddRefed XPathExpression::EvaluateWithContext( return nullptr; } - nsAutoPtr contextNode( + UniquePtr contextNode( txXPathNativeNode::createXPathNode(&aContextNode)); if (!contextNode) { aRv.Throw(NS_ERROR_FAILURE); diff --git a/dom/xslt/xpath/XPathExpression.h b/dom/xslt/xpath/XPathExpression.h index e2f55c8b1276..bebd300a30eb 100644 --- a/dom/xslt/xpath/XPathExpression.h +++ b/dom/xslt/xpath/XPathExpression.h @@ -29,8 +29,8 @@ class XPathResult; */ class XPathExpression final : public NonRefcountedDOMObject { public: - XPathExpression(nsAutoPtr&& aExpression, txResultRecycler* aRecycler, - Document* aDocument); + XPathExpression(mozilla::UniquePtr&& aExpression, + txResultRecycler* aRecycler, Document* aDocument); ~XPathExpression(); bool WrapObject(JSContext* aCx, JS::Handle aGivenProto, @@ -58,7 +58,7 @@ class XPathExpression final : public NonRefcountedDOMObject { uint16_t aType, XPathResult* aInResult, ErrorResult& aRv); private: - nsAutoPtr mExpression; + mozilla::UniquePtr mExpression; RefPtr mRecycler; nsWeakPtr mDocument; bool mCheckDocument; diff --git a/dom/xslt/xpath/XPathResult.cpp b/dom/xslt/xpath/XPathResult.cpp index 512d0a0d791c..09c5389cc0d9 100644 --- a/dom/xslt/xpath/XPathResult.cpp +++ b/dom/xslt/xpath/XPathResult.cpp @@ -242,7 +242,7 @@ nsresult XPathResult::GetExprResult(txAExprResult** aExprResult) { uint32_t i, count = mResultNodes.Count(); for (i = 0; i < count; ++i) { - nsAutoPtr node( + UniquePtr node( txXPathNativeNode::createXPathNode(mResultNodes[i])); if (!node) { return NS_ERROR_OUT_OF_MEMORY; diff --git a/dom/xslt/xpath/txExpr.h b/dom/xslt/xpath/txExpr.h index 57d773cf2a44..399252314465 100644 --- a/dom/xslt/xpath/txExpr.h +++ b/dom/xslt/xpath/txExpr.h @@ -432,8 +432,8 @@ class txPredicatedNodeTest : public txNodeTest { TX_DECL_NODE_TEST private: - nsAutoPtr mNodeTest; - nsAutoPtr mPredicate; + mozilla::UniquePtr mNodeTest; + mozilla::UniquePtr mPredicate; }; /** @@ -557,7 +557,7 @@ class LocationStep : public Expr, public PredicateList { txIMatchContext* aContext, txNodeSet* aNodes); - nsAutoPtr mNodeTest; + mozilla::UniquePtr mNodeTest; LocationStepType mAxisIdentifier; }; @@ -572,7 +572,7 @@ class FilterExpr : public Expr, public PredicateList { TX_DECL_EXPR private: - nsAutoPtr expr; + mozilla::UniquePtr expr; }; //-- FilterExpr @@ -600,7 +600,7 @@ class UnaryExpr : public Expr { TX_DECL_EXPR private: - nsAutoPtr expr; + mozilla::UniquePtr expr; }; //-- UnaryExpr /** @@ -618,7 +618,7 @@ class BooleanExpr : public Expr { TX_DECL_EXPR private: - nsAutoPtr leftExpr, rightExpr; + mozilla::UniquePtr leftExpr, rightExpr; short op; }; //-- BooleanExpr @@ -640,7 +640,7 @@ class txNumberExpr : public Expr { TX_DECL_EXPR private: - nsAutoPtr mLeftExpr, mRightExpr; + mozilla::UniquePtr mLeftExpr, mRightExpr; eOp mOp; }; //-- MultiplicativeExpr @@ -674,8 +674,8 @@ class RelationalExpr : public Expr { bool compareResults(txIEvalContext* aContext, txAExprResult* aLeft, txAExprResult* aRight); - nsAutoPtr mLeftExpr; - nsAutoPtr mRightExpr; + mozilla::UniquePtr mLeftExpr; + mozilla::UniquePtr mRightExpr; RelationalExprType mOp; }; @@ -736,7 +736,7 @@ class PathExpr : public Expr { private: class PathExprItem { public: - nsAutoPtr expr; + mozilla::UniquePtr expr; PathOperator pathOp; }; diff --git a/dom/xslt/xpath/txExprParser.cpp b/dom/xslt/xpath/txExprParser.cpp index 3b7509765e1b..d5d9ac8c10db 100644 --- a/dom/xslt/xpath/txExprParser.cpp +++ b/dom/xslt/xpath/txExprParser.cpp @@ -31,7 +31,7 @@ nsresult txExprParser::createAVT(const nsAString& aAttrValue, txIParseContext* aContext, Expr** aResult) { *aResult = nullptr; nsresult rv = NS_OK; - nsAutoPtr expr; + UniquePtr expr; FunctionCall* concat = nullptr; nsAutoString literalString; @@ -45,7 +45,7 @@ nsresult txExprParser::createAVT(const nsAString& aAttrValue, // Every iteration through this loop parses either a literal section // or an expression start = iter; - nsAutoPtr newExpr; + UniquePtr newExpr; if (!inExpr) { // Parse literal section literalString.Truncate(); @@ -152,7 +152,7 @@ nsresult txExprParser::createExprInternal(const nsAString& aExpression, aContext->SetErrorOffset(lexer.mPosition - start + aSubStringPos); return rv; } - nsAutoPtr expr; + UniquePtr expr; rv = createExpr(lexer, aContext, getter_Transfers(expr)); if (NS_SUCCEEDED(rv) && lexer.peek()->mType != Token::END) { rv = NS_ERROR_XPATH_BINARY_EXPECTED; @@ -182,8 +182,8 @@ nsresult txExprParser::createExprInternal(const nsAString& aExpression, /** * Creates a binary Expr for the given operator */ -nsresult txExprParser::createBinaryExpr(nsAutoPtr& left, - nsAutoPtr& right, Token* op, +nsresult txExprParser::createBinaryExpr(UniquePtr& left, + UniquePtr& right, Token* op, Expr** aResult) { NS_ASSERTION(op, "internal error"); *aResult = nullptr; @@ -262,7 +262,7 @@ nsresult txExprParser::createExpr(txExprLexer& lexer, txIParseContext* aContext, nsresult rv = NS_OK; bool done = false; - nsAutoPtr expr; + UniquePtr expr; txStack exprs; txStack ops; @@ -299,8 +299,8 @@ nsresult txExprParser::createExpr(txExprLexer& lexer, txIParseContext* aContext, while (!exprs.isEmpty() && tokPrecedence <= precedence(static_cast(ops.peek()))) { // can't use expr as argument due to order of evaluation - nsAutoPtr left(static_cast(exprs.pop())); - nsAutoPtr right(std::move(expr)); + UniquePtr left(static_cast(exprs.pop())); + UniquePtr right(std::move(expr)); rv = createBinaryExpr(left, right, static_cast(ops.pop()), getter_Transfers(expr)); if (NS_FAILED(rv)) { @@ -316,8 +316,8 @@ nsresult txExprParser::createExpr(txExprLexer& lexer, txIParseContext* aContext, } while (NS_SUCCEEDED(rv) && !exprs.isEmpty()) { - nsAutoPtr left(static_cast(exprs.pop())); - nsAutoPtr right(std::move(expr)); + UniquePtr left(static_cast(exprs.pop())); + UniquePtr right(std::move(expr)); rv = createBinaryExpr(left, right, static_cast(ops.pop()), getter_Transfers(expr)); } @@ -339,7 +339,7 @@ nsresult txExprParser::createFilterOrStep(txExprLexer& lexer, nsresult rv = NS_OK; Token* tok = lexer.peek(); - nsAutoPtr expr; + UniquePtr expr; switch (tok->mType) { case Token::FUNCTION_NAME_AND_PAREN: rv = createFunctionCall(lexer, aContext, getter_Transfers(expr)); @@ -380,7 +380,7 @@ nsresult txExprParser::createFilterOrStep(txExprLexer& lexer, } if (lexer.peek()->mType == Token::L_BRACKET) { - nsAutoPtr filterExpr(new FilterExpr(expr.get())); + UniquePtr filterExpr(new FilterExpr(expr.get())); expr.forget(); @@ -399,7 +399,7 @@ nsresult txExprParser::createFunctionCall(txExprLexer& lexer, Expr** aResult) { *aResult = nullptr; - nsAutoPtr fnCall; + UniquePtr fnCall; Token* tok = lexer.nextToken(); NS_ASSERTION(tok->mType == Token::FUNCTION_NAME_AND_PAREN, @@ -454,7 +454,7 @@ nsresult txExprParser::createLocationStep(txExprLexer& lexer, //-- child axis is default LocationStep::LocationStepType axisIdentifier = LocationStep::CHILD_AXIS; - nsAutoPtr nodeTest; + UniquePtr nodeTest; //-- get Axis Identifier or AbbreviatedStep, if present Token* tok = lexer.peek(); @@ -540,7 +540,7 @@ nsresult txExprParser::createLocationStep(txExprLexer& lexer, } } - nsAutoPtr lstep( + UniquePtr lstep( new LocationStep(nodeTest.get(), axisIdentifier)); nodeTest.forget(); @@ -560,7 +560,7 @@ nsresult txExprParser::createLocationStep(txExprLexer& lexer, nsresult txExprParser::createNodeTypeTest(txExprLexer& lexer, txNodeTest** aTest) { *aTest = 0; - nsAutoPtr nodeTest; + UniquePtr nodeTest; Token* nodeTok = lexer.peek(); @@ -610,7 +610,7 @@ nsresult txExprParser::createPathExpr(txExprLexer& lexer, Expr** aResult) { *aResult = nullptr; - nsAutoPtr expr; + UniquePtr expr; Token* tok = lexer.peek(); @@ -644,7 +644,7 @@ nsresult txExprParser::createPathExpr(txExprLexer& lexer, } // We have a PathExpr containing several steps - nsAutoPtr pathExpr(new PathExpr()); + UniquePtr pathExpr(new PathExpr()); rv = pathExpr->addExpr(expr.get(), PathExpr::RELATIVE_OP); NS_ENSURE_SUCCESS(rv, rv); @@ -688,7 +688,7 @@ nsresult txExprParser::createUnionExpr(txExprLexer& lexer, Expr** aResult) { *aResult = nullptr; - nsAutoPtr expr; + UniquePtr expr; nsresult rv = createPathExpr(lexer, aContext, getter_Transfers(expr)); NS_ENSURE_SUCCESS(rv, rv); @@ -697,7 +697,7 @@ nsresult txExprParser::createUnionExpr(txExprLexer& lexer, return NS_OK; } - nsAutoPtr unionExpr(new UnionExpr()); + UniquePtr unionExpr(new UnionExpr()); rv = unionExpr->addExpr(expr.get()); NS_ENSURE_SUCCESS(rv, rv); @@ -741,7 +741,7 @@ bool txExprParser::isLocationStepToken(Token* aToken) { nsresult txExprParser::parsePredicates(PredicateList* aPredicateList, txExprLexer& lexer, txIParseContext* aContext) { - nsAutoPtr expr; + UniquePtr expr; nsresult rv = NS_OK; while (lexer.peek()->mType == Token::L_BRACKET) { //-- eat Token @@ -779,7 +779,7 @@ nsresult txExprParser::parseParameters(FunctionCall* aFnCall, return NS_OK; } - nsAutoPtr expr; + UniquePtr expr; nsresult rv = NS_OK; while (1) { rv = createExpr(lexer, aContext, getter_Transfers(expr)); diff --git a/dom/xslt/xpath/txExprParser.h b/dom/xslt/xpath/txExprParser.h index a8f843e3bfab..06c07cf2329b 100644 --- a/dom/xslt/xpath/txExprParser.h +++ b/dom/xslt/xpath/txExprParser.h @@ -47,8 +47,8 @@ class txExprParser { * Using nsAutoPtr& to optimize passing the ownership to the * created binary expression objects. */ - static nsresult createBinaryExpr(nsAutoPtr& left, - nsAutoPtr& right, Token* op, + static nsresult createBinaryExpr(mozilla::UniquePtr& left, + mozilla::UniquePtr& right, Token* op, Expr** aResult); static nsresult createExpr(txExprLexer& lexer, txIParseContext* aContext, Expr** aResult); diff --git a/dom/xslt/xpath/txXPathOptimizer.cpp b/dom/xslt/xpath/txXPathOptimizer.cpp index b70ccae80609..6d209c2c7562 100644 --- a/dom/xslt/xpath/txXPathOptimizer.cpp +++ b/dom/xslt/xpath/txXPathOptimizer.cpp @@ -218,7 +218,7 @@ nsresult txXPathOptimizer::optimizeUnion(Expr* aInExpr, Expr** aOutExpr) { // Create a txUnionNodeTest if needed if (!unionTest) { - nsAutoPtr owner(unionTest = new txUnionNodeTest); + UniquePtr owner(unionTest = new txUnionNodeTest); rv = unionTest->addNodeTest(currentStep->getNodeTest()); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/xslt/xslt/txBufferingHandler.h b/dom/xslt/xslt/txBufferingHandler.h index e8a74ed9b874..5fc41f312c1b 100644 --- a/dom/xslt/xslt/txBufferingHandler.h +++ b/dom/xslt/xslt/txBufferingHandler.h @@ -38,7 +38,7 @@ class txBufferingHandler : public txAXMLEventHandler { TX_DECL_TXAXMLEVENTHANDLER protected: - nsAutoPtr mBuffer; + mozilla::UniquePtr mBuffer; bool mCanAddAttribute; }; diff --git a/dom/xslt/xslt/txEXSLTFunctions.cpp b/dom/xslt/xslt/txEXSLTFunctions.cpp index 06612ca85fd5..8a78d829efb7 100644 --- a/dom/xslt/xslt/txEXSLTFunctions.cpp +++ b/dom/xslt/xslt/txEXSLTFunctions.cpp @@ -122,7 +122,7 @@ static nsresult createAndAddToResult(nsAtom* aName, const nsAString& aValue, rv = aResultHolder->AppendChildTo(elem, false); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr xpathNode( + UniquePtr xpathNode( txXPathNativeNode::createXPathNode(elem, true)); NS_ENSURE_TRUE(xpathNode, NS_ERROR_OUT_OF_MEMORY); @@ -258,7 +258,7 @@ nsresult txEXSLTFunctionCall::evaluate(txIEvalContext* aContext, nsAutoString value; exprResult->stringValue(value); - nsAutoPtr node; + UniquePtr node; rv = createTextNode(aContext, value, getter_Transfers(node)); NS_ENSURE_SUCCESS(rv, rv); @@ -685,7 +685,7 @@ nsresult txEXSLTRegExFunctionCall::evaluate(txIEvalContext* aContext, rv = aContext->recycler()->getNodeSet(getter_AddRefs(resultSet)); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr node; + UniquePtr node; for (nsIContent* result = docFrag->GetFirstChild(); result; result = result->GetNextSibling()) { node = txXPathNativeNode::createXPathNode(result, true); diff --git a/dom/xslt/xslt/txExecutionState.cpp b/dom/xslt/xslt/txExecutionState.cpp index f3349b4a8e62..05f4b79191b7 100644 --- a/dom/xslt/xslt/txExecutionState.cpp +++ b/dom/xslt/xslt/txExecutionState.cpp @@ -239,7 +239,7 @@ nsresult txExecutionState::getVariable(int32_t aNamespace, nsAtom* aLName, return rv; } } else { - nsAutoPtr rtfHandler(new txRtfHandler); + UniquePtr rtfHandler(new txRtfHandler); rv = pushResultHandler(rtfHandler.get()); if (NS_FAILED(rv)) { diff --git a/dom/xslt/xslt/txExecutionState.h b/dom/xslt/xslt/txExecutionState.h index e64577a051ea..7d91df704e65 100644 --- a/dom/xslt/xslt/txExecutionState.h +++ b/dom/xslt/xslt/txExecutionState.h @@ -44,7 +44,7 @@ class txLoadedDocumentEntry : public nsStringHashKey { return NS_FAILED(mLoadResult); } - nsAutoPtr mDocument; + mozilla::UniquePtr mDocument; nsresult mLoadResult; }; @@ -56,7 +56,7 @@ class txLoadedDocumentsHash : public nsTHashtable { private: friend class txExecutionState; - nsAutoPtr mSourceDocument; + mozilla::UniquePtr mSourceDocument; }; class txExecutionState : public txIMatchContext { @@ -125,7 +125,7 @@ class txExecutionState : public txIMatchContext { txAXMLEventHandler* mOutputHandler; txAXMLEventHandler* mResultHandler; - nsAutoPtr mObsoleteHandler; + mozilla::UniquePtr mObsoleteHandler; txAOutputHandlerFactory* mOutputHandlerFactory; RefPtr mTemplateParams; diff --git a/dom/xslt/xslt/txInstructions.cpp b/dom/xslt/xslt/txInstructions.cpp index 3c2c63ad5c12..9da4252b8bad 100644 --- a/dom/xslt/xslt/txInstructions.cpp +++ b/dom/xslt/xslt/txInstructions.cpp @@ -89,14 +89,14 @@ nsresult txApplyTemplates::execute(txExecutionState& aEs) { return aEs.runTemplate(templ); } -txAttribute::txAttribute(nsAutoPtr&& aName, nsAutoPtr&& aNamespace, +txAttribute::txAttribute(UniquePtr&& aName, UniquePtr&& aNamespace, txNamespaceMap* aMappings) : mName(std::move(aName)), mNamespace(std::move(aNamespace)), mMappings(aMappings) {} nsresult txAttribute::execute(txExecutionState& aEs) { - nsAutoPtr handler( + UniquePtr handler( static_cast(aEs.popResultHandler())); nsAutoString name; @@ -167,7 +167,7 @@ nsresult txCheckParam::execute(txExecutionState& aEs) { return NS_OK; } -txConditionalGoto::txConditionalGoto(nsAutoPtr&& aCondition, +txConditionalGoto::txConditionalGoto(UniquePtr&& aCondition, txInstruction* aTarget) : mCondition(std::move(aCondition)), mTarget(aTarget) {} @@ -184,7 +184,7 @@ nsresult txConditionalGoto::execute(txExecutionState& aEs) { } nsresult txComment::execute(txExecutionState& aEs) { - nsAutoPtr handler( + UniquePtr handler( static_cast(aEs.popResultHandler())); uint32_t length = handler->mValue.Length(); int32_t pos = 0; @@ -321,7 +321,7 @@ nsresult txCopy::execute(txExecutionState& aEs) { return NS_OK; } -txCopyOf::txCopyOf(nsAutoPtr&& aSelect) : mSelect(std::move(aSelect)) {} +txCopyOf::txCopyOf(UniquePtr&& aSelect) : mSelect(std::move(aSelect)) {} nsresult txCopyOf::execute(txExecutionState& aEs) { RefPtr exprRes; @@ -413,7 +413,7 @@ nsresult txLoopNodeSet::execute(txExecutionState& aEs) { } txLREAttribute::txLREAttribute(int32_t aNamespaceID, nsAtom* aLocalName, - nsAtom* aPrefix, nsAutoPtr&& aValue) + nsAtom* aPrefix, UniquePtr&& aValue) : mNamespaceID(aNamespaceID), mLocalName(aLocalName), mPrefix(aPrefix), @@ -443,7 +443,7 @@ nsresult txLREAttribute::execute(txExecutionState& aEs) { txMessage::txMessage(bool aTerminate) : mTerminate(aTerminate) {} nsresult txMessage::execute(txExecutionState& aEs) { - nsAutoPtr handler( + UniquePtr handler( static_cast(aEs.popResultHandler())); nsCOMPtr consoleSvc = @@ -458,10 +458,10 @@ nsresult txMessage::execute(txExecutionState& aEs) { } txNumber::txNumber(txXSLTNumber::LevelType aLevel, - nsAutoPtr&& aCount, nsAutoPtr&& aFrom, - nsAutoPtr&& aValue, nsAutoPtr&& aFormat, - nsAutoPtr&& aGroupingSeparator, - nsAutoPtr&& aGroupingSize) + UniquePtr&& aCount, UniquePtr&& aFrom, + UniquePtr&& aValue, UniquePtr&& aFormat, + UniquePtr&& aGroupingSeparator, + UniquePtr&& aGroupingSize) : mLevel(aLevel), mCount(std::move(aCount)), mFrom(std::move(aFrom)), @@ -486,11 +486,11 @@ nsresult txPopParams::execute(txExecutionState& aEs) { return NS_OK; } -txProcessingInstruction::txProcessingInstruction(nsAutoPtr&& aName) +txProcessingInstruction::txProcessingInstruction(UniquePtr&& aName) : mName(std::move(aName)) {} nsresult txProcessingInstruction::execute(txExecutionState& aEs) { - nsAutoPtr handler( + UniquePtr handler( static_cast(aEs.popResultHandler())); XMLUtils::normalizePIValue(handler->mValue); @@ -509,7 +509,7 @@ nsresult txProcessingInstruction::execute(txExecutionState& aEs) { return aEs.mResultHandler->processingInstruction(name, handler->mValue); } -txPushNewContext::txPushNewContext(nsAutoPtr&& aSelect) +txPushNewContext::txPushNewContext(UniquePtr&& aSelect) : mSelect(std::move(aSelect)), mBailTarget(nullptr) {} txPushNewContext::~txPushNewContext() = default; @@ -561,11 +561,11 @@ nsresult txPushNewContext::execute(txExecutionState& aEs) { return NS_OK; } -nsresult txPushNewContext::addSort(nsAutoPtr&& aSelectExpr, - nsAutoPtr&& aLangExpr, - nsAutoPtr&& aDataTypeExpr, - nsAutoPtr&& aOrderExpr, - nsAutoPtr&& aCaseOrderExpr) { +nsresult txPushNewContext::addSort(UniquePtr&& aSelectExpr, + UniquePtr&& aLangExpr, + UniquePtr&& aDataTypeExpr, + UniquePtr&& aOrderExpr, + UniquePtr&& aCaseOrderExpr) { if (SortKey* key = mSortKeys.AppendElement()) { // workaround for not triggering the Copy Constructor key->mSelectExpr = std::move(aSelectExpr); @@ -629,7 +629,7 @@ nsresult txReturn::execute(txExecutionState& aEs) { return NS_OK; } -txSetParam::txSetParam(const txExpandedName& aName, nsAutoPtr&& aValue) +txSetParam::txSetParam(const txExpandedName& aName, UniquePtr&& aValue) : mName(aName), mValue(std::move(aValue)) {} nsresult txSetParam::execute(txExecutionState& aEs) { @@ -643,7 +643,7 @@ nsresult txSetParam::execute(txExecutionState& aEs) { rv = mValue->evaluate(aEs.getEvalContext(), getter_AddRefs(exprRes)); NS_ENSURE_SUCCESS(rv, rv); } else { - nsAutoPtr rtfHandler( + UniquePtr rtfHandler( static_cast(aEs.popResultHandler())); rv = rtfHandler->getAsRTF(getter_AddRefs(exprRes)); NS_ENSURE_SUCCESS(rv, rv); @@ -656,7 +656,7 @@ nsresult txSetParam::execute(txExecutionState& aEs) { } txSetVariable::txSetVariable(const txExpandedName& aName, - nsAutoPtr&& aValue) + UniquePtr&& aValue) : mName(aName), mValue(std::move(aValue)) {} nsresult txSetVariable::execute(txExecutionState& aEs) { @@ -666,7 +666,7 @@ nsresult txSetVariable::execute(txExecutionState& aEs) { rv = mValue->evaluate(aEs.getEvalContext(), getter_AddRefs(exprRes)); NS_ENSURE_SUCCESS(rv, rv); } else { - nsAutoPtr rtfHandler( + UniquePtr rtfHandler( static_cast(aEs.popResultHandler())); rv = rtfHandler->getAsRTF(getter_AddRefs(exprRes)); NS_ENSURE_SUCCESS(rv, rv); @@ -675,8 +675,8 @@ nsresult txSetVariable::execute(txExecutionState& aEs) { return aEs.bindVariable(mName, exprRes); } -txStartElement::txStartElement(nsAutoPtr&& aName, - nsAutoPtr&& aNamespace, +txStartElement::txStartElement(UniquePtr&& aName, + UniquePtr&& aNamespace, txNamespaceMap* aMappings) : mName(std::move(aName)), mNamespace(std::move(aNamespace)), @@ -761,7 +761,7 @@ nsresult txText::execute(txExecutionState& aEs) { return aEs.mResultHandler->characters(mStr, mDOE); } -txValueOf::txValueOf(nsAutoPtr&& aExpr, bool aDOE) +txValueOf::txValueOf(UniquePtr&& aExpr, bool aDOE) : mExpr(std::move(aExpr)), mDOE(aDOE) {} nsresult txValueOf::execute(txExecutionState& aEs) { diff --git a/dom/xslt/xslt/txInstructions.h b/dom/xslt/xslt/txInstructions.h index 7cff43ffe303..97e655075f85 100644 --- a/dom/xslt/xslt/txInstructions.h +++ b/dom/xslt/xslt/txInstructions.h @@ -27,7 +27,7 @@ class txInstruction : public txObject { virtual nsresult execute(txExecutionState& aEs) = 0; - nsAutoPtr mNext; + mozilla::UniquePtr mNext; }; #define TX_DECL_TXINSTRUCTION \ @@ -59,13 +59,13 @@ class txApplyTemplates : public txInstruction { class txAttribute : public txInstruction { public: - txAttribute(nsAutoPtr&& aName, nsAutoPtr&& aNamespace, - txNamespaceMap* aMappings); + txAttribute(mozilla::UniquePtr&& aName, + mozilla::UniquePtr&& aNamespace, txNamespaceMap* aMappings); TX_DECL_TXINSTRUCTION - nsAutoPtr mName; - nsAutoPtr mNamespace; + mozilla::UniquePtr mName; + mozilla::UniquePtr mNamespace; RefPtr mMappings; }; @@ -90,11 +90,12 @@ class txCheckParam : public txInstruction { class txConditionalGoto : public txInstruction { public: - txConditionalGoto(nsAutoPtr&& aCondition, txInstruction* aTarget); + txConditionalGoto(mozilla::UniquePtr&& aCondition, + txInstruction* aTarget); TX_DECL_TXINSTRUCTION - nsAutoPtr mCondition; + mozilla::UniquePtr mCondition; txInstruction* mTarget; }; @@ -119,11 +120,11 @@ class txCopy : public txCopyBase { class txCopyOf : public txCopyBase { public: - explicit txCopyOf(nsAutoPtr&& aSelect); + explicit txCopyOf(mozilla::UniquePtr&& aSelect); TX_DECL_TXINSTRUCTION - nsAutoPtr mSelect; + mozilla::UniquePtr mSelect; }; class txEndElement : public txInstruction { @@ -166,7 +167,7 @@ class txLoopNodeSet : public txInstruction { class txLREAttribute : public txInstruction { public: txLREAttribute(int32_t aNamespaceID, nsAtom* aLocalName, nsAtom* aPrefix, - nsAutoPtr&& aValue); + mozilla::UniquePtr&& aValue); TX_DECL_TXINSTRUCTION @@ -174,7 +175,7 @@ class txLREAttribute : public txInstruction { RefPtr mLocalName; RefPtr mLowercaseLocalName; RefPtr mPrefix; - nsAutoPtr mValue; + mozilla::UniquePtr mValue; }; class txMessage : public txInstruction { @@ -188,20 +189,23 @@ class txMessage : public txInstruction { class txNumber : public txInstruction { public: - txNumber(txXSLTNumber::LevelType aLevel, nsAutoPtr&& aCount, - nsAutoPtr&& aFrom, nsAutoPtr&& aValue, - nsAutoPtr&& aFormat, nsAutoPtr&& aGroupingSeparator, - nsAutoPtr&& aGroupingSize); + txNumber(txXSLTNumber::LevelType aLevel, + mozilla::UniquePtr&& aCount, + mozilla::UniquePtr&& aFrom, + mozilla::UniquePtr&& aValue, + mozilla::UniquePtr&& aFormat, + mozilla::UniquePtr&& aGroupingSeparator, + mozilla::UniquePtr&& aGroupingSize); TX_DECL_TXINSTRUCTION txXSLTNumber::LevelType mLevel; - nsAutoPtr mCount; - nsAutoPtr mFrom; - nsAutoPtr mValue; - nsAutoPtr mFormat; - nsAutoPtr mGroupingSeparator; - nsAutoPtr mGroupingSize; + mozilla::UniquePtr mCount; + mozilla::UniquePtr mFrom; + mozilla::UniquePtr mValue; + mozilla::UniquePtr mFormat; + mozilla::UniquePtr mGroupingSeparator; + mozilla::UniquePtr mGroupingSize; }; class txPopParams : public txInstruction { @@ -211,35 +215,36 @@ class txPopParams : public txInstruction { class txProcessingInstruction : public txInstruction { public: - explicit txProcessingInstruction(nsAutoPtr&& aName); + explicit txProcessingInstruction(mozilla::UniquePtr&& aName); TX_DECL_TXINSTRUCTION - nsAutoPtr mName; + mozilla::UniquePtr mName; }; class txPushNewContext : public txInstruction { public: - explicit txPushNewContext(nsAutoPtr&& aSelect); + explicit txPushNewContext(mozilla::UniquePtr&& aSelect); ~txPushNewContext(); TX_DECL_TXINSTRUCTION - nsresult addSort(nsAutoPtr&& aSelectExpr, nsAutoPtr&& aLangExpr, - nsAutoPtr&& aDataTypeExpr, - nsAutoPtr&& aOrderExpr, - nsAutoPtr&& aCaseOrderExpr); + nsresult addSort(mozilla::UniquePtr&& aSelectExpr, + mozilla::UniquePtr&& aLangExpr, + mozilla::UniquePtr&& aDataTypeExpr, + mozilla::UniquePtr&& aOrderExpr, + mozilla::UniquePtr&& aCaseOrderExpr); struct SortKey { - nsAutoPtr mSelectExpr; - nsAutoPtr mLangExpr; - nsAutoPtr mDataTypeExpr; - nsAutoPtr mOrderExpr; - nsAutoPtr mCaseOrderExpr; + mozilla::UniquePtr mSelectExpr; + mozilla::UniquePtr mLangExpr; + mozilla::UniquePtr mDataTypeExpr; + mozilla::UniquePtr mOrderExpr; + mozilla::UniquePtr mCaseOrderExpr; }; nsTArray mSortKeys; - nsAutoPtr mSelect; + mozilla::UniquePtr mSelect; txInstruction* mBailTarget; }; @@ -283,33 +288,34 @@ class txReturn : public txInstruction { class txSetParam : public txInstruction { public: - txSetParam(const txExpandedName& aName, nsAutoPtr&& aValue); + txSetParam(const txExpandedName& aName, mozilla::UniquePtr&& aValue); TX_DECL_TXINSTRUCTION txExpandedName mName; - nsAutoPtr mValue; + mozilla::UniquePtr mValue; }; class txSetVariable : public txInstruction { public: - txSetVariable(const txExpandedName& aName, nsAutoPtr&& aValue); + txSetVariable(const txExpandedName& aName, mozilla::UniquePtr&& aValue); TX_DECL_TXINSTRUCTION txExpandedName mName; - nsAutoPtr mValue; + mozilla::UniquePtr mValue; }; class txStartElement : public txInstruction { public: - txStartElement(nsAutoPtr&& aName, nsAutoPtr&& aNamespace, + txStartElement(mozilla::UniquePtr&& aName, + mozilla::UniquePtr&& aNamespace, txNamespaceMap* aMappings); TX_DECL_TXINSTRUCTION - nsAutoPtr mName; - nsAutoPtr mNamespace; + mozilla::UniquePtr mName; + mozilla::UniquePtr mNamespace; RefPtr mMappings; }; @@ -337,11 +343,11 @@ class txText : public txInstruction { class txValueOf : public txInstruction { public: - txValueOf(nsAutoPtr&& aExpr, bool aDOE); + txValueOf(mozilla::UniquePtr&& aExpr, bool aDOE); TX_DECL_TXINSTRUCTION - nsAutoPtr mExpr; + mozilla::UniquePtr mExpr; bool mDOE; }; diff --git a/dom/xslt/xslt/txKey.h b/dom/xslt/xslt/txKey.h index ce85601b29ac..5bfc704d2be6 100644 --- a/dom/xslt/xslt/txKey.h +++ b/dom/xslt/xslt/txKey.h @@ -102,7 +102,8 @@ class txXSLKey { * @param aUse use-expression * @return false if an error occurred, true otherwise */ - bool addKey(nsAutoPtr&& aMatch, nsAutoPtr&& aUse); + bool addKey(mozilla::UniquePtr&& aMatch, + mozilla::UniquePtr&& aUse); /** * Indexes a subtree and adds it to the hash of key values @@ -141,8 +142,8 @@ class txXSLKey { * represents one match/use pair */ struct Key { - nsAutoPtr matchPattern; - nsAutoPtr useExpr; + mozilla::UniquePtr matchPattern; + mozilla::UniquePtr useExpr; }; /** diff --git a/dom/xslt/xslt/txKeyFunctionCall.cpp b/dom/xslt/xslt/txKeyFunctionCall.cpp index f507b66c9525..da889312dc83 100644 --- a/dom/xslt/xslt/txKeyFunctionCall.cpp +++ b/dom/xslt/xslt/txKeyFunctionCall.cpp @@ -220,7 +220,7 @@ nsresult txKeyHash::init() { * @param aUse use-expression * @return false if an error occurred, true otherwise */ -bool txXSLKey::addKey(nsAutoPtr&& aMatch, nsAutoPtr&& aUse) { +bool txXSLKey::addKey(UniquePtr&& aMatch, UniquePtr&& aUse) { if (!aMatch || !aUse) return false; Key* key = mKeys.AppendElement(); diff --git a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp index aa38f9f408b7..6d0070b6fdac 100644 --- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp +++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp @@ -77,7 +77,7 @@ nsresult txToDocHandlerFactory::createHandlerWith( } case eHTMLOutput: { - nsAutoPtr handler( + UniquePtr handler( new txMozillaXMLOutput(aFormat, mObserver)); nsresult rv = handler->createResultDocument( @@ -90,7 +90,7 @@ nsresult txToDocHandlerFactory::createHandlerWith( } case eTextOutput: { - nsAutoPtr handler( + UniquePtr handler( new txMozillaTextOutput(mObserver)); nsresult rv = @@ -120,7 +120,7 @@ nsresult txToDocHandlerFactory::createHandlerWith( case eXMLOutput: case eHTMLOutput: { - nsAutoPtr handler( + UniquePtr handler( new txMozillaXMLOutput(aFormat, mObserver)); nsresult rv = handler->createResultDocument(aName, aNsID, mSourceDocument, @@ -133,7 +133,7 @@ nsresult txToDocHandlerFactory::createHandlerWith( } case eTextOutput: { - nsAutoPtr handler( + UniquePtr handler( new txMozillaTextOutput(mObserver)); nsresult rv = @@ -394,7 +394,7 @@ txMozillaXSLTProcessor::AddXSLTParam(const nsString& aName, RefPtr value; if (!aSelect.IsVoid()) { // Set up context - nsAutoPtr contextNode( + UniquePtr contextNode( txXPathNativeNode::createXPathNode(aContext)); NS_ENSURE_TRUE(contextNode, NS_ERROR_OUT_OF_MEMORY); @@ -406,7 +406,7 @@ txMozillaXSLTProcessor::AddXSLTParam(const nsString& aName, mRecycler); // Parse - nsAutoPtr expr; + UniquePtr expr; rv = txExprParser::createExpr(aSelect, ¶mContext, getter_Transfers(expr)); NS_ENSURE_SUCCESS(rv, rv); @@ -540,7 +540,7 @@ already_AddRefed txMozillaXSLTProcessor::TransformToDocument( nsresult txMozillaXSLTProcessor::TransformToDoc(Document** aResult, bool aCreateDataDocument) { - nsAutoPtr sourceNode( + UniquePtr sourceNode( txXPathNativeNode::createXPathNode(mSource)); if (!sourceNode) { return NS_ERROR_OUT_OF_MEMORY; @@ -607,7 +607,7 @@ already_AddRefed txMozillaXSLTProcessor::TransformToFragment( return nullptr; } - nsAutoPtr sourceNode( + UniquePtr sourceNode( txXPathNativeNode::createXPathNode(&aSource)); if (!sourceNode) { aRv.Throw(NS_ERROR_OUT_OF_MEMORY); @@ -1208,7 +1208,7 @@ nsresult txVariable::Convert(nsIVariant* aValue, txAExprResult** aResult) { nsCOMPtr node = do_QueryInterface(supports); if (node) { - nsAutoPtr xpathNode( + UniquePtr xpathNode( txXPathNativeNode::createXPathNode(node)); if (!xpathNode) { return NS_ERROR_FAILURE; @@ -1240,7 +1240,7 @@ nsresult txVariable::Convert(nsIVariant* aValue, txAExprResult** aResult) { uint32_t i; for (i = 0; i < length; ++i) { - nsAutoPtr xpathNode( + UniquePtr xpathNode( txXPathNativeNode::createXPathNode(nodeList->Item(i))); if (!xpathNode) { return NS_ERROR_FAILURE; @@ -1301,7 +1301,7 @@ nsresult txVariable::Convert(nsIVariant* aValue, txAExprResult** aResult) { nsCOMPtr node = do_QueryInterface(supports); NS_ASSERTION(node, "Huh, we checked this in SetParameter?"); - nsAutoPtr xpathNode( + UniquePtr xpathNode( txXPathNativeNode::createXPathNode(node)); if (!xpathNode) { while (i < count) { diff --git a/dom/xslt/xslt/txNodeSorter.cpp b/dom/xslt/xslt/txNodeSorter.cpp index 0f178d65ab36..5fb11a890421 100644 --- a/dom/xslt/xslt/txNodeSorter.cpp +++ b/dom/xslt/xslt/txNodeSorter.cpp @@ -37,7 +37,7 @@ nsresult txNodeSorter::addSortElement(Expr* aSelectExpr, Expr* aLangExpr, Expr* aDataTypeExpr, Expr* aOrderExpr, Expr* aCaseOrderExpr, txIEvalContext* aContext) { - nsAutoPtr key(new SortKey); + UniquePtr key(new SortKey); nsresult rv = NS_OK; // Select diff --git a/dom/xslt/xslt/txPatternParser.cpp b/dom/xslt/xslt/txPatternParser.cpp index babb585f28aa..e44b63908540 100644 --- a/dom/xslt/xslt/txPatternParser.cpp +++ b/dom/xslt/xslt/txPatternParser.cpp @@ -21,7 +21,7 @@ nsresult txPatternParser::createPattern(const nsString& aPattern, // XXX error report parsing error return rv; } - nsAutoPtr pattern; + UniquePtr pattern; rv = createUnionPattern(lexer, aContext, *getter_Transfers(pattern)); if (NS_FAILED(rv)) { // XXX error report parsing error @@ -277,7 +277,7 @@ nsresult txPatternParser::createStepPattern(txExprLexer& aLexer, NS_ENSURE_SUCCESS(rv, rv); } - nsAutoPtr step(new txStepPattern(nodeTest, isAttr)); + UniquePtr step(new txStepPattern(nodeTest, isAttr)); rv = parsePredicates(step.get(), aLexer, aContext); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/xslt/xslt/txRtfHandler.cpp b/dom/xslt/xslt/txRtfHandler.cpp index b46ae9476c86..c4b3407eddb9 100644 --- a/dom/xslt/xslt/txRtfHandler.cpp +++ b/dom/xslt/xslt/txRtfHandler.cpp @@ -7,7 +7,7 @@ #include -txResultTreeFragment::txResultTreeFragment(nsAutoPtr&& aBuffer) +txResultTreeFragment::txResultTreeFragment(UniquePtr&& aBuffer) : txAExprResult(nullptr), mBuffer(std::move(aBuffer)) {} short txResultTreeFragment::getResultType() { return RESULT_TREE_FRAGMENT; } diff --git a/dom/xslt/xslt/txRtfHandler.h b/dom/xslt/xslt/txRtfHandler.h index 00b2a3b64a2c..e35642a241d4 100644 --- a/dom/xslt/xslt/txRtfHandler.h +++ b/dom/xslt/xslt/txRtfHandler.h @@ -13,7 +13,7 @@ class txResultTreeFragment : public txAExprResult { public: - explicit txResultTreeFragment(nsAutoPtr&& aBuffer); + explicit txResultTreeFragment(mozilla::UniquePtr&& aBuffer); TX_DECL_EXPRRESULT @@ -27,8 +27,8 @@ class txResultTreeFragment : public txAExprResult { const txXPathNode* getNode() const { return mNode.get(); } private: - nsAutoPtr mBuffer; - nsAutoPtr mNode; + mozilla::UniquePtr mBuffer; + mozilla::UniquePtr mNode; }; class txRtfHandler : public txBufferingHandler { diff --git a/dom/xslt/xslt/txStylesheet.cpp b/dom/xslt/xslt/txStylesheet.cpp index f2e554136b4e..d4d7d62ef40c 100644 --- a/dom/xslt/xslt/txStylesheet.cpp +++ b/dom/xslt/xslt/txStylesheet.cpp @@ -28,8 +28,8 @@ nsresult txStylesheet::init() { // element/root template mContainerTemplate = new txPushParams; - nsAutoPtr nt(new txNodeTypeTest(txNodeTypeTest::NODE_TYPE)); - nsAutoPtr nodeExpr( + UniquePtr nt(new txNodeTypeTest(txNodeTypeTest::NODE_TYPE)); + UniquePtr nodeExpr( new LocationStep(nt.get(), LocationStep::CHILD_AXIS)); nt.forget(); @@ -314,7 +314,7 @@ nsresult txStylesheet::doneCompiling() { } if (!mDecimalFormats.get(txExpandedName())) { - nsAutoPtr format(new txDecimalFormat); + UniquePtr format(new txDecimalFormat); rv = mDecimalFormats.add(txExpandedName(), format.get()); NS_ENSURE_SUCCESS(rv, rv); @@ -350,7 +350,7 @@ nsresult txStylesheet::addTemplate(txTemplateItem* aTemplate, aImportFrame->mMatchableTemplates.get(aTemplate->mMode); if (!templates) { - nsAutoPtr > newList( + UniquePtr > newList( new nsTArray); nsresult rv = aImportFrame->mMatchableTemplates.set(aTemplate->mMode, newList.get()); @@ -361,8 +361,8 @@ nsresult txStylesheet::addTemplate(txTemplateItem* aTemplate, // Add the simple patterns to the list of matchable templates, according // to default priority - nsAutoPtr simple = std::move(aTemplate->mMatch); - nsAutoPtr unionPattern; + UniquePtr simple = std::move(aTemplate->mMatch); + UniquePtr unionPattern; if (simple->getType() == txPattern::UNION_PATTERN) { unionPattern = std::move(simple); simple = unionPattern->getSubPatternAt(0); @@ -489,7 +489,7 @@ nsresult txStylesheet::addGlobalVariable(txVariableItem* aVariable) { if (mGlobalVariables.get(aVariable->mName)) { return NS_OK; } - nsAutoPtr var(new GlobalVariable( + UniquePtr var(new GlobalVariable( std::move(aVariable->mValue), std::move(aVariable->mFirstInstruction), aVariable->mIsParam)); nsresult rv = mGlobalVariables.add(aVariable->mName, var.get()); @@ -501,8 +501,8 @@ nsresult txStylesheet::addGlobalVariable(txVariableItem* aVariable) { } nsresult txStylesheet::addKey(const txExpandedName& aName, - nsAutoPtr aMatch, - nsAutoPtr aUse) { + UniquePtr aMatch, + UniquePtr aUse) { nsresult rv = NS_OK; txXSLKey* xslKey = mKeys.get(aName); @@ -521,7 +521,7 @@ nsresult txStylesheet::addKey(const txExpandedName& aName, } nsresult txStylesheet::addDecimalFormat(const txExpandedName& aName, - nsAutoPtr&& aFormat) { + UniquePtr&& aFormat) { txDecimalFormat* existing = mDecimalFormats.get(aName); if (existing) { NS_ENSURE_TRUE(existing->isEqual(aFormat.get()), @@ -545,8 +545,8 @@ txStylesheet::ImportFrame::~ImportFrame() { } } -txStylesheet::GlobalVariable::GlobalVariable(nsAutoPtr&& aExpr, - nsAutoPtr&& aInstr, +txStylesheet::GlobalVariable::GlobalVariable(UniquePtr&& aExpr, + UniquePtr&& aInstr, bool aIsParam) : mExpr(std::move(aExpr)), mFirstInstruction(std::move(aInstr)), diff --git a/dom/xslt/xslt/txStylesheet.h b/dom/xslt/xslt/txStylesheet.h index 076ca2c2339f..f37b8acdbcdd 100644 --- a/dom/xslt/xslt/txStylesheet.h +++ b/dom/xslt/xslt/txStylesheet.h @@ -54,18 +54,19 @@ class txStylesheet final { /** * Add a key to the stylesheet */ - nsresult addKey(const txExpandedName& aName, nsAutoPtr aMatch, - nsAutoPtr aUse); + nsresult addKey(const txExpandedName& aName, + mozilla::UniquePtr aMatch, + mozilla::UniquePtr aUse); /** * Add a decimal-format to the stylesheet */ nsresult addDecimalFormat(const txExpandedName& aName, - nsAutoPtr&& aFormat); + mozilla::UniquePtr&& aFormat); struct MatchableTemplate { txInstruction* mFirstInstruction; - nsAutoPtr mMatch; + mozilla::UniquePtr mMatch; double mPriority; }; @@ -89,11 +90,12 @@ class txStylesheet final { class GlobalVariable : public txObject { public: - GlobalVariable(nsAutoPtr&& aExpr, - nsAutoPtr&& aFirstInstruction, bool aIsParam); + GlobalVariable(mozilla::UniquePtr&& aExpr, + mozilla::UniquePtr&& aFirstInstruction, + bool aIsParam); - nsAutoPtr mExpr; - nsAutoPtr mFirstInstruction; + mozilla::UniquePtr mExpr; + mozilla::UniquePtr mFirstInstruction; bool mIsParam; }; @@ -137,12 +139,12 @@ class txStylesheet final { txOwningExpandedNameMap mKeys; // Array of all txStripSpaceTests, sorted in acending order - nsTArray > mStripSpaceTests; + nsTArray > mStripSpaceTests; // Default templates - nsAutoPtr mContainerTemplate; - nsAutoPtr mCharactersTemplate; - nsAutoPtr mEmptyTemplate; + mozilla::UniquePtr mContainerTemplate; + mozilla::UniquePtr mCharactersTemplate; + mozilla::UniquePtr mEmptyTemplate; }; /** diff --git a/dom/xslt/xslt/txStylesheetCompileHandlers.cpp b/dom/xslt/xslt/txStylesheetCompileHandlers.cpp index a30241ed1b82..de724d677de2 100644 --- a/dom/xslt/xslt/txStylesheetCompileHandlers.cpp +++ b/dom/xslt/xslt/txStylesheetCompileHandlers.cpp @@ -95,7 +95,7 @@ static nsresult parseUseAttrSets(txStylesheetAttr* aAttributes, rv = name.init(tok.nextToken(), aState.mElementContext->mMappings, false); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr instr(new txInsertAttrSet(name)); + UniquePtr instr(new txInsertAttrSet(name)); aState.addInstruction(std::move(instr)); } return NS_OK; @@ -140,7 +140,7 @@ static nsresult getQNameAttr(txStylesheetAttr* aAttributes, int32_t aAttrCount, static nsresult getExprAttr(txStylesheetAttr* aAttributes, int32_t aAttrCount, nsAtom* aName, bool aRequired, txStylesheetCompilerState& aState, - nsAutoPtr& aExpr) { + UniquePtr& aExpr) { aExpr = nullptr; txStylesheetAttr* attr = nullptr; nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None, aName, @@ -170,7 +170,7 @@ static nsresult getExprAttr(txStylesheetAttr* aAttributes, int32_t aAttrCount, static nsresult getAVTAttr(txStylesheetAttr* aAttributes, int32_t aAttrCount, nsAtom* aName, bool aRequired, txStylesheetCompilerState& aState, - nsAutoPtr& aAVT) { + UniquePtr& aAVT) { aAVT = nullptr; txStylesheetAttr* attr = nullptr; nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None, aName, @@ -201,7 +201,7 @@ static nsresult getPatternAttr(txStylesheetAttr* aAttributes, int32_t aAttrCount, nsAtom* aName, bool aRequired, txStylesheetCompilerState& aState, - nsAutoPtr& aPattern) { + UniquePtr& aPattern) { aPattern = nullptr; txStylesheetAttr* attr = nullptr; nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None, aName, @@ -425,8 +425,8 @@ static nsresult txFnStartLREStylesheet(int32_t aNamespaceID, nsAtom* aLocalName, txExpandedName nullExpr; double prio = UnspecifiedNaN(); - nsAutoPtr match(new txRootPattern()); - nsAutoPtr templ( + UniquePtr match(new txRootPattern()); + UniquePtr templ( new txTemplateItem(std::move(match), nullExpr, nullExpr, prio)); aState.openInstructionContainer(templ.get()); aState.addToplevelItem(templ.get()); @@ -446,7 +446,7 @@ static nsresult txFnEndLREStylesheet(txStylesheetCompilerState& aState) { aState.popHandlerTable(); - nsAutoPtr instr(new txReturn()); + UniquePtr instr(new txReturn()); aState.addInstruction(std::move(instr)); aState.closeInstructionContainer(); @@ -512,7 +512,7 @@ static nsresult txFnStartAttributeSet(int32_t aNamespaceID, nsAtom* aLocalName, name); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr attrSet(new txAttributeSetItem(name)); + UniquePtr attrSet(new txAttributeSetItem(name)); aState.openInstructionContainer(attrSet.get()); aState.addToplevelItem(attrSet.get()); @@ -528,7 +528,7 @@ static nsresult txFnStartAttributeSet(int32_t aNamespaceID, nsAtom* aLocalName, static nsresult txFnEndAttributeSet(txStylesheetCompilerState& aState) { aState.popHandlerTable(); - nsAutoPtr instr(new txReturn()); + UniquePtr instr(new txReturn()); aState.addInstruction(std::move(instr)); aState.closeInstructionContainer(); @@ -548,7 +548,7 @@ static nsresult txFnStartDecimalFormat(int32_t aNamespaceID, nsAtom* aLocalName, name); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr format(new txDecimalFormat); + UniquePtr format(new txDecimalFormat); rv = getCharAttr(aAttributes, aAttrCount, nsGkAtoms::decimalSeparator, false, aState, format->mDecimalSeparator); NS_ENSURE_SUCCESS(rv, rv); @@ -615,7 +615,7 @@ static nsresult txFnStartImport(int32_t aNamespaceID, nsAtom* aLocalName, nsAtom* aPrefix, txStylesheetAttr* aAttributes, int32_t aAttrCount, txStylesheetCompilerState& aState) { - nsAutoPtr import(new txImportItem); + UniquePtr import(new txImportItem); import->mFrame = new txStylesheet::ImportFrame; aState.addToplevelItem(import.get()); @@ -677,12 +677,12 @@ static nsresult txFnStartKey(int32_t aNamespaceID, nsAtom* aLocalName, aState.mDisAllowed = txIParseContext::KEY_FUNCTION; - nsAutoPtr match; + UniquePtr match; rv = getPatternAttr(aAttributes, aAttrCount, nsGkAtoms::match, true, aState, match); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr use; + UniquePtr use; rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::use, true, aState, use); NS_ENSURE_SUCCESS(rv, rv); @@ -733,7 +733,7 @@ static nsresult txFnStartOutput(int32_t aNamespaceID, nsAtom* aLocalName, txStylesheetCompilerState& aState) { nsresult rv = NS_OK; - nsAutoPtr item(new txOutputItem); + UniquePtr item(new txOutputItem); txExpandedName methodExpName; rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::method, false, aState, @@ -793,7 +793,7 @@ static nsresult txFnStartOutput(int32_t aNamespaceID, nsAtom* aLocalName, if (attr) { nsWhitespaceTokenizer tokens(attr->mValue); while (tokens.hasMoreTokens()) { - nsAutoPtr qname(new txExpandedName()); + UniquePtr qname(new txExpandedName()); rv = qname->init(tokens.nextToken(), aState.mElementContext->mMappings, false); NS_ENSURE_SUCCESS(rv, rv); @@ -836,7 +836,7 @@ static nsresult txFnStartStripSpace(int32_t aNamespaceID, nsAtom* aLocalName, bool strip = aLocalName == nsGkAtoms::stripSpace; - nsAutoPtr stripItem(new txStripSpaceItem); + UniquePtr stripItem(new txStripSpaceItem); nsWhitespaceTokenizer tokenizer(attr->mValue); while (tokenizer.hasMoreTokens()) { const nsAString& name = tokenizer.nextToken(); @@ -875,7 +875,7 @@ static nsresult txFnStartStripSpace(int32_t aNamespaceID, nsAtom* aLocalName, ns = aState.mElementContext->mMappings->lookupNamespace(prefix); NS_ENSURE_TRUE(ns != kNameSpaceID_Unknown, NS_ERROR_FAILURE); } - nsAutoPtr sst( + UniquePtr sst( new txStripSpaceTest(prefix, localName, ns, strip)); rv = stripItem->addStripSpaceTest(sst.get()); NS_ENSURE_SUCCESS(rv, rv); @@ -916,12 +916,12 @@ static nsresult txFnStartTemplate(int32_t aNamespaceID, nsAtom* aLocalName, aState, prio); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr match; + UniquePtr match; rv = getPatternAttr(aAttributes, aAttrCount, nsGkAtoms::match, name.isNull(), aState, match); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr templ( + UniquePtr templ( new txTemplateItem(std::move(match), name, mode, prio)); aState.openInstructionContainer(templ.get()); aState.addToplevelItem(templ.forget()); @@ -932,7 +932,7 @@ static nsresult txFnStartTemplate(int32_t aNamespaceID, nsAtom* aLocalName, static nsresult txFnEndTemplate(txStylesheetCompilerState& aState) { aState.popHandlerTable(); - nsAutoPtr instr(new txReturn()); + UniquePtr instr(new txReturn()); aState.addInstruction(std::move(instr)); aState.closeInstructionContainer(); @@ -952,12 +952,12 @@ static nsresult txFnStartTopVariable(int32_t aNamespaceID, nsAtom* aLocalName, name); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr select; + UniquePtr select; rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, false, aState, select); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr var(new txVariableItem( + UniquePtr var(new txVariableItem( name, std::move(select), aLocalName == nsGkAtoms::param)); aState.openInstructionContainer(var.get()); rv = aState.pushPtr(var.get(), aState.eVariableItem); @@ -989,7 +989,7 @@ static nsresult txFnEndTopVariable(txStylesheetCompilerState& aState) { var->mValue = new txLiteralExpr(EmptyString()); } else if (!var->mValue) { // If we don't have a select-expression there mush be children. - nsAutoPtr instr(new txReturn()); + UniquePtr instr(new txReturn()); aState.addInstruction(std::move(instr)); } @@ -1036,7 +1036,7 @@ static nsresult txFnStartLRE(int32_t aNamespaceID, nsAtom* aLocalName, txStylesheetCompilerState& aState) { nsresult rv = NS_OK; - nsAutoPtr instr( + UniquePtr instr( new txStartLREElement(aNamespaceID, aLocalName, aPrefix)); aState.addInstruction(std::move(instr)); @@ -1059,7 +1059,7 @@ static nsresult txFnStartLRE(int32_t aNamespaceID, nsAtom* aLocalName, continue; } - nsAutoPtr avt; + UniquePtr avt; rv = txExprParser::createAVT(attr->mValue, &aState, getter_Transfers(avt)); NS_ENSURE_SUCCESS(rv, rv); @@ -1072,7 +1072,7 @@ static nsresult txFnStartLRE(int32_t aNamespaceID, nsAtom* aLocalName, } static nsresult txFnEndLRE(txStylesheetCompilerState& aState) { - nsAutoPtr instr(new txEndElement); + UniquePtr instr(new txEndElement); aState.addInstruction(std::move(instr)); return NS_OK; @@ -1087,7 +1087,7 @@ static nsresult txFnText(const nsAString& aStr, txStylesheetCompilerState& aState) { TX_RETURN_IF_WHITESPACE(aStr, aState); - nsAutoPtr instr(new txText(aStr, false)); + UniquePtr instr(new txText(aStr, false)); aState.addInstruction(std::move(instr)); return NS_OK; @@ -1104,7 +1104,7 @@ static nsresult txFnStartApplyImports(int32_t aNamespaceID, nsAtom* aLocalName, txStylesheetAttr* aAttributes, int32_t aAttrCount, txStylesheetCompilerState& aState) { - nsAutoPtr instr(new txApplyImportsStart); + UniquePtr instr(new txApplyImportsStart); aState.addInstruction(std::move(instr)); instr = new txApplyImportsEnd; @@ -1136,7 +1136,7 @@ static nsresult txFnStartApplyTemplates(int32_t aNamespaceID, txStylesheetCompilerState& aState) { nsresult rv = NS_OK; - nsAutoPtr instr(new txPushParams); + UniquePtr instr(new txPushParams); aState.addInstruction(std::move(instr)); txExpandedName mode; @@ -1150,17 +1150,17 @@ static nsresult txFnStartApplyTemplates(int32_t aNamespaceID, instr.forget(); - nsAutoPtr select; + UniquePtr select; rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, false, aState, select); NS_ENSURE_SUCCESS(rv, rv); if (!select) { - nsAutoPtr nt(new txNodeTypeTest(txNodeTypeTest::NODE_TYPE)); + UniquePtr nt(new txNodeTypeTest(txNodeTypeTest::NODE_TYPE)); select = new LocationStep(nt.forget(), LocationStep::CHILD_AXIS); } - nsAutoPtr pushcontext( + UniquePtr pushcontext( new txPushNewContext(std::move(select))); rv = aState.pushSorter(pushcontext.get()); NS_ENSURE_SUCCESS(rv, rv); @@ -1178,13 +1178,13 @@ static nsresult txFnEndApplyTemplates(txStylesheetCompilerState& aState) { txPushNewContext* pushcontext = static_cast(aState.popObject()); - nsAutoPtr instr(pushcontext); // txPushNewContext + UniquePtr instr(pushcontext); // txPushNewContext aState.addInstruction(std::move(instr)); aState.popSorter(); instr = static_cast(aState.popObject()); // txApplyTemplates - nsAutoPtr loop(new txLoopNodeSet(instr.get())); + UniquePtr loop(new txLoopNodeSet(instr.get())); aState.addInstruction(std::move(instr)); instr = loop.forget(); @@ -1211,14 +1211,14 @@ static nsresult txFnStartAttribute(int32_t aNamespaceID, nsAtom* aLocalName, txStylesheetCompilerState& aState) { nsresult rv = NS_OK; - nsAutoPtr instr(new txPushStringHandler(true)); + UniquePtr instr(new txPushStringHandler(true)); aState.addInstruction(std::move(instr)); - nsAutoPtr name; + UniquePtr name; rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::name, true, aState, name); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr nspace; + UniquePtr nspace; rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::_namespace, false, aState, nspace); NS_ENSURE_SUCCESS(rv, rv); @@ -1237,7 +1237,7 @@ static nsresult txFnStartAttribute(int32_t aNamespaceID, nsAtom* aLocalName, static nsresult txFnEndAttribute(txStylesheetCompilerState& aState) { aState.popHandlerTable(); - nsAutoPtr instr( + UniquePtr instr( static_cast(aState.popObject())); aState.addInstruction(std::move(instr)); @@ -1259,7 +1259,7 @@ static nsresult txFnStartCallTemplate(int32_t aNamespaceID, nsAtom* aLocalName, txStylesheetCompilerState& aState) { nsresult rv = NS_OK; - nsAutoPtr instr(new txPushParams); + UniquePtr instr(new txPushParams); aState.addInstruction(std::move(instr)); txExpandedName name; @@ -1280,7 +1280,7 @@ static nsresult txFnEndCallTemplate(txStylesheetCompilerState& aState) { aState.popHandlerTable(); // txCallTemplate - nsAutoPtr instr( + UniquePtr instr( static_cast(aState.popObject())); aState.addInstruction(std::move(instr)); @@ -1340,14 +1340,14 @@ static nsresult txFnStartComment(int32_t aNamespaceID, nsAtom* aLocalName, nsAtom* aPrefix, txStylesheetAttr* aAttributes, int32_t aAttrCount, txStylesheetCompilerState& aState) { - nsAutoPtr instr(new txPushStringHandler(true)); + UniquePtr instr(new txPushStringHandler(true)); aState.addInstruction(std::move(instr)); return NS_OK; } static nsresult txFnEndComment(txStylesheetCompilerState& aState) { - nsAutoPtr instr(new txComment); + UniquePtr instr(new txComment); aState.addInstruction(std::move(instr)); return NS_OK; @@ -1366,11 +1366,11 @@ static nsresult txFnStartCopy(int32_t aNamespaceID, nsAtom* aLocalName, nsAtom* aPrefix, txStylesheetAttr* aAttributes, int32_t aAttrCount, txStylesheetCompilerState& aState) { - nsAutoPtr copy(new txCopy); + UniquePtr copy(new txCopy); nsresult rv = aState.pushPtr(copy.get(), aState.eCopy); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr instr(copy.forget()); + UniquePtr instr(copy.forget()); aState.addInstruction(std::move(instr)); rv = parseUseAttrSets(aAttributes, aAttrCount, false, aState); @@ -1380,7 +1380,7 @@ static nsresult txFnStartCopy(int32_t aNamespaceID, nsAtom* aLocalName, } static nsresult txFnEndCopy(txStylesheetCompilerState& aState) { - nsAutoPtr instr(new txEndElement); + UniquePtr instr(new txEndElement); aState.addInstruction(std::move(instr)); txCopy* copy = static_cast(aState.popPtr(aState.eCopy)); @@ -1401,12 +1401,12 @@ static nsresult txFnStartCopyOf(int32_t aNamespaceID, nsAtom* aLocalName, txStylesheetCompilerState& aState) { nsresult rv = NS_OK; - nsAutoPtr select; + UniquePtr select; rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, true, aState, select); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr instr(new txCopyOf(std::move(select))); + UniquePtr instr(new txCopyOf(std::move(select))); aState.addInstruction(std::move(instr)); return aState.pushHandlerTable(gTxIgnoreHandler); @@ -1431,16 +1431,16 @@ static nsresult txFnStartElement(int32_t aNamespaceID, nsAtom* aLocalName, txStylesheetCompilerState& aState) { nsresult rv = NS_OK; - nsAutoPtr name; + UniquePtr name; rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::name, true, aState, name); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr nspace; + UniquePtr nspace; rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::_namespace, false, aState, nspace); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr instr(new txStartElement( + UniquePtr instr(new txStartElement( std::move(name), std::move(nspace), aState.mElementContext->mMappings)); aState.addInstruction(std::move(instr)); @@ -1451,7 +1451,7 @@ static nsresult txFnStartElement(int32_t aNamespaceID, nsAtom* aLocalName, } static nsresult txFnEndElement(txStylesheetCompilerState& aState) { - nsAutoPtr instr(new txEndElement); + UniquePtr instr(new txEndElement); aState.addInstruction(std::move(instr)); return NS_OK; @@ -1495,12 +1495,12 @@ static nsresult txFnStartForEach(int32_t aNamespaceID, nsAtom* aLocalName, txStylesheetCompilerState& aState) { nsresult rv = NS_OK; - nsAutoPtr select; + UniquePtr select; rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, true, aState, select); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr pushcontext( + UniquePtr pushcontext( new txPushNewContext(std::move(select))); rv = aState.pushPtr(pushcontext.get(), aState.ePushNewContext); NS_ENSURE_SUCCESS(rv, rv); @@ -1508,7 +1508,7 @@ static nsresult txFnStartForEach(int32_t aNamespaceID, nsAtom* aLocalName, rv = aState.pushSorter(pushcontext.get()); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr instr(pushcontext.forget()); + UniquePtr instr(pushcontext.forget()); aState.addInstruction(std::move(instr)); instr = new txPushNullTemplateRule; @@ -1527,7 +1527,7 @@ static nsresult txFnEndForEach(txStylesheetCompilerState& aState) { txInstruction* pnullrule = static_cast(aState.popPtr(aState.ePushNullTemplateRule)); - nsAutoPtr instr(new txLoopNodeSet(pnullrule)); + UniquePtr instr(new txLoopNodeSet(pnullrule)); aState.addInstruction(std::move(instr)); aState.popSorter(); @@ -1569,17 +1569,17 @@ static nsresult txFnStartIf(int32_t aNamespaceID, nsAtom* aLocalName, txStylesheetCompilerState& aState) { nsresult rv = NS_OK; - nsAutoPtr test; + UniquePtr test; rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::test, true, aState, test); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr condGoto( + UniquePtr condGoto( new txConditionalGoto(std::move(test), nullptr)); rv = aState.pushPtr(condGoto.get(), aState.eConditionalGoto); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr instr(condGoto.forget()); + UniquePtr instr(condGoto.forget()); aState.addInstruction(std::move(instr)); return NS_OK; @@ -1602,7 +1602,7 @@ static nsresult txFnStartMessage(int32_t aNamespaceID, nsAtom* aLocalName, nsAtom* aPrefix, txStylesheetAttr* aAttributes, int32_t aAttrCount, txStylesheetCompilerState& aState) { - nsAutoPtr instr(new txPushStringHandler(false)); + UniquePtr instr(new txPushStringHandler(false)); aState.addInstruction(std::move(instr)); txThreeState term; @@ -1620,7 +1620,7 @@ static nsresult txFnStartMessage(int32_t aNamespaceID, nsAtom* aLocalName, } static nsresult txFnEndMessage(txStylesheetCompilerState& aState) { - nsAutoPtr instr( + UniquePtr instr( static_cast(aState.popObject())); aState.addInstruction(std::move(instr)); @@ -1652,47 +1652,47 @@ static nsresult txFnStartNumber(int32_t aNamespaceID, nsAtom* aLocalName, return NS_ERROR_XSLT_PARSE_FAILURE; } - nsAutoPtr count; + UniquePtr count; rv = getPatternAttr(aAttributes, aAttrCount, nsGkAtoms::count, false, aState, count); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr from; + UniquePtr from; rv = getPatternAttr(aAttributes, aAttrCount, nsGkAtoms::from, false, aState, from); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr value; + UniquePtr value; rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::value, false, aState, value); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr format; + UniquePtr format; rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::format, false, aState, format); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr lang; + UniquePtr lang; rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::lang, false, aState, lang); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr letterValue; + UniquePtr letterValue; rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::letterValue, false, aState, letterValue); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr groupingSeparator; + UniquePtr groupingSeparator; rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::groupingSeparator, false, aState, groupingSeparator); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr groupingSize; + UniquePtr groupingSize; rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::groupingSize, false, aState, groupingSize); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr instr( + UniquePtr instr( new txNumber(level, std::move(count), std::move(from), std::move(value), std::move(format), std::move(groupingSeparator), std::move(groupingSize))); @@ -1747,21 +1747,21 @@ static nsresult txFnStartParam(int32_t aNamespaceID, nsAtom* aLocalName, name); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr checkParam(new txCheckParam(name)); + UniquePtr checkParam(new txCheckParam(name)); NS_ENSURE_SUCCESS(rv, rv); rv = aState.pushPtr(checkParam.get(), aState.eCheckParam); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr instr(checkParam.forget()); + UniquePtr instr(checkParam.forget()); aState.addInstruction(std::move(instr)); - nsAutoPtr select; + UniquePtr select; rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, false, aState, select); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr var(new txSetVariable(name, std::move(select))); + UniquePtr var(new txSetVariable(name, std::move(select))); if (var->mValue) { // XXX should be gTxErrorHandler? rv = aState.pushHandlerTable(gTxIgnoreHandler); @@ -1780,7 +1780,7 @@ static nsresult txFnStartParam(int32_t aNamespaceID, nsAtom* aLocalName, } static nsresult txFnEndParam(txStylesheetCompilerState& aState) { - nsAutoPtr var(static_cast(aState.popObject())); + UniquePtr var(static_cast(aState.popObject())); txHandlerTable* prev = aState.mHandlerTable; aState.popHandlerTable(); @@ -1793,7 +1793,7 @@ static nsresult txFnEndParam(txStylesheetCompilerState& aState) { nsresult rv = aState.addVariable(var->mName); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr instr(var.forget()); + UniquePtr instr(var.forget()); aState.addInstruction(std::move(instr)); txCheckParam* checkParam = @@ -1814,10 +1814,10 @@ static nsresult txFnStartPI(int32_t aNamespaceID, nsAtom* aLocalName, nsAtom* aPrefix, txStylesheetAttr* aAttributes, int32_t aAttrCount, txStylesheetCompilerState& aState) { - nsAutoPtr instr(new txPushStringHandler(true)); + UniquePtr instr(new txPushStringHandler(true)); aState.addInstruction(std::move(instr)); - nsAutoPtr name; + UniquePtr name; nsresult rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::name, true, aState, name); NS_ENSURE_SUCCESS(rv, rv); @@ -1832,7 +1832,7 @@ static nsresult txFnStartPI(int32_t aNamespaceID, nsAtom* aLocalName, } static nsresult txFnEndPI(txStylesheetCompilerState& aState) { - nsAutoPtr instr( + UniquePtr instr( static_cast(aState.popObject())); aState.addInstruction(std::move(instr)); @@ -1850,32 +1850,32 @@ static nsresult txFnStartSort(int32_t aNamespaceID, nsAtom* aLocalName, txStylesheetCompilerState& aState) { nsresult rv = NS_OK; - nsAutoPtr select; + UniquePtr select; rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, false, aState, select); NS_ENSURE_SUCCESS(rv, rv); if (!select) { - nsAutoPtr nt(new txNodeTypeTest(txNodeTypeTest::NODE_TYPE)); + UniquePtr nt(new txNodeTypeTest(txNodeTypeTest::NODE_TYPE)); select = new LocationStep(nt.forget(), LocationStep::SELF_AXIS); } - nsAutoPtr lang; + UniquePtr lang; rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::lang, false, aState, lang); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr dataType; + UniquePtr dataType; rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::dataType, false, aState, dataType); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr order; + UniquePtr order; rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::order, false, aState, order); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr caseOrder; + UniquePtr caseOrder; rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::caseOrder, false, aState, caseOrder); NS_ENSURE_SUCCESS(rv, rv); @@ -1924,7 +1924,7 @@ static nsresult txFnEndText(txStylesheetCompilerState& aState) { static nsresult txFnTextText(const nsAString& aStr, txStylesheetCompilerState& aState) { - nsAutoPtr instr(new txText(aStr, aState.mDOE)); + UniquePtr instr(new txText(aStr, aState.mDOE)); aState.addInstruction(std::move(instr)); return NS_OK; @@ -1946,12 +1946,12 @@ static nsresult txFnStartValueOf(int32_t aNamespaceID, nsAtom* aLocalName, false, aState, doe); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr select; + UniquePtr select; rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, true, aState, select); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr instr( + UniquePtr instr( new txValueOf(std::move(select), doe == eTrue)); aState.addInstruction(std::move(instr)); @@ -1982,12 +1982,12 @@ static nsresult txFnStartVariable(int32_t aNamespaceID, nsAtom* aLocalName, name); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr select; + UniquePtr select; rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, false, aState, select); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr var(new txSetVariable(name, std::move(select))); + UniquePtr var(new txSetVariable(name, std::move(select))); if (var->mValue) { // XXX should be gTxErrorHandler? rv = aState.pushHandlerTable(gTxIgnoreHandler); @@ -2006,7 +2006,7 @@ static nsresult txFnStartVariable(int32_t aNamespaceID, nsAtom* aLocalName, } static nsresult txFnEndVariable(txStylesheetCompilerState& aState) { - nsAutoPtr var(static_cast(aState.popObject())); + UniquePtr var(static_cast(aState.popObject())); txHandlerTable* prev = aState.mHandlerTable; aState.popHandlerTable(); @@ -2020,7 +2020,7 @@ static nsresult txFnEndVariable(txStylesheetCompilerState& aState) { nsresult rv = aState.addVariable(var->mName); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr instr(var.forget()); + UniquePtr instr(var.forget()); aState.addInstruction(std::move(instr)); return NS_OK; @@ -2031,7 +2031,7 @@ static nsresult txFnStartElementStartRTF(int32_t aNamespaceID, txStylesheetAttr* aAttributes, int32_t aAttrCount, txStylesheetCompilerState& aState) { - nsAutoPtr instr(new txPushRTFHandler); + UniquePtr instr(new txPushRTFHandler); aState.addInstruction(std::move(instr)); aState.mHandlerTable = gTxTemplateHandler; @@ -2043,7 +2043,7 @@ static nsresult txFnTextStartRTF(const nsAString& aStr, txStylesheetCompilerState& aState) { TX_RETURN_IF_WHITESPACE(aStr, aState); - nsAutoPtr instr(new txPushRTFHandler); + UniquePtr instr(new txPushRTFHandler); aState.addInstruction(std::move(instr)); aState.mHandlerTable = gTxTemplateHandler; @@ -2062,17 +2062,17 @@ static nsresult txFnStartWhen(int32_t aNamespaceID, nsAtom* aLocalName, txStylesheetCompilerState& aState) { nsresult rv = NS_OK; - nsAutoPtr test; + UniquePtr test; rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::test, true, aState, test); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr condGoto( + UniquePtr condGoto( new txConditionalGoto(std::move(test), nullptr)); rv = aState.pushPtr(condGoto.get(), aState.eConditionalGoto); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr instr(condGoto.forget()); + UniquePtr instr(condGoto.forget()); aState.addInstruction(std::move(instr)); return aState.pushHandlerTable(gTxTemplateHandler); @@ -2080,10 +2080,10 @@ static nsresult txFnStartWhen(int32_t aNamespaceID, nsAtom* aLocalName, static nsresult txFnEndWhen(txStylesheetCompilerState& aState) { aState.popHandlerTable(); - nsAutoPtr gotoinstr(new txGoTo(nullptr)); + UniquePtr gotoinstr(new txGoTo(nullptr)); aState.mChooseGotoList->add(gotoinstr.get()); - nsAutoPtr instr(gotoinstr.forget()); + UniquePtr instr(gotoinstr.forget()); aState.addInstruction(std::move(instr)); txConditionalGoto* condGoto = @@ -2113,12 +2113,12 @@ static nsresult txFnStartWithParam(int32_t aNamespaceID, nsAtom* aLocalName, name); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr select; + UniquePtr select; rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, false, aState, select); NS_ENSURE_SUCCESS(rv, rv); - nsAutoPtr var(new txSetParam(name, std::move(select))); + UniquePtr var(new txSetParam(name, std::move(select))); if (var->mValue) { // XXX should be gTxErrorHandler? rv = aState.pushHandlerTable(gTxIgnoreHandler); @@ -2137,7 +2137,7 @@ static nsresult txFnStartWithParam(int32_t aNamespaceID, nsAtom* aLocalName, } static nsresult txFnEndWithParam(txStylesheetCompilerState& aState) { - nsAutoPtr var(static_cast(aState.popObject())); + UniquePtr var(static_cast(aState.popObject())); txHandlerTable* prev = aState.mHandlerTable; aState.popHandlerTable(); @@ -2147,7 +2147,7 @@ static nsresult txFnEndWithParam(txStylesheetCompilerState& aState) { var->mValue = new txLiteralExpr(EmptyString()); } - nsAutoPtr instr(var.forget()); + UniquePtr instr(var.forget()); aState.addInstruction(std::move(instr)); return NS_OK; @@ -2181,7 +2181,7 @@ static nsresult txFnEndUnknownInstruction(txStylesheetCompilerState& aState) { aState.popHandlerTable(); if (aState.mSearchingForFallback) { - nsAutoPtr instr(new txErrorInstruction()); + UniquePtr instr(new txErrorInstruction()); aState.addInstruction(std::move(instr)); } diff --git a/dom/xslt/xslt/txStylesheetCompiler.cpp b/dom/xslt/xslt/txStylesheetCompiler.cpp index fe0bf720bed1..5f573ad80692 100644 --- a/dom/xslt/xslt/txStylesheetCompiler.cpp +++ b/dom/xslt/xslt/txStylesheetCompiler.cpp @@ -295,7 +295,7 @@ nsresult txStylesheetCompiler::endElement() { for (i = mInScopeVariables.Length() - 1; i >= 0; --i) { txInScopeVariable* var = mInScopeVariables[i]; if (!--(var->mLevel)) { - nsAutoPtr instr(new txRemoveVariable(var->mName)); + UniquePtr instr(new txRemoveVariable(var->mName)); addInstruction(std::move(instr)); mInScopeVariables.RemoveElementAt(i); @@ -417,7 +417,7 @@ nsresult txStylesheetCompiler::ensureNewElementContext() { return NS_OK; } - nsAutoPtr context(new txElementContext(*mElementContext)); + UniquePtr context(new txElementContext(*mElementContext)); nsresult rv = pushObject(mElementContext.get()); NS_ENSURE_SUCCESS(rv, rv); @@ -629,7 +629,7 @@ void txStylesheetCompilerState::closeInstructionContainer() { } void txStylesheetCompilerState::addInstruction( - nsAutoPtr&& aInstruction) { + UniquePtr&& aInstruction) { MOZ_ASSERT(mNextInstrPtr, "adding instruction outside container"); txInstruction* newInstr = aInstruction.get(); @@ -654,7 +654,7 @@ nsresult txStylesheetCompilerState::loadIncludedStylesheet( } NS_ENSURE_TRUE(mObserver, NS_ERROR_NOT_IMPLEMENTED); - nsAutoPtr item(new txDummyItem); + UniquePtr item(new txDummyItem); NS_ENSURE_TRUE(item, NS_ERROR_OUT_OF_MEMORY); mToplevelIterator.addBefore(item.forget()); @@ -837,7 +837,7 @@ extern bool TX_XSLTFunctionAvailable(nsAtom* aName, int32_t aNameSpaceID) { new txStylesheetCompiler(EmptyString(), ReferrerPolicy::_empty, nullptr); NS_ENSURE_TRUE(compiler, false); - nsAutoPtr fnCall; + UniquePtr fnCall; return NS_SUCCEEDED( findFunction(aName, aNameSpaceID, compiler, getter_Transfers(fnCall))); diff --git a/dom/xslt/xslt/txStylesheetCompiler.h b/dom/xslt/xslt/txStylesheetCompiler.h index 02cafd0567c2..fb4ad88c567c 100644 --- a/dom/xslt/xslt/txStylesheetCompiler.h +++ b/dom/xslt/xslt/txStylesheetCompiler.h @@ -102,7 +102,7 @@ class txStylesheetCompilerState : public txIParseContext { void addToplevelItem(txToplevelItem* aItem); nsresult openInstructionContainer(txInstructionContainer* aContainer); void closeInstructionContainer(); - void addInstruction(nsAutoPtr&& aInstruction); + void addInstruction(mozilla::UniquePtr&& aInstruction); nsresult loadIncludedStylesheet(const nsAString& aURI); nsresult loadImportedStylesheet(const nsAString& aURI, txStylesheet::ImportFrame* aFrame); @@ -134,9 +134,9 @@ class txStylesheetCompilerState : public txIParseContext { RefPtr mStylesheet; txHandlerTable* mHandlerTable; - nsAutoPtr mElementContext; + mozilla::UniquePtr mElementContext; txPushNewContext* mSorter; - nsAutoPtr mChooseGotoList; + mozilla::UniquePtr mChooseGotoList; bool mDOE; bool mSearchingForFallback; uint16_t mDisAllowed; diff --git a/dom/xslt/xslt/txToplevelItems.cpp b/dom/xslt/xslt/txToplevelItems.cpp index 34d2681ce888..4d764dd5a891 100644 --- a/dom/xslt/xslt/txToplevelItems.cpp +++ b/dom/xslt/xslt/txToplevelItems.cpp @@ -35,7 +35,7 @@ nsresult txStripSpaceItem::addStripSpaceTest( TX_IMPL_GETTYPE(txTemplateItem, txToplevelItem::templ) -txTemplateItem::txTemplateItem(nsAutoPtr&& aMatch, +txTemplateItem::txTemplateItem(UniquePtr&& aMatch, const txExpandedName& aName, const txExpandedName& aMode, double aPrio) : mMatch(std::move(aMatch)), mName(aName), mMode(aMode), mPrio(aPrio) {} @@ -43,5 +43,5 @@ txTemplateItem::txTemplateItem(nsAutoPtr&& aMatch, TX_IMPL_GETTYPE(txVariableItem, txToplevelItem::variable) txVariableItem::txVariableItem(const txExpandedName& aName, - nsAutoPtr&& aValue, bool aIsParam) + UniquePtr&& aValue, bool aIsParam) : mName(aName), mValue(std::move(aValue)), mIsParam(aIsParam) {} diff --git a/dom/xslt/xslt/txToplevelItems.h b/dom/xslt/xslt/txToplevelItems.h index f04b5188e064..78710cbaa699 100644 --- a/dom/xslt/xslt/txToplevelItems.h +++ b/dom/xslt/xslt/txToplevelItems.h @@ -40,7 +40,7 @@ class txToplevelItem { class txInstructionContainer : public txToplevelItem { public: - nsAutoPtr mFirstInstruction; + mozilla::UniquePtr mFirstInstruction; }; // xsl:attribute-set @@ -58,7 +58,7 @@ class txImportItem : public txToplevelItem { public: TX_DECL_TOPLEVELITEM - nsAutoPtr mFrame; + mozilla::UniquePtr mFrame; }; // xsl:output @@ -90,12 +90,13 @@ class txStripSpaceItem : public txToplevelItem { // xsl:template class txTemplateItem : public txInstructionContainer { public: - txTemplateItem(nsAutoPtr&& aMatch, const txExpandedName& aName, - const txExpandedName& aMode, double aPrio); + txTemplateItem(mozilla::UniquePtr&& aMatch, + const txExpandedName& aName, const txExpandedName& aMode, + double aPrio); TX_DECL_TOPLEVELITEM - nsAutoPtr mMatch; + mozilla::UniquePtr mMatch; txExpandedName mName; txExpandedName mMode; double mPrio; @@ -104,13 +105,13 @@ class txTemplateItem : public txInstructionContainer { // xsl:variable at top level class txVariableItem : public txInstructionContainer { public: - txVariableItem(const txExpandedName& aName, nsAutoPtr&& aValue, + txVariableItem(const txExpandedName& aName, mozilla::UniquePtr&& aValue, bool aIsParam); TX_DECL_TOPLEVELITEM txExpandedName mName; - nsAutoPtr mValue; + mozilla::UniquePtr mValue; bool mIsParam; }; diff --git a/dom/xslt/xslt/txUnknownHandler.cpp b/dom/xslt/xslt/txUnknownHandler.cpp index 93361fad948a..5585bbaefa57 100644 --- a/dom/xslt/xslt/txUnknownHandler.cpp +++ b/dom/xslt/xslt/txUnknownHandler.cpp @@ -152,7 +152,7 @@ nsresult txUnknownHandler::createHandlerAndFlush(bool aHTMLRoot, format.mMethod = aHTMLRoot ? eHTMLOutput : eXMLOutput; } - nsAutoPtr handler; + UniquePtr handler; nsresult rv = mEs->mOutputHandlerFactory->createHandlerWith( &format, aName, aNsID, getter_Transfers(handler)); NS_ENSURE_SUCCESS(rv, rv); @@ -169,6 +169,6 @@ nsresult txUnknownHandler::createHandlerAndFlush(bool aHTMLRoot, // Let go of out buffer as soon as we're done flushing it, we're not going // to need it anymore from this point on (all hooks get forwarded to // mEs->mResultHandler. - nsAutoPtr buffer(std::move(mBuffer)); + UniquePtr buffer(std::move(mBuffer)); return buffer->flushToHandler(mEs->mResultHandler); } diff --git a/dom/xslt/xslt/txXPathResultComparator.cpp b/dom/xslt/xslt/txXPathResultComparator.cpp index ac08c348b03a..0ed80c0224c5 100644 --- a/dom/xslt/xslt/txXPathResultComparator.cpp +++ b/dom/xslt/xslt/txXPathResultComparator.cpp @@ -48,7 +48,7 @@ nsresult txResultStringComparator::init(const nsString& aLanguage) { nsresult txResultStringComparator::createSortableValue(Expr* aExpr, txIEvalContext* aContext, txObject*& aResult) { - nsAutoPtr val(new StringValue); + UniquePtr val(new StringValue); if (!val) { return NS_ERROR_OUT_OF_MEMORY; } @@ -147,7 +147,7 @@ txResultNumberComparator::txResultNumberComparator(bool aAscending) { nsresult txResultNumberComparator::createSortableValue(Expr* aExpr, txIEvalContext* aContext, txObject*& aResult) { - nsAutoPtr numval(new NumberValue); + UniquePtr numval(new NumberValue); if (!numval) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/dom/xslt/xslt/txXSLTNumber.cpp b/dom/xslt/xslt/txXSLTNumber.cpp index 2bb10fc405fc..81959536d72d 100644 --- a/dom/xslt/xslt/txXSLTNumber.cpp +++ b/dom/xslt/xslt/txXSLTNumber.cpp @@ -103,7 +103,7 @@ nsresult txXSLTNumber::getValueList(Expr* aValueExpr, txPattern* aCountPattern, // Otherwise use count/from/level txPattern* countPattern = aCountPattern; - nsAutoPtr newCountPattern; + UniquePtr newCountPattern; const txXPathNode& currNode = aContext->getContextNode(); // Parse count- and from-attributes diff --git a/dom/xslt/xslt/txXSLTPatterns.cpp b/dom/xslt/xslt/txXSLTPatterns.cpp index 192babc883c0..5e9b079ee9d7 100644 --- a/dom/xslt/xslt/txXSLTPatterns.cpp +++ b/dom/xslt/xslt/txXSLTPatterns.cpp @@ -330,7 +330,7 @@ void txIdPattern::toString(nsAString& aDest) { nsresult txKeyPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext, bool& aMatched) { txExecutionState* es = (txExecutionState*)aContext->getPrivateContext(); - nsAutoPtr contextDoc(txXPathNodeUtils::getOwnerDocument(aNode)); + UniquePtr contextDoc(txXPathNodeUtils::getOwnerDocument(aNode)); NS_ENSURE_TRUE(contextDoc, NS_ERROR_FAILURE); RefPtr nodes; diff --git a/dom/xslt/xslt/txXSLTPatterns.h b/dom/xslt/xslt/txXSLTPatterns.h index 7bdde5d08803..8a77a8c64488 100644 --- a/dom/xslt/xslt/txXSLTPatterns.h +++ b/dom/xslt/xslt/txXSLTPatterns.h @@ -125,7 +125,7 @@ class txLocPathPattern : public txPattern { private: class Step { public: - nsAutoPtr pattern; + mozilla::UniquePtr pattern; bool isChild; }; @@ -196,7 +196,7 @@ class txStepPattern : public txPattern, public PredicateList { } private: - nsAutoPtr mNodeTest; + mozilla::UniquePtr mNodeTest; bool mIsAttr; };