Bug 1729329 - Mark txStylesheetCompilerState::pushObject as infallible. r=farre

Differential Revision: https://phabricator.services.mozilla.com/D124673
This commit is contained in:
Peter Van der Beken 2021-09-29 07:24:42 +00:00
Родитель 4bcb6e8918
Коммит 1b9ea56366
3 изменённых файлов: 15 добавлений и 54 удалений

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

@ -1167,11 +1167,7 @@ static nsresult txFnStartApplyTemplates(int32_t aNamespaceID,
mode);
NS_ENSURE_SUCCESS(rv, rv);
instr = MakeUnique<txApplyTemplates>(mode);
rv = aState.pushObject(instr.get());
NS_ENSURE_SUCCESS(rv, rv);
Unused << instr.release();
aState.pushObject(new txApplyTemplates(mode));
UniquePtr<Expr> select;
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, false, aState,
@ -1186,9 +1182,7 @@ static nsresult txFnStartApplyTemplates(int32_t aNamespaceID,
UniquePtr<txPushNewContext> pushcontext(
new txPushNewContext(std::move(select)));
aState.pushSorter(pushcontext.get());
rv = aState.pushObject(pushcontext.release());
NS_ENSURE_SUCCESS(rv, rv);
aState.pushObject(pushcontext.release());
aState.pushHandlerTable(gTxApplyTemplatesHandler);
@ -1246,12 +1240,8 @@ static nsresult txFnStartAttribute(int32_t aNamespaceID, nsAtom* aLocalName,
nspace);
NS_ENSURE_SUCCESS(rv, rv);
instr = MakeUnique<txAttribute>(std::move(name), std::move(nspace),
aState.mElementContext->mMappings);
rv = aState.pushObject(instr.get());
NS_ENSURE_SUCCESS(rv, rv);
Unused << instr.release();
aState.pushObject(new txAttribute(std::move(name), std::move(nspace),
aState.mElementContext->mMappings));
// We need to push the template-handler since the current might be
// the attributeset-handler
@ -1292,11 +1282,7 @@ static nsresult txFnStartCallTemplate(int32_t aNamespaceID, nsAtom* aLocalName,
name);
NS_ENSURE_SUCCESS(rv, rv);
instr = MakeUnique<txCallTemplate>(name);
rv = aState.pushObject(instr.get());
NS_ENSURE_SUCCESS(rv, rv);
Unused << instr.release();
aState.pushObject(new txCallTemplate(name));
aState.pushHandlerTable(gTxCallTemplateHandler);
@ -1634,11 +1620,7 @@ static nsresult txFnStartMessage(int32_t aNamespaceID, nsAtom* aLocalName,
false, aState, term);
NS_ENSURE_SUCCESS(rv, rv);
instr = MakeUnique<txMessage>(term == eTrue);
rv = aState.pushObject(instr.get());
NS_ENSURE_SUCCESS(rv, rv);
Unused << instr.release();
aState.pushObject(new txMessage(term == eTrue));
return NS_OK;
}
@ -1794,10 +1776,7 @@ static nsresult txFnStartParam(int32_t aNamespaceID, nsAtom* aLocalName,
aState.pushHandlerTable(gTxVariableHandler);
}
rv = aState.pushObject(var.get());
NS_ENSURE_SUCCESS(rv, rv);
Unused << var.release();
aState.pushObject(var.release());
return NS_OK;
}
@ -1845,11 +1824,7 @@ static nsresult txFnStartPI(int32_t aNamespaceID, nsAtom* aLocalName,
getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::name, true, aState, name);
NS_ENSURE_SUCCESS(rv, rv);
instr = MakeUnique<txProcessingInstruction>(std::move(name));
rv = aState.pushObject(instr.get());
NS_ENSURE_SUCCESS(rv, rv);
Unused << instr.release();
aState.pushObject(new txProcessingInstruction(std::move(name)));
return NS_OK;
}
@ -2023,10 +1998,7 @@ static nsresult txFnStartVariable(int32_t aNamespaceID, nsAtom* aLocalName,
aState.pushHandlerTable(gTxVariableHandler);
}
rv = aState.pushObject(var.get());
NS_ENSURE_SUCCESS(rv, rv);
Unused << var.release();
aState.pushObject(var.release());
return NS_OK;
}
@ -2152,10 +2124,7 @@ static nsresult txFnStartWithParam(int32_t aNamespaceID, nsAtom* aLocalName,
aState.pushHandlerTable(gTxVariableHandler);
}
rv = aState.pushObject(var.get());
NS_ENSURE_SUCCESS(rv, rv);
Unused << var.release();
aState.pushObject(var.release());
return NS_OK;
}

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

@ -416,10 +416,7 @@ nsresult txStylesheetCompiler::ensureNewElementContext() {
}
UniquePtr<txElementContext> context(new txElementContext(*mElementContext));
nsresult rv = pushObject(mElementContext.get());
NS_ENSURE_SUCCESS(rv, rv);
Unused << mElementContext.release();
pushObject(mElementContext.release());
mElementContext = std::move(context);
return NS_OK;
@ -511,8 +508,7 @@ nsresult txStylesheetCompilerState::init(const nsAString& aStylesheetURI,
NS_ENSURE_TRUE(mElementContext->mMappings, NS_ERROR_OUT_OF_MEMORY);
// Push the "old" txElementContext
rv = pushObject(0);
NS_ENSURE_SUCCESS(rv, rv);
pushObject(nullptr);
return NS_OK;
}
@ -547,10 +543,7 @@ void txStylesheetCompilerState::popSorter() {
}
nsresult txStylesheetCompilerState::pushChooseGotoList() {
nsresult rv = pushObject(mChooseGotoList.get());
NS_ENSURE_SUCCESS(rv, rv);
Unused << mChooseGotoList.release();
pushObject(mChooseGotoList.release());
mChooseGotoList = MakeUnique<txList>();
return NS_OK;
@ -561,9 +554,8 @@ void txStylesheetCompilerState::popChooseGotoList() {
mChooseGotoList = WrapUnique(static_cast<txList*>(popObject()));
}
nsresult txStylesheetCompilerState::pushObject(txObject* aObject) {
void txStylesheetCompilerState::pushObject(txObject* aObject) {
mObjectStack.push(aObject);
return NS_OK;
}
txObject* txStylesheetCompilerState::popObject() {

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

@ -93,7 +93,7 @@ class txStylesheetCompilerState : public txIParseContext {
void popSorter();
nsresult pushChooseGotoList();
void popChooseGotoList();
nsresult pushObject(txObject* aObject);
void pushObject(txObject* aObject);
txObject* popObject();
void pushPtr(void* aPtr, enumStackType aType);
void* popPtr(enumStackType aType);