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