зеркало из 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);
|
||||
mLocalVariables = oldVars;
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
popEvalContext();
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
else {
|
||||
nsAutoPtr<txRtfHandler> rtfHandler(new txRtfHandler);
|
||||
NS_ENSURE_TRUE(rtfHandler, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = pushResultHandler(rtfHandler);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
popEvalContext();
|
||||
return rv;
|
||||
}
|
||||
|
||||
rtfHandler.forget();
|
||||
|
||||
txInstruction* prevInstr = mNextInstruction;
|
||||
// set return to nullptr to stop execution
|
||||
mNextInstruction = nullptr;
|
||||
rv = runTemplate(var->mFirstInstruction);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
popEvalContext();
|
||||
return rv;
|
||||
}
|
||||
|
||||
pushTemplateRule(nullptr, txExpandedName(), nullptr);
|
||||
rv = txXSLTProcessor::execute(*this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
popEvalContext();
|
||||
return rv;
|
||||
}
|
||||
|
||||
popTemplateRule();
|
||||
|
||||
mNextInstruction = prevInstr;
|
||||
rtfHandler = (txRtfHandler*)popResultHandler();
|
||||
rv = rtfHandler->getAsRTF(&aResult);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
popEvalContext();
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
popEvalContext();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче