summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_engine.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-05 22:33:31 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-05 22:33:31 +0000
commitc22d671728605bc614dc84ec6a42a5647808b30d (patch)
treece4ec68b844414d1ce1f7275181795677b4ca87e /fxjs/cfxjse_engine.cpp
parent7edcf2ce07e87022361a0e00fde27aad738c0621 (diff)
downloadpdfium-c22d671728605bc614dc84ec6a42a5647808b30d.tar.xz
Introduce IJS_Runtime::ScopedEventContext helper class.chromium/3451
This proves that m_EventContextArray is, in fact, a stack. Tidy one function by using AutoRestorer while at it. Change-Id: I319538b4eadcd9ce83319aa73861635dd5eb8c36 Reviewed-on: https://pdfium-review.googlesource.com/33970 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_engine.cpp')
-rw-r--r--fxjs/cfxjse_engine.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index 90fcc312db..2361a64441 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -145,13 +145,10 @@ bool CFXJSE_Engine::RunScript(CXFA_Script::Type eScriptType,
}
AutoRestorer<CXFA_Object*> nodeRestorer(&m_pThisObject);
m_pThisObject = pThisObject;
- CFXJSE_Value* pValue = pThisObject ? GetJSValueFromMap(pThisObject) : nullptr;
-
- IJS_EventContext* ctx = m_pSubordinateRuntime->NewEventContext();
- bool ret = m_JsContext->ExecuteScript(btScript.c_str(), hRetValue, pValue);
- m_pSubordinateRuntime->ReleaseEventContext(ctx);
- return ret;
+ CFXJSE_Value* pValue = pThisObject ? GetJSValueFromMap(pThisObject) : nullptr;
+ IJS_Runtime::ScopedEventContext ctx(m_pSubordinateRuntime.Get());
+ return m_JsContext->ExecuteScript(btScript.c_str(), hRetValue, pValue);
}
bool CFXJSE_Engine::QueryNodeByFlag(CXFA_Node* refNode,