diff options
author | Jochen Eisinger <jochen@chromium.org> | 2015-08-05 08:55:39 +0200 |
---|---|---|
committer | Jochen Eisinger <jochen@chromium.org> | 2015-08-05 08:55:39 +0200 |
commit | 7ea305f1bd4efc1838fba053e4399358d6765ec7 (patch) | |
tree | 8d3e952fcfa3880dedcfc2064f12fb7c342fd059 | |
parent | 7f6b084fbdde785240f2509ae3617a17937f97ba (diff) | |
download | pdfium-7ea305f1bd4efc1838fba053e4399358d6765ec7.tar.xz |
Don't dispose the isolate if its provided by the embedderchromium/2474
BUG=chromium:515718
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1269783005 .
-rw-r--r-- | fpdfsdk/include/javascript/JS_Runtime.h | 1 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/JS_Runtime.cpp | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h index f4dabf017e..3be0f76549 100644 --- a/fpdfsdk/include/javascript/JS_Runtime.h +++ b/fpdfsdk/include/javascript/JS_Runtime.h @@ -68,6 +68,7 @@ class CJS_Runtime : public IFXJS_Runtime { CJS_FieldEvent* m_pFieldEventPath; v8::Isolate* m_isolate; + bool m_isolateManaged; nonstd::unique_ptr<CJS_ArrayBufferAllocator> m_pArrayBufferAllocator; v8::Global<v8::Context> m_context; }; diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp index 08cd87c768..4ef34a8d20 100644 --- a/fpdfsdk/src/javascript/JS_Runtime.cpp +++ b/fpdfsdk/src/javascript/JS_Runtime.cpp @@ -98,7 +98,8 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) m_pDocument(NULL), m_bBlocking(FALSE), m_pFieldEventPath(NULL), - m_isolate(NULL) { + m_isolate(NULL), + m_isolateManaged(false) { if (m_pApp->GetFormFillInfo()->m_pJsPlatform->version >= 2) { m_isolate = reinterpret_cast<v8::Isolate*>( m_pApp->GetFormFillInfo()->m_pJsPlatform->m_isolate); @@ -109,6 +110,7 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) v8::Isolate::CreateParams params; params.array_buffer_allocator = m_pArrayBufferAllocator.get(); m_isolate = v8::Isolate::New(params); + m_isolateManaged = true; } InitJSObjects(); @@ -133,8 +135,8 @@ CJS_Runtime::~CJS_Runtime() { m_pFieldEventPath = NULL; m_context.Reset(); - // m_isolate->Exit(); - m_isolate->Dispose(); + if (m_isolateManaged) + m_isolate->Dispose(); } FX_BOOL CJS_Runtime::InitJSObjects() { |