| 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/IJavaScript.h" | 7 #include "../../include/javascript/IJavaScript.h" |
| 8 #include "../../include/javascript/JS_Context.h" | 8 #include "../../include/javascript/JS_Context.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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 ASSERT(m_pEventHandler->IsValid()); | 49 ASSERT(m_pEventHandler->IsValid()); |
| 50 if (!m_pRuntime->AddEventToLoop(m_pEventHandler->TargetName(), | 50 if (!m_pRuntime->AddEventToLoop(m_pEventHandler->TargetName(), |
| 51 m_pEventHandler->EventType())) { | 51 m_pEventHandler->EventType())) { |
| 52 info = JSGetStringFromID(this, IDS_STRING_JSEVENT); | 52 info = JSGetStringFromID(this, IDS_STRING_JSEVENT); |
| 53 return FALSE; | 53 return FALSE; |
| 54 } | 54 } |
| 55 | 55 |
| 56 FXJSErr error = {NULL, NULL, 0}; | 56 FXJSErr error = {NULL, NULL, 0}; |
| 57 int nRet = 0; | 57 int nRet = 0; |
| 58 if (script.GetLength() > 0) { | 58 if (script.GetLength() > 0) { |
| 59 nRet = JS_Execute(*m_pRuntime, this, script.c_str(), script.GetLength(), | 59 nRet = JS_Execute(m_pRuntime->GetIsolate(), this, script.c_str(), |
| 60 &error); | 60 script.GetLength(), &error); |
| 61 } | 61 } |
| 62 | 62 |
| 63 if (nRet < 0) { | 63 if (nRet < 0) { |
| 64 CFX_WideString sLine; | 64 CFX_WideString sLine; |
| 65 sLine.Format(L"[ Line: %05d { %s } ] : %s", error.linnum - 1, error.srcline, | 65 sLine.Format(L"[ Line: %05d { %s } ] : %s", error.linnum - 1, error.srcline, |
| 66 error.message); | 66 error.message); |
| 67 info += sLine; | 67 info += sLine; |
| 68 } else { | 68 } else { |
| 69 info = JSGetStringFromID(this, IDS_STRING_RUN); | 69 info = JSGetStringFromID(this, IDS_STRING_RUN); |
| 70 } | 70 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 280 } |
| 281 | 281 |
| 282 void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) { | 282 void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) { |
| 283 m_pEventHandler->OnBatchExec(pTarget); | 283 m_pEventHandler->OnBatchExec(pTarget); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget, | 286 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget, |
| 287 const CFX_WideString& strTargetName) { | 287 const CFX_WideString& strTargetName) { |
| 288 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName); | 288 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName); |
| 289 } | 289 } |
| OLD | NEW |