summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_Runtime.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-10-04 20:40:15 -0700
committerLei Zhang <thestig@chromium.org>2015-10-04 20:40:15 -0700
commit7dfe5929282cb6d78d7b5e32e1d72e9db99d3066 (patch)
tree0cfd7321bafd3bf377435f1c29f69fe254f09965 /fpdfsdk/src/javascript/JS_Runtime.cpp
parent794c9b67d3d519342aa7e15052766f7d4a99f551 (diff)
downloadpdfium-7dfe5929282cb6d78d7b5e32e1d72e9db99d3066.tar.xz
Only call DefineJSObjects() once for the global V8 isolate.
BUG=539106 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1386823002 .
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);