| 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 "../../../core/include/fxcrt/fx_basic.h" | 7 #include "../../../core/include/fxcrt/fx_basic.h" |
| 8 #include "../../../core/include/fxcrt/fx_ext.h" | 8 #include "../../../core/include/fxcrt/fx_ext.h" |
| 9 #include "../../include/jsapi/fxjs_v8.h" | 9 #include "../../include/jsapi/fxjs_v8.h" |
| 10 #include "../../include/fsdk_define.h" | 10 #include "../../include/fsdk_define.h" |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 450 |
| 451 for(int i=0; i<pArray->GetSize(); i++) | 451 for(int i=0; i<pArray->GetSize(); i++) |
| 452 { | 452 { |
| 453 CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(i); | 453 CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(i); |
| 454 if(FXSYS_wcscmp(pObjDef->objName, pObjName) == 0) | 454 if(FXSYS_wcscmp(pObjDef->objName, pObjName) == 0) |
| 455 return i; | 455 return i; |
| 456 } | 456 } |
| 457 return -1; | 457 return -1; |
| 458 } | 458 } |
| 459 | 459 |
| 460 void JS_Error(v8::Value * pError,const wchar_t * main,const wchar_t * sub) | 460 void JS_Error(v8::Isolate* isolate, const CFX_WideString& message) |
| 461 { | 461 { |
| 462 | 462 // Conversion from pdfium's wchar_t wide-strings to v8's uint16_t |
| 463 // wide-strings isn't handled by v8, so use UTF8 as a common |
| 464 // intermediate format. |
| 465 CFX_ByteString utf8_message = message.UTF8Encode(); |
| 466 isolate->ThrowException(v8::String::NewFromUtf8(isolate, |
| 467 utf8_message.c_str())); |
| 463 } | 468 } |
| 464 | 469 |
| 465 unsigned JS_CalcHash(const wchar_t* main, unsigned nLen) | 470 unsigned JS_CalcHash(const wchar_t* main, unsigned nLen) |
| 466 { | 471 { |
| 467 return (unsigned)FX_HashCode_String_GetW(main, nLen); | 472 return (unsigned)FX_HashCode_String_GetW(main, nLen); |
| 468 } | 473 } |
| 469 | 474 |
| 470 unsigned JS_CalcHash(const wchar_t* main) | 475 unsigned JS_CalcHash(const wchar_t* main) |
| 471 { | 476 { |
| 472 return (unsigned)FX_HashCode_String_GetW(main, FXSYS_wcslen(main)); | 477 return (unsigned)FX_HashCode_String_GetW(main, FXSYS_wcslen(main)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 484 return VALUE_NAME_DATE; | 489 return VALUE_NAME_DATE; |
| 485 if(pObj->IsObject()) | 490 if(pObj->IsObject()) |
| 486 return VALUE_NAME_OBJECT; | 491 return VALUE_NAME_OBJECT; |
| 487 if(pObj->IsNull()) | 492 if(pObj->IsNull()) |
| 488 return VALUE_NAME_NULL; | 493 return VALUE_NAME_NULL; |
| 489 if(pObj->IsUndefined()) | 494 if(pObj->IsUndefined()) |
| 490 return VALUE_NAME_UNDEFINED; | 495 return VALUE_NAME_UNDEFINED; |
| 491 return NULL; | 496 return NULL; |
| 492 | 497 |
| 493 } | 498 } |
| 494 const wchar_t* JS_GetClassname(v8::Handle<v8::Object> pObj) | |
| 495 { | |
| 496 return NULL; | |
| 497 } | |
| 498 | |
| 499 void JS_SetPrivate(v8::Handle<v8::Object> pObj, void* p) | 499 void JS_SetPrivate(v8::Handle<v8::Object> pObj, void* p) |
| 500 { | 500 { |
| 501 JS_SetPrivate(NULL, pObj, p); | 501 JS_SetPrivate(NULL, pObj, p); |
| 502 } | 502 } |
| 503 | 503 |
| 504 void* JS_GetPrivate(v8::Handle<v8::Object> pObj) | 504 void* JS_GetPrivate(v8::Handle<v8::Object> pObj) |
| 505 { | 505 { |
| 506 return JS_GetPrivate(NULL,pObj); | 506 return JS_GetPrivate(NULL,pObj); |
| 507 } | 507 } |
| 508 | 508 |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 { | 1034 { |
| 1035 return d != d; | 1035 return d != d; |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 double JS_LocalTime(double d) | 1038 double JS_LocalTime(double d) |
| 1039 { | 1039 { |
| 1040 return JS_GetDateTime() + _getDaylightSavingTA(d); | 1040 return JS_GetDateTime() + _getDaylightSavingTA(d); |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 //JavaScript time implement End. | 1043 //JavaScript time implement End. |
| OLD | NEW |