diff options
Diffstat (limited to 'fpdfsdk/cpdfsdk_actionhandler.cpp')
-rw-r--r-- | fpdfsdk/cpdfsdk_actionhandler.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/fpdfsdk/cpdfsdk_actionhandler.cpp b/fpdfsdk/cpdfsdk_actionhandler.cpp index d7bcd7f350..5b72082104 100644 --- a/fpdfsdk/cpdfsdk_actionhandler.cpp +++ b/fpdfsdk/cpdfsdk_actionhandler.cpp @@ -539,12 +539,8 @@ void CPDFSDK_ActionHandler::RunScriptForAction( void CPDFSDK_ActionHandler::RunScript(CPDFSDK_FormFillEnvironment* pFormFillEnv, const WideString& script, const RunScriptCallback& cb) { - IJS_Runtime* pRuntime = pFormFillEnv->GetIJSRuntime(); - IJS_EventContext* pContext = pRuntime->NewEventContext(); - - cb(pContext); - + IJS_Runtime::ScopedEventContext pContext(pFormFillEnv->GetIJSRuntime()); + cb(pContext.Get()); pContext->RunScript(script); - pRuntime->ReleaseEventContext(pContext); // TODO(dsinclair): Return error if RunScript returns a IJS_Runtime::JS_Error. } |