diff options
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/include/jsapi/fxjs_v8.h | 3 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/JS_Runtime.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/src/jsapi/fxjs_v8.cpp | 4 |
3 files changed, 10 insertions, 1 deletions
diff --git a/fpdfsdk/include/jsapi/fxjs_v8.h b/fpdfsdk/include/jsapi/fxjs_v8.h index f4f9d46852..d3cd4ebe6e 100644 --- a/fpdfsdk/include/jsapi/fxjs_v8.h +++ b/fpdfsdk/include/jsapi/fxjs_v8.h @@ -78,6 +78,9 @@ void FXJS_Release(); // created. bool FXJS_GetIsolate(v8::Isolate** pResultIsolate); +// Get the global isolate's ref count. +size_t FXJS_GlobalIsolateRefCount(); + // Call before making FXJS_Define* calls. Resources allocated here are cleared // as part of FXJS_ReleaseRuntime(). void FXJS_PrepareIsolate(v8::Isolate* pIsolate); diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp index f97b454993..a449a142ac 100644 --- a/fpdfsdk/src/javascript/JS_Runtime.cpp +++ b/fpdfsdk/src/javascript/JS_Runtime.cpp @@ -70,7 +70,9 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) return; } - DefineJSObjects(); + if (m_isolateManaged || FXJS_GlobalIsolateRefCount() == 0) + DefineJSObjects(); + CPDFXFA_App::GetInstance()->SetJavaScriptInitialized(TRUE); CJS_Context* pContext = (CJS_Context*)NewContext(); diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp index eae1bb414a..80def30f96 100644 --- a/fpdfsdk/src/jsapi/fxjs_v8.cpp +++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp @@ -158,6 +158,10 @@ bool FXJS_GetIsolate(v8::Isolate** pResultIsolate) { return true; } +size_t FXJS_GlobalIsolateRefCount() { + return g_isolate_ref_count; +} + // static void FXJS_PerIsolateData::SetUp(v8::Isolate* pIsolate) { if (!pIsolate->GetData(g_embedderDataSlot)) |