From c22d671728605bc614dc84ec6a42a5647808b30d Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 5 Jun 2018 22:33:31 +0000 Subject: Introduce IJS_Runtime::ScopedEventContext helper class. 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 Commit-Queue: Tom Sepez --- fxjs/cjs_app.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'fxjs/cjs_app.cpp') 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, -- cgit v1.2.3