OLD | NEW |
---|---|
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../include/javascript/JavaScript.h" | 7 #include "../../include/javascript/JavaScript.h" |
8 #include "../../include/javascript/IJavaScript.h" | 8 #include "../../include/javascript/IJavaScript.h" |
9 #include "../../include/javascript/JS_EventHandler.h" | 9 #include "../../include/javascript/JS_EventHandler.h" |
10 #include "../../include/javascript/JS_Runtime.h" | 10 #include "../../include/javascript/JS_Runtime.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 | 105 |
106 /* ------------------------------ CJS_Runtime ------------------------------ */ | 106 /* ------------------------------ CJS_Runtime ------------------------------ */ |
107 | 107 |
108 CJS_Runtime::CJS_Runtime(CPDFDoc_Environment * pApp) : | 108 CJS_Runtime::CJS_Runtime(CPDFDoc_Environment * pApp) : |
109 m_pApp(pApp), | 109 m_pApp(pApp), |
110 m_pDocument(NULL), | 110 m_pDocument(NULL), |
111 m_bBlocking(FALSE), | 111 m_bBlocking(FALSE), |
112 m_bRegistered(FALSE), | 112 m_bRegistered(FALSE), |
113 m_pFieldEventPath(NULL) | 113 m_pFieldEventPath(NULL) |
114 { | 114 { |
115 » m_pArrayBufferAllocator.reset(new CJS_ArrayBufferAllocator()); | 115 » if (m_pApp->GetFormFillInfo()->m_pJsPlatform->version == 2) { |
Tom Sepez
2015/07/14 16:22:53
I think we want >= 2 for future compatibility. Als
| |
116 » » m_isolate = m_pApp->GetFormFillInfo()->m_pJsPlatform->m_isolate; | |
117 » } else { | |
118 » » m_pArrayBufferAllocator.reset(new CJS_ArrayBufferAllocator()); | |
116 | 119 |
117 » v8::Isolate::CreateParams params; | 120 » » v8::Isolate::CreateParams params; |
118 » params.array_buffer_allocator = m_pArrayBufferAllocator.get(); | 121 » » params.array_buffer_allocator = m_pArrayBufferAllocator.get(); |
119 » m_isolate = v8::Isolate::New(params); | 122 » » m_isolate = v8::Isolate::New(params); |
123 } | |
120 | 124 |
121 InitJSObjects(); | 125 InitJSObjects(); |
122 | 126 |
123 CJS_Context * pContext = (CJS_Context*)NewContext(); | 127 CJS_Context * pContext = (CJS_Context*)NewContext(); |
124 JS_InitialRuntime(*this, this, pContext, m_context); | 128 JS_InitialRuntime(*this, this, pContext, m_context); |
125 ReleaseContext(pContext); | 129 ReleaseContext(pContext); |
126 } | 130 } |
127 | 131 |
128 CJS_Runtime::~CJS_Runtime() | 132 CJS_Runtime::~CJS_Runtime() |
129 { | 133 { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 { | 336 { |
333 return v8::Local<v8::Context>::New(m_isolate, m_context); | 337 return v8::Local<v8::Context>::New(m_isolate, m_context); |
334 } | 338 } |
335 | 339 |
336 CFX_WideString ChangeObjName(const CFX_WideString& str) | 340 CFX_WideString ChangeObjName(const CFX_WideString& str) |
337 { | 341 { |
338 CFX_WideString sRet = str; | 342 CFX_WideString sRet = str; |
339 sRet.Replace(L"_", L"."); | 343 sRet.Replace(L"_", L"."); |
340 return sRet; | 344 return sRet; |
341 } | 345 } |
OLD | NEW |