diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-06-05 22:33:31 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-05 22:33:31 +0000 |
commit | c22d671728605bc614dc84ec6a42a5647808b30d (patch) | |
tree | ce4ec68b844414d1ce1f7275181795677b4ca87e /fxjs/cjs_app.cpp | |
parent | 7edcf2ce07e87022361a0e00fde27aad738c0621 (diff) | |
download | pdfium-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/cjs_app.cpp')
-rw-r--r-- | fxjs/cjs_app.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fxjs/cjs_app.cpp b/fxjs/cjs_app.cpp index 9ce8dc3e45..3f9244cf66 100644 --- a/fxjs/cjs_app.cpp +++ b/fxjs/cjs_app.cpp @@ -414,12 +414,12 @@ void CJS_App::CancelProc(GlobalTimer* pTimer) { } void CJS_App::RunJsScript(CJS_Runtime* pRuntime, const WideString& wsScript) { - if (!pRuntime->IsBlocking()) { - IJS_EventContext* pContext = pRuntime->NewEventContext(); - pContext->OnExternal_Exec(); - pContext->RunScript(wsScript); - pRuntime->ReleaseEventContext(pContext); - } + if (pRuntime->IsBlocking()) + return; + + IJS_Runtime::ScopedEventContext pContext(pRuntime); + pContext->OnExternal_Exec(); + pContext->RunScript(wsScript); } CJS_Return CJS_App::goBack(CJS_Runtime* pRuntime, |