summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_Runtime.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-03-04 13:43:46 -0800
committerTom Sepez <tsepez@chromium.org>2016-03-04 13:43:46 -0800
commit297b515e3d53095e36991480a194b54ce887757b (patch)
treeb9b6be50cd9264f18df5264fb5fabe3c7e502ba0 /fpdfsdk/src/javascript/JS_Runtime.cpp
parentc91f42a7ec3fdc57c76a9b175914ecfbd24a9a03 (diff)
downloadpdfium-297b515e3d53095e36991480a194b54ce887757b.tar.xz
Re-land "Only place primitive objects on the V8 global template."
This reverts commit 1a35d55dd6b0d1ea1918e2d6a6c25faf599ba168. Prevent handles from being destructed after v8 is gone. BUG=pdfium:419 R=ochang@chromium.org Review URL: https://codereview.chromium.org/1761073006 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_Runtime.cpp')
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index 76221db3f2..88696e5110 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -121,6 +121,7 @@ CJS_Runtime::~CJS_Runtime() {
delete m_ContextArray.GetAt(i);
m_ContextArray.RemoveAll();
+ m_ConstArrays.clear();
FXJS_ReleaseRuntime(GetIsolate(), &m_context, &m_StaticObjects);
m_pApp = NULL;
@@ -256,6 +257,15 @@ v8::Local<v8::Context> CJS_Runtime::NewJSContext() {
return v8::Local<v8::Context>::New(m_isolate, m_context);
}
+void CJS_Runtime::SetConstArray(const CFX_WideString& name,
+ v8::Local<v8::Array> array) {
+ m_ConstArrays[name] = v8::Global<v8::Array>(m_isolate, array);
+}
+
+v8::Local<v8::Array> CJS_Runtime::GetConstArray(const CFX_WideString& name) {
+ return v8::Local<v8::Array>::New(m_isolate, m_ConstArrays[name]);
+}
+
#ifdef PDF_ENABLE_XFA
CFX_WideString ChangeObjName(const CFX_WideString& str) {
CFX_WideString sRet = str;