зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1729329 - Mark txStack::push as infallible. r=farre
Differential Revision: https://phabricator.services.mozilla.com/D124666
This commit is contained in:
Родитель
750cd9da88
Коммит
23cac864bb
|
@ -27,10 +27,7 @@ class txStack : private nsTArray<void*> {
|
|||
* @param obj a pointer to the object that is to be added to the
|
||||
* top of this stack.
|
||||
*/
|
||||
inline nsresult push(void* aObject) {
|
||||
AppendElement(aObject);
|
||||
return NS_OK;
|
||||
}
|
||||
inline void push(void* aObject) { AppendElement(aObject); }
|
||||
|
||||
/**
|
||||
* Removes and returns the specified object from the top of this
|
||||
|
|
|
@ -32,28 +32,18 @@ void txResultRecycler::recycle(txAExprResult* aResult) {
|
|||
RefPtr<txResultRecycler> kungFuDeathGrip;
|
||||
aResult->mRecycler.swap(kungFuDeathGrip);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
switch (aResult->getResultType()) {
|
||||
case txAExprResult::STRING: {
|
||||
rv = mStringResults.push(static_cast<StringResult*>(aResult));
|
||||
if (NS_FAILED(rv)) {
|
||||
delete aResult;
|
||||
}
|
||||
mStringResults.push(static_cast<StringResult*>(aResult));
|
||||
return;
|
||||
}
|
||||
case txAExprResult::NODESET: {
|
||||
static_cast<txNodeSet*>(aResult)->clear();
|
||||
rv = mNodeSetResults.push(static_cast<txNodeSet*>(aResult));
|
||||
if (NS_FAILED(rv)) {
|
||||
delete aResult;
|
||||
}
|
||||
mNodeSetResults.push(static_cast<txNodeSet*>(aResult));
|
||||
return;
|
||||
}
|
||||
case txAExprResult::NUMBER: {
|
||||
rv = mNumberResults.push(static_cast<NumberResult*>(aResult));
|
||||
if (NS_FAILED(rv)) {
|
||||
delete aResult;
|
||||
}
|
||||
mNumberResults.push(static_cast<NumberResult*>(aResult));
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
|
|
|
@ -306,9 +306,7 @@ void txExecutionState::receiveError(const nsAString& aMsg, nsresult aRes) {
|
|||
}
|
||||
|
||||
nsresult txExecutionState::pushEvalContext(txIEvalContext* aContext) {
|
||||
nsresult rv = mEvalContextStack.push(mEvalContext);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mEvalContextStack.push(mEvalContext);
|
||||
mEvalContext = aContext;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -333,9 +331,7 @@ bool txExecutionState::popBool() {
|
|||
}
|
||||
|
||||
nsresult txExecutionState::pushResultHandler(txAXMLEventHandler* aHandler) {
|
||||
nsresult rv = mResultHandlerStack.push(mResultHandler);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mResultHandlerStack.push(mResultHandler);
|
||||
mResultHandler = aHandler;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -426,11 +422,8 @@ nsresult txExecutionState::runTemplate(txInstruction* aTemplate) {
|
|||
NS_ENSURE_TRUE(++mRecursionDepth < kMaxRecursionDepth,
|
||||
NS_ERROR_XSLT_BAD_RECURSION);
|
||||
|
||||
nsresult rv = mLocalVarsStack.push(mLocalVariables);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mReturnStack.push(mNextInstruction);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mLocalVarsStack.push(mLocalVariables);
|
||||
mReturnStack.push(mNextInstruction);
|
||||
|
||||
mLocalVariables = nullptr;
|
||||
mNextInstruction = aTemplate;
|
||||
|
|
|
@ -471,8 +471,7 @@ nsresult txMozillaXMLOutput::startElementInternal(nsAtom* aPrefix,
|
|||
|
||||
++mTreeDepth;
|
||||
|
||||
rv = mTableStateStack.push(NS_INT32_TO_PTR(mTableState));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mTableStateStack.push(NS_INT32_TO_PTR(mTableState));
|
||||
|
||||
if (!mCurrentNodeStack.AppendObject(mCurrentNode)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -653,8 +652,7 @@ nsresult txMozillaXMLOutput::startHTMLElement(nsIContent* aElement,
|
|||
return error.StealNSResult();
|
||||
}
|
||||
|
||||
rv = mTableStateStack.push(NS_INT32_TO_PTR(ADDED_TBODY));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mTableStateStack.push(NS_INT32_TO_PTR(ADDED_TBODY));
|
||||
|
||||
if (!mCurrentNodeStack.AppendObject(tbody)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -571,7 +571,8 @@ void txStylesheetCompilerState::popChooseGotoList() {
|
|||
}
|
||||
|
||||
nsresult txStylesheetCompilerState::pushObject(txObject* aObject) {
|
||||
return mObjectStack.push(aObject);
|
||||
mObjectStack.push(aObject);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
txObject* txStylesheetCompilerState::popObject() {
|
||||
|
@ -584,7 +585,8 @@ nsresult txStylesheetCompilerState::pushPtr(void* aPtr, enumStackType aType) {
|
|||
("pushPtr: 0x%x type %u\n", aPtr, aType));
|
||||
#endif
|
||||
mTypeStack.AppendElement(aType);
|
||||
return mOtherStack.push(aPtr);
|
||||
mOtherStack.push(aPtr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void* txStylesheetCompilerState::popPtr(enumStackType aType) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче