summaryrefslogtreecommitdiff
path: root/fxjs/cjs_app.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/cjs_app.cpp')
-rw-r--r--fxjs/cjs_app.cpp12
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,