Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: fpdfsdk/src/jsapi/fxjs_v8.cpp

Issue 971013002: Merge to XFA: Return error information from pdfium to JS. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/javascript/resource.cpp ('k') | testing/resources/javascript/document_props.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 453
454 for(int i=0; i<pArray->GetSize(); i++) 454 for(int i=0; i<pArray->GetSize(); i++)
455 { 455 {
456 CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(i); 456 CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(i);
457 if(FXSYS_wcscmp(pObjDef->objName, pObjName) == 0) 457 if(FXSYS_wcscmp(pObjDef->objName, pObjName) == 0)
458 return i; 458 return i;
459 } 459 }
460 return -1; 460 return -1;
461 } 461 }
462 462
463 void JS_Error(v8::Value * pError,const wchar_t * main,const wchar_t * sub) 463 void JS_Error(v8::Isolate* isolate, const CFX_WideString& message)
464 { 464 {
465 465 // Conversion from pdfium's wchar_t wide-strings to v8's uint16_t
466 // wide-strings isn't handled by v8, so use UTF8 as a common
467 // intermediate format.
468 CFX_ByteString utf8_message = message.UTF8Encode();
469 isolate->ThrowException(v8::String::NewFromUtf8(isolate,
470 utf8_message.c_str()));
466 } 471 }
467 472
468 unsigned JS_CalcHash(const wchar_t* main, unsigned nLen) 473 unsigned JS_CalcHash(const wchar_t* main, unsigned nLen)
469 { 474 {
470 return (unsigned)FX_HashCode_String_GetW((FX_LPCWSTR)main, nLen); 475 return (unsigned)FX_HashCode_String_GetW((FX_LPCWSTR)main, nLen);
471 } 476 }
472 477
473 unsigned JS_CalcHash(const wchar_t* main) 478 unsigned JS_CalcHash(const wchar_t* main)
474 { 479 {
475 return (unsigned)FX_HashCode_String_GetW((FX_LPCWSTR)main, FXSYS_wcslen( main)); 480 return (unsigned)FX_HashCode_String_GetW((FX_LPCWSTR)main, FXSYS_wcslen( main));
(...skipping 11 matching lines...) Expand all
487 return VALUE_NAME_DATE; 492 return VALUE_NAME_DATE;
488 if(pObj->IsObject()) 493 if(pObj->IsObject())
489 return VALUE_NAME_OBJECT; 494 return VALUE_NAME_OBJECT;
490 if(pObj->IsNull()) 495 if(pObj->IsNull())
491 return VALUE_NAME_NULL; 496 return VALUE_NAME_NULL;
492 if(pObj->IsUndefined()) 497 if(pObj->IsUndefined())
493 return VALUE_NAME_UNDEFINED; 498 return VALUE_NAME_UNDEFINED;
494 return NULL; 499 return NULL;
495 500
496 } 501 }
497 const wchar_t* JS_GetClassname(v8::Handle<v8::Object> pObj)
498 {
499 return NULL;
500 }
501
502 void JS_SetPrivate(v8::Handle<v8::Object> pObj, void* p) 502 void JS_SetPrivate(v8::Handle<v8::Object> pObj, void* p)
503 { 503 {
504 JS_SetPrivate(NULL, pObj, p); 504 JS_SetPrivate(NULL, pObj, p);
505 } 505 }
506 506
507 void* JS_GetPrivate(v8::Handle<v8::Object> pObj) 507 void* JS_GetPrivate(v8::Handle<v8::Object> pObj)
508 { 508 {
509 return JS_GetPrivate(NULL,pObj); 509 return JS_GetPrivate(NULL,pObj);
510 } 510 }
511 511
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 { 1037 {
1038 return d != d; 1038 return d != d;
1039 } 1039 }
1040 1040
1041 double JS_LocalTime(double d) 1041 double JS_LocalTime(double d)
1042 { 1042 {
1043 return JS_GetDateTime() + _getDaylightSavingTA(d); 1043 return JS_GetDateTime() + _getDaylightSavingTA(d);
1044 } 1044 }
1045 1045
1046 //JavaScript time implement End. 1046 //JavaScript time implement End.
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/resource.cpp ('k') | testing/resources/javascript/document_props.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698