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 "JS_Context.h" | 7 #include "JS_Context.h" |
8 | 8 |
9 #include "JS_EventHandler.h" | 9 #include "JS_EventHandler.h" |
10 #include "JS_Runtime.h" | 10 #include "JS_Runtime.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 CPDFDoc_Environment* CJS_Context::GetReaderApp() { | 29 CPDFDoc_Environment* CJS_Context::GetReaderApp() { |
30 ASSERT(m_pRuntime != NULL); | 30 ASSERT(m_pRuntime != NULL); |
31 | 31 |
32 return m_pRuntime->GetReaderApp(); | 32 return m_pRuntime->GetReaderApp(); |
33 } | 33 } |
34 | 34 |
35 FX_BOOL CJS_Context::RunScript(const CFX_WideString& script, | 35 FX_BOOL CJS_Context::RunScript(const CFX_WideString& script, |
36 CFX_WideString* info) { | 36 CFX_WideString* info) { |
37 v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate()); | 37 v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate()); |
| 38 #ifdef PDF_ENABLE_XFA |
38 v8::Locker locker(m_pRuntime->GetIsolate()); | 39 v8::Locker locker(m_pRuntime->GetIsolate()); |
| 40 #endif |
39 v8::HandleScope handle_scope(m_pRuntime->GetIsolate()); | 41 v8::HandleScope handle_scope(m_pRuntime->GetIsolate()); |
40 v8::Local<v8::Context> context = m_pRuntime->NewJSContext(); | 42 v8::Local<v8::Context> context = m_pRuntime->NewJSContext(); |
41 v8::Context::Scope context_scope(context); | 43 v8::Context::Scope context_scope(context); |
42 | 44 |
43 if (m_bBusy) { | 45 if (m_bBusy) { |
44 *info = JSGetStringFromID(this, IDS_STRING_JSBUSY); | 46 *info = JSGetStringFromID(this, IDS_STRING_JSBUSY); |
45 return FALSE; | 47 return FALSE; |
46 } | 48 } |
47 m_bBusy = TRUE; | 49 m_bBusy = TRUE; |
48 | 50 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } | 277 } |
276 | 278 |
277 void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) { | 279 void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) { |
278 m_pEventHandler->OnBatchExec(pTarget); | 280 m_pEventHandler->OnBatchExec(pTarget); |
279 } | 281 } |
280 | 282 |
281 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget, | 283 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget, |
282 const CFX_WideString& strTargetName) { | 284 const CFX_WideString& strTargetName) { |
283 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName); | 285 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName); |
284 } | 286 } |
OLD | NEW |