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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 (CJS_Document*)FXJS_GetPrivate(GetIsolate(), pThis)) { | 207 (CJS_Document*)FXJS_GetPrivate(GetIsolate(), pThis)) { |
208 if (Document* pDocument = (Document*)pJSDocument->GetEmbedObject()) | 208 if (Document* pDocument = (Document*)pJSDocument->GetEmbedObject()) |
209 pDocument->AttachDoc(pReaderDoc); | 209 pDocument->AttachDoc(pReaderDoc); |
210 } | 210 } |
211 } | 211 } |
212 } | 212 } |
213 } | 213 } |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 int CJS_Runtime::Execute(IJS_Context* cc, | 217 int CJS_Runtime::Execute(const CFX_WideString& script, CFX_WideString* info) { |
218 const wchar_t* script, | |
219 CFX_WideString* info) { | |
220 FXJSErr error = {}; | 218 FXJSErr error = {}; |
221 int nRet = FXJS_Execute(m_isolate, cc, script, &error); | 219 int nRet = FXJS_Execute(m_isolate, script, &error); |
222 if (nRet < 0) { | 220 if (nRet < 0) { |
223 info->Format(L"[ Line: %05d { %s } ] : %s", error.linnum - 1, error.srcline, | 221 info->Format(L"[ Line: %05d { %s } ] : %s", error.linnum - 1, error.srcline, |
224 error.message); | 222 error.message); |
225 } | 223 } |
226 return nRet; | 224 return nRet; |
227 } | 225 } |
228 | 226 |
229 bool CJS_Runtime::AddEventToSet(const FieldEvent& event) { | 227 bool CJS_Runtime::AddEventToSet(const FieldEvent& event) { |
230 return m_FieldEventSet.insert(event).second; | 228 return m_FieldEventSet.insert(event).second; |
231 } | 229 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 #endif | 313 #endif |
316 void CJS_Runtime::AddObserver(Observer* observer) { | 314 void CJS_Runtime::AddObserver(Observer* observer) { |
317 ASSERT(!pdfium::ContainsKey(m_observers, observer)); | 315 ASSERT(!pdfium::ContainsKey(m_observers, observer)); |
318 m_observers.insert(observer); | 316 m_observers.insert(observer); |
319 } | 317 } |
320 | 318 |
321 void CJS_Runtime::RemoveObserver(Observer* observer) { | 319 void CJS_Runtime::RemoveObserver(Observer* observer) { |
322 ASSERT(pdfium::ContainsKey(m_observers, observer)); | 320 ASSERT(pdfium::ContainsKey(m_observers, observer)); |
323 m_observers.erase(observer); | 321 m_observers.erase(observer); |
324 } | 322 } |
OLD | NEW |