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 "fpdfsdk/javascript/cjs_runtime.h" | 7 #include "fpdfsdk/javascript/cjs_runtime.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 (CJS_Document*)FXJS_GetPrivate(GetIsolate(), pThis)) { | 214 (CJS_Document*)FXJS_GetPrivate(GetIsolate(), pThis)) { |
215 if (Document* pDocument = (Document*)pJSDocument->GetEmbedObject()) | 215 if (Document* pDocument = (Document*)pJSDocument->GetEmbedObject()) |
216 pDocument->AttachDoc(pReaderDoc); | 216 pDocument->AttachDoc(pReaderDoc); |
217 } | 217 } |
218 } | 218 } |
219 } | 219 } |
220 } | 220 } |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 int CJS_Runtime::Execute(IJS_Context* cc, | 224 int CJS_Runtime::Execute(const CFX_WideString script, CFX_WideString* info) { |
225 const wchar_t* script, | |
226 CFX_WideString* info) { | |
227 FXJSErr error = {}; | 225 FXJSErr error = {}; |
228 int nRet = FXJS_Execute(m_isolate, cc, script, &error); | 226 int nRet = FXJS_Execute(m_isolate, script, &error); |
229 if (nRet < 0) { | 227 if (nRet < 0) { |
230 info->Format(L"[ Line: %05d { %s } ] : %s", error.linnum - 1, error.srcline, | 228 info->Format(L"[ Line: %05d { %s } ] : %s", error.linnum - 1, error.srcline, |
231 error.message); | 229 error.message); |
232 } | 230 } |
233 return nRet; | 231 return nRet; |
234 } | 232 } |
235 | 233 |
236 bool CJS_Runtime::AddEventToSet(const FieldEvent& event) { | 234 bool CJS_Runtime::AddEventToSet(const FieldEvent& event) { |
237 return m_FieldEventSet.insert(event).second; | 235 return m_FieldEventSet.insert(event).second; |
238 } | 236 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 #endif | 322 #endif |
325 void CJS_Runtime::AddObserver(Observer* observer) { | 323 void CJS_Runtime::AddObserver(Observer* observer) { |
326 ASSERT(!pdfium::ContainsKey(m_observers, observer)); | 324 ASSERT(!pdfium::ContainsKey(m_observers, observer)); |
327 m_observers.insert(observer); | 325 m_observers.insert(observer); |
328 } | 326 } |
329 | 327 |
330 void CJS_Runtime::RemoveObserver(Observer* observer) { | 328 void CJS_Runtime::RemoveObserver(Observer* observer) { |
331 ASSERT(pdfium::ContainsKey(m_observers, observer)); | 329 ASSERT(pdfium::ContainsKey(m_observers, observer)); |
332 m_observers.erase(observer); | 330 m_observers.erase(observer); |
333 } | 331 } |
OLD | NEW |