summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_Runtime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/javascript/JS_Runtime.cpp')
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index 4c502a7b75..707551adbe 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -45,7 +45,8 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
FXJS_Initialize(embedderDataSlot, pExternalIsolate);
}
m_isolateManaged = FXJS_GetIsolate(&m_isolate);
- DefineJSObjects();
+ if (m_isolateManaged || FXJS_GlobalIsolateRefCount() == 0)
+ DefineJSObjects();
CJS_Context* pContext = (CJS_Context*)NewContext();
FXJS_InitializeRuntime(GetIsolate(), this, pContext, m_context);