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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 (CJS_Document*)FXJS_GetPrivate(GetIsolate(), pThis)) { | 203 (CJS_Document*)FXJS_GetPrivate(GetIsolate(), pThis)) { |
204 if (Document* pDocument = (Document*)pJSDocument->GetEmbedObject()) | 204 if (Document* pDocument = (Document*)pJSDocument->GetEmbedObject()) |
205 pDocument->AttachDoc(pReaderDoc); | 205 pDocument->AttachDoc(pReaderDoc); |
206 } | 206 } |
207 } | 207 } |
208 } | 208 } |
209 } | 209 } |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
| 213 CPDFSDK_Document* CJS_Runtime::GetReaderDocument() { |
| 214 return m_pDocument; |
| 215 } |
| 216 |
213 int CJS_Runtime::Execute(const CFX_WideString& script, CFX_WideString* info) { | 217 int CJS_Runtime::Execute(const CFX_WideString& script, CFX_WideString* info) { |
214 FXJSErr error = {}; | 218 FXJSErr error = {}; |
215 int nRet = FXJS_Execute(m_isolate, script, &error); | 219 int nRet = FXJS_Execute(m_isolate, script, &error); |
216 if (nRet < 0) { | 220 if (nRet < 0) { |
217 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, |
218 error.message); | 222 error.message); |
219 } | 223 } |
220 return nRet; | 224 return nRet; |
221 } | 225 } |
222 | 226 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 // v8::Local<v8::Context>::New(GetIsolate(), m_context); | 308 // v8::Local<v8::Context>::New(GetIsolate(), m_context); |
305 v8::Local<v8::Value> propvalue = | 309 v8::Local<v8::Value> propvalue = |
306 v8::Local<v8::Value>::New(GetIsolate(), pValue->DirectGetValue()); | 310 v8::Local<v8::Value>::New(GetIsolate(), pValue->DirectGetValue()); |
307 context->Global()->Set( | 311 context->Global()->Set( |
308 v8::String::NewFromUtf8(pIsolate, name, v8::String::kNormalString, | 312 v8::String::NewFromUtf8(pIsolate, name, v8::String::kNormalString, |
309 utf8Name.GetLength()), | 313 utf8Name.GetLength()), |
310 propvalue); | 314 propvalue); |
311 return TRUE; | 315 return TRUE; |
312 } | 316 } |
313 #endif | 317 #endif |
OLD | NEW |