From 6df59849472958e7de96da6d9fc7b223b7c1f1c3 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 10 Sep 2015 11:56:37 -0700 Subject: Remove some abstractions in fxjs_v8.h. It's too hard to keep mapping between v8 and fx abstractions; the lack of transparency prevents those skilled in v8 only from working on this code. Apparently, the original intention was to confine v8 types to fpdfsdk/{include,src}/jsapi, but fpdfsdk/{include,src}/javascript is already well-polluted with v8 types. Also remove no-op JS_SetThisObj(). Also remove unused ParserParams() [noticed because it was incorrectly passing handles as pointers]. Also remove cast operator from CJS_Runtime and call GetIsolate() explicitly. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1332973002 . --- fpdfsdk/src/javascript/Consts.cpp | 48 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'fpdfsdk/src/javascript/Consts.cpp') diff --git a/fpdfsdk/src/javascript/Consts.cpp b/fpdfsdk/src/javascript/Consts.cpp index 4529f013fe..77cf445d77 100644 --- a/fpdfsdk/src/javascript/Consts.cpp +++ b/fpdfsdk/src/javascript/Consts.cpp @@ -130,28 +130,28 @@ IMPLEMENT_JS_CLASS_CONST(CJS_Zoomtype, zoomtype) /* ------------------------------ CJS_GlobalConsts * ------------------------------ */ -int CJS_GlobalConsts::Init(IJS_Runtime* pRuntime) { - DEFINE_GLOBAL_CONST(pRuntime, IDS_GREATER_THAN, Invalid value +int CJS_GlobalConsts::Init(v8::Isolate* pIsolate) { + DEFINE_GLOBAL_CONST(pIsolate, IDS_GREATER_THAN, Invalid value : must be greater than or equal to % s.); DEFINE_GLOBAL_CONST( - pRuntime, IDS_GT_AND_LT, Invalid value + pIsolate, IDS_GT_AND_LT, Invalid value : must be greater than or equal to % s and less than or equal to % s.); - DEFINE_GLOBAL_CONST(pRuntime, IDS_LESS_THAN, Invalid value + DEFINE_GLOBAL_CONST(pIsolate, IDS_LESS_THAN, Invalid value : must be less than or equal to % s.); - DEFINE_GLOBAL_CONST(pRuntime, IDS_INVALID_MONTH, **Invalid**); - DEFINE_GLOBAL_CONST(pRuntime, IDS_INVALID_DATE, Invalid date / time + DEFINE_GLOBAL_CONST(pIsolate, IDS_INVALID_MONTH, **Invalid**); + DEFINE_GLOBAL_CONST(pIsolate, IDS_INVALID_DATE, Invalid date / time : please ensure that the date / time exists.Field); - DEFINE_GLOBAL_CONST(pRuntime, IDS_INVALID_VALUE, + DEFINE_GLOBAL_CONST(pIsolate, IDS_INVALID_VALUE, The value entered does not match the format of the field); - DEFINE_GLOBAL_CONST(pRuntime, IDS_AM, am); - DEFINE_GLOBAL_CONST(pRuntime, IDS_PM, pm); + DEFINE_GLOBAL_CONST(pIsolate, IDS_AM, am); + DEFINE_GLOBAL_CONST(pIsolate, IDS_PM, pm); DEFINE_GLOBAL_CONST( - pRuntime, IDS_MONTH_INFO, + pIsolate, IDS_MONTH_INFO, January[1] February[2] March[3] April[4] May[5] June[6] July[7] August [8] September[9] October[10] November[11] December[12] Sept[9] Jan [1] Feb[2] Mar[3] Apr[4] Jun[6] Jul[7] Aug[8] Sep[9] Oct[10] Nov [11] Dec[12]); - DEFINE_GLOBAL_CONST(pRuntime, IDS_STARTUP_CONSOLE_MSG, ** ^ _ ^ **); + DEFINE_GLOBAL_CONST(pIsolate, IDS_STARTUP_CONSOLE_MSG, ** ^ _ ^ **); return 0; } @@ -159,11 +159,11 @@ int CJS_GlobalConsts::Init(IJS_Runtime* pRuntime) { /* ------------------------------ CJS_GlobalArrays * ------------------------------ */ -int CJS_GlobalArrays::Init(IJS_Runtime* pRuntime) { +int CJS_GlobalArrays::Init(v8::Isolate* pIsolate) { { const FX_WCHAR* ArrayName = L"RE_NUMBER_ENTRY_DOT_SEP"; const FX_WCHAR* ArrayContent[] = {L"[+-]?\\d*\\.?\\d*"}; - DEFINE_GLOBAL_ARRAY(pRuntime); + DEFINE_GLOBAL_ARRAY(pIsolate); } { @@ -173,14 +173,14 @@ int CJS_GlobalArrays::Init(IJS_Runtime* pRuntime) { L"[+-]?\\.\\d+", /* -.1 */ L"[+-]?\\d+\\." /* -1. */ }; - DEFINE_GLOBAL_ARRAY(pRuntime); + DEFINE_GLOBAL_ARRAY(pIsolate); } { const FX_WCHAR* ArrayName = L"RE_NUMBER_ENTRY_COMMA_SEP"; const FX_WCHAR* ArrayContent[] = {L"[+-]?\\d*,?\\d*"}; - DEFINE_GLOBAL_ARRAY(pRuntime); + DEFINE_GLOBAL_ARRAY(pIsolate); } { @@ -190,31 +190,31 @@ int CJS_GlobalArrays::Init(IJS_Runtime* pRuntime) { L"[+-]?[.,]\\d+", /* -,1 */ L"[+-]?\\d+[.,]" /* -1, */ }; - DEFINE_GLOBAL_ARRAY(pRuntime); + DEFINE_GLOBAL_ARRAY(pIsolate); } { const FX_WCHAR* ArrayName = L"RE_ZIP_ENTRY"; const FX_WCHAR* ArrayContent[] = {L"\\d{0,5}"}; - DEFINE_GLOBAL_ARRAY(pRuntime); + DEFINE_GLOBAL_ARRAY(pIsolate); } { const FX_WCHAR* ArrayName = L"RE_ZIP_COMMIT"; const FX_WCHAR* ArrayContent[] = {L"\\d{5}"}; - DEFINE_GLOBAL_ARRAY(pRuntime); + DEFINE_GLOBAL_ARRAY(pIsolate); } { const FX_WCHAR* ArrayName = L"RE_ZIP4_ENTRY"; const FX_WCHAR* ArrayContent[] = {L"\\d{0,5}(\\.|[- ])?\\d{0,4}"}; - DEFINE_GLOBAL_ARRAY(pRuntime); + DEFINE_GLOBAL_ARRAY(pIsolate); } { const FX_WCHAR* ArrayName = L"RE_ZIP4_COMMIT"; const FX_WCHAR* ArrayContent[] = {L"\\d{5}(\\.|[- ])?\\d{4}"}; - DEFINE_GLOBAL_ARRAY(pRuntime); + DEFINE_GLOBAL_ARRAY(pIsolate); } { @@ -232,7 +232,7 @@ int CJS_GlobalArrays::Init(IJS_Runtime* pRuntime) { */ L"011(\\.|[- \\d])*" /* international */ }; - DEFINE_GLOBAL_ARRAY(pRuntime); + DEFINE_GLOBAL_ARRAY(pIsolate); } { @@ -243,21 +243,21 @@ int CJS_GlobalArrays::Init(IJS_Runtime* pRuntime) { L"\\(\\d{3}\\)(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", /* (408) 555-1234 */ L"011(\\.|[- \\d])*" /* international */ }; - DEFINE_GLOBAL_ARRAY(pRuntime); + DEFINE_GLOBAL_ARRAY(pIsolate); } { const FX_WCHAR* ArrayName = L"RE_SSN_ENTRY"; const FX_WCHAR* ArrayContent[] = { L"\\d{0,3}(\\.|[- ])?\\d{0,2}(\\.|[- ])?\\d{0,4}"}; - DEFINE_GLOBAL_ARRAY(pRuntime); + DEFINE_GLOBAL_ARRAY(pIsolate); } { const FX_WCHAR* ArrayName = L"RE_SSN_COMMIT"; const FX_WCHAR* ArrayContent[] = { L"\\d{3}(\\.|[- ])?\\d{2}(\\.|[- ])?\\d{4}"}; - DEFINE_GLOBAL_ARRAY(pRuntime); + DEFINE_GLOBAL_ARRAY(pIsolate); } return 0; -- cgit v1.2.3