зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1311687 - Pop eval context on early returns. r=peterv
Make sure the eval context stack is cleaned up on failure. MozReview-Commit-ID: AUNen1xt9He --HG-- extra : rebase_source : 405afaf2e3e77a2fb4761440f837645cf5a8c18e
This commit is contained in:
Родитель
6dabfdba6b
Коммит
c839abc03c
|
@ -227,33 +227,47 @@ txExecutionState::getVariable(int32_t aNamespace, nsIAtom* aLName,
|
||||||
rv = var->mExpr->evaluate(getEvalContext(), &aResult);
|
rv = var->mExpr->evaluate(getEvalContext(), &aResult);
|
||||||
mLocalVariables = oldVars;
|
mLocalVariables = oldVars;
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (NS_FAILED(rv)) {
|
||||||
|
popEvalContext();
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nsAutoPtr<txRtfHandler> rtfHandler(new txRtfHandler);
|
nsAutoPtr<txRtfHandler> rtfHandler(new txRtfHandler);
|
||||||
NS_ENSURE_TRUE(rtfHandler, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
rv = pushResultHandler(rtfHandler);
|
rv = pushResultHandler(rtfHandler);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (NS_FAILED(rv)) {
|
||||||
|
popEvalContext();
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
rtfHandler.forget();
|
rtfHandler.forget();
|
||||||
|
|
||||||
txInstruction* prevInstr = mNextInstruction;
|
txInstruction* prevInstr = mNextInstruction;
|
||||||
// set return to nullptr to stop execution
|
// set return to nullptr to stop execution
|
||||||
mNextInstruction = nullptr;
|
mNextInstruction = nullptr;
|
||||||
rv = runTemplate(var->mFirstInstruction);
|
rv = runTemplate(var->mFirstInstruction);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (NS_FAILED(rv)) {
|
||||||
|
popEvalContext();
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
pushTemplateRule(nullptr, txExpandedName(), nullptr);
|
pushTemplateRule(nullptr, txExpandedName(), nullptr);
|
||||||
rv = txXSLTProcessor::execute(*this);
|
rv = txXSLTProcessor::execute(*this);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (NS_FAILED(rv)) {
|
||||||
|
popEvalContext();
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
popTemplateRule();
|
popTemplateRule();
|
||||||
|
|
||||||
mNextInstruction = prevInstr;
|
mNextInstruction = prevInstr;
|
||||||
rtfHandler = (txRtfHandler*)popResultHandler();
|
rtfHandler = (txRtfHandler*)popResultHandler();
|
||||||
rv = rtfHandler->getAsRTF(&aResult);
|
rv = rtfHandler->getAsRTF(&aResult);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (NS_FAILED(rv)) {
|
||||||
|
popEvalContext();
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
popEvalContext();
|
popEvalContext();
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче