| 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 #ifndef FPDFSDK_JAVASCRIPT_JS_DEFINE_H_ | 7 #ifndef FPDFSDK_JAVASCRIPT_JS_DEFINE_H_ |
| 8 #define FPDFSDK_JAVASCRIPT_JS_DEFINE_H_ | 8 #define FPDFSDK_JAVASCRIPT_JS_DEFINE_H_ |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 ; // NOLINT | 71 ; // NOLINT |
| 72 | 72 |
| 73 template <class C, | 73 template <class C, |
| 74 FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)> | 74 FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)> |
| 75 void JSPropGetter(const char* prop_name_string, | 75 void JSPropGetter(const char* prop_name_string, |
| 76 const char* class_name_string, | 76 const char* class_name_string, |
| 77 v8::Local<v8::String> property, | 77 v8::Local<v8::String> property, |
| 78 const v8::PropertyCallbackInfo<v8::Value>& info) { | 78 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 79 v8::Isolate* isolate = info.GetIsolate(); | 79 v8::Isolate* isolate = info.GetIsolate(); |
| 80 CJS_Runtime* pRuntime = | 80 CJS_Runtime* pRuntime = |
| 81 static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(isolate)); | 81 static_cast<CJS_Runtime*>(FXJS_GetCurrentEngineFromIsolate(isolate)); |
| 82 if (!pRuntime) | 82 if (!pRuntime) |
| 83 return; | 83 return; |
| 84 IJS_Context* pContext = pRuntime->GetCurrentContext(); | 84 IJS_Context* pContext = pRuntime->GetCurrentContext(); |
| 85 CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder()); | 85 CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder()); |
| 86 C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); | 86 C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); |
| 87 CFX_WideString sError; | 87 CFX_WideString sError; |
| 88 CJS_PropValue value(pRuntime); | 88 CJS_PropValue value(pRuntime); |
| 89 value.StartGetting(); | 89 value.StartGetting(); |
| 90 if (!(pObj->*M)(pContext, value, sError)) { | 90 if (!(pObj->*M)(pContext, value, sError)) { |
| 91 FXJS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, | 91 FXJS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, |
| 92 sError)); | 92 sError)); |
| 93 return; | 93 return; |
| 94 } | 94 } |
| 95 info.GetReturnValue().Set(value.GetJSValue()->ToV8Value(isolate)); | 95 info.GetReturnValue().Set(value.GetJSValue()->ToV8Value(isolate)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 template <class C, | 98 template <class C, |
| 99 FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)> | 99 FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)> |
| 100 void JSPropSetter(const char* prop_name_string, | 100 void JSPropSetter(const char* prop_name_string, |
| 101 const char* class_name_string, | 101 const char* class_name_string, |
| 102 v8::Local<v8::String> property, | 102 v8::Local<v8::String> property, |
| 103 v8::Local<v8::Value> value, | 103 v8::Local<v8::Value> value, |
| 104 const v8::PropertyCallbackInfo<void>& info) { | 104 const v8::PropertyCallbackInfo<void>& info) { |
| 105 v8::Isolate* isolate = info.GetIsolate(); | 105 v8::Isolate* isolate = info.GetIsolate(); |
| 106 CJS_Runtime* pRuntime = | 106 CJS_Runtime* pRuntime = |
| 107 static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(isolate)); | 107 static_cast<CJS_Runtime*>(FXJS_GetCurrentEngineFromIsolate(isolate)); |
| 108 if (!pRuntime) | 108 if (!pRuntime) |
| 109 return; | 109 return; |
| 110 IJS_Context* pContext = pRuntime->GetCurrentContext(); | 110 IJS_Context* pContext = pRuntime->GetCurrentContext(); |
| 111 CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder()); | 111 CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder()); |
| 112 C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); | 112 C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); |
| 113 CFX_WideString sError; | 113 CFX_WideString sError; |
| 114 CJS_PropValue propValue(pRuntime, CJS_Value(pRuntime, value)); | 114 CJS_PropValue propValue(pRuntime, CJS_Value(pRuntime, value)); |
| 115 propValue.StartSetting(); | 115 propValue.StartSetting(); |
| 116 if (!(pObj->*M)(pContext, propValue, sError)) { | 116 if (!(pObj->*M)(pContext, propValue, sError)) { |
| 117 FXJS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, | 117 FXJS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 136 template <class C, | 136 template <class C, |
| 137 FX_BOOL (C::*M)(IJS_Context*, | 137 FX_BOOL (C::*M)(IJS_Context*, |
| 138 const std::vector<CJS_Value>&, | 138 const std::vector<CJS_Value>&, |
| 139 CJS_Value&, | 139 CJS_Value&, |
| 140 CFX_WideString&)> | 140 CFX_WideString&)> |
| 141 void JSMethod(const char* method_name_string, | 141 void JSMethod(const char* method_name_string, |
| 142 const char* class_name_string, | 142 const char* class_name_string, |
| 143 const v8::FunctionCallbackInfo<v8::Value>& info) { | 143 const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 144 v8::Isolate* isolate = info.GetIsolate(); | 144 v8::Isolate* isolate = info.GetIsolate(); |
| 145 CJS_Runtime* pRuntime = | 145 CJS_Runtime* pRuntime = |
| 146 static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(isolate)); | 146 static_cast<CJS_Runtime*>(FXJS_GetCurrentEngineFromIsolate(isolate)); |
| 147 if (!pRuntime) | 147 if (!pRuntime) |
| 148 return; | 148 return; |
| 149 IJS_Context* pContext = pRuntime->GetCurrentContext(); | 149 IJS_Context* pContext = pRuntime->GetCurrentContext(); |
| 150 std::vector<CJS_Value> parameters; | 150 std::vector<CJS_Value> parameters; |
| 151 for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) { | 151 for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) { |
| 152 parameters.push_back(CJS_Value(pRuntime, info[i])); | 152 parameters.push_back(CJS_Value(pRuntime, info[i])); |
| 153 } | 153 } |
| 154 CJS_Value valueRes(pRuntime); | 154 CJS_Value valueRes(pRuntime); |
| 155 CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder()); | 155 CJS_Object* pJSObj = (CJS_Object*)FXJS_GetPrivate(isolate, info.Holder()); |
| 156 C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); | 156 C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject()); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 void js_class_name::DefineJSObjects(v8::Isolate* pIsolate, \ | 238 void js_class_name::DefineJSObjects(v8::Isolate* pIsolate, \ |
| 239 FXJSOBJTYPE eObjType) { \ | 239 FXJSOBJTYPE eObjType) { \ |
| 240 g_nObjDefnID = FXJS_DefineObj(pIsolate, js_class_name::g_pClassName, \ | 240 g_nObjDefnID = FXJS_DefineObj(pIsolate, js_class_name::g_pClassName, \ |
| 241 eObjType, JSConstructor, JSDestructor); \ | 241 eObjType, JSConstructor, JSDestructor); \ |
| 242 DefineConsts(pIsolate); \ | 242 DefineConsts(pIsolate); \ |
| 243 DefineProps(pIsolate); \ | 243 DefineProps(pIsolate); \ |
| 244 DefineMethods(pIsolate); \ | 244 DefineMethods(pIsolate); \ |
| 245 } | 245 } |
| 246 | 246 |
| 247 #define DECLARE_JS_CLASS_RICH_PART() \ | 247 #define DECLARE_JS_CLASS_RICH_PART() \ |
| 248 static void JSConstructor(IJS_Runtime* pRuntime, v8::Local<v8::Object> obj); \ | 248 static void JSConstructor(CFXJS_Engine* pEngine, v8::Local<v8::Object> obj); \ |
| 249 static void JSDestructor(v8::Local<v8::Object> obj); \ | 249 static void JSDestructor(v8::Local<v8::Object> obj); \ |
| 250 static void DefineProps(v8::Isolate* pIsoalte); \ | 250 static void DefineProps(v8::Isolate* pIsoalte); \ |
| 251 static void DefineMethods(v8::Isolate* pIsoalte); \ | 251 static void DefineMethods(v8::Isolate* pIsoalte); \ |
| 252 static JSPropertySpec JS_Class_Properties[]; \ | 252 static JSPropertySpec JS_Class_Properties[]; \ |
| 253 static JSMethodSpec JS_Class_Methods[]; | 253 static JSMethodSpec JS_Class_Methods[]; |
| 254 | 254 |
| 255 #define IMPLEMENT_JS_CLASS_RICH_PART(js_class_name, class_alternate, \ | 255 #define IMPLEMENT_JS_CLASS_RICH_PART(js_class_name, class_alternate, \ |
| 256 class_name) \ | 256 class_name) \ |
| 257 void js_class_name::JSConstructor(IJS_Runtime* pIRuntime, \ | 257 void js_class_name::JSConstructor(CFXJS_Engine* pEngine, \ |
| 258 v8::Local<v8::Object> obj) { \ | 258 v8::Local<v8::Object> obj) { \ |
| 259 CJS_Object* pObj = new js_class_name(obj); \ | 259 CJS_Object* pObj = new js_class_name(obj); \ |
| 260 pObj->SetEmbedObject(new class_alternate(pObj)); \ | 260 pObj->SetEmbedObject(new class_alternate(pObj)); \ |
| 261 FXJS_SetPrivate(nullptr, obj, (void*)pObj); \ | 261 FXJS_SetPrivate(nullptr, obj, (void*)pObj); \ |
| 262 pObj->InitInstance(pIRuntime); \ | 262 pObj->InitInstance(static_cast<CJS_Runtime*>(pEngine)); \ |
| 263 } \ | 263 } \ |
| 264 void js_class_name::JSDestructor(v8::Local<v8::Object> obj) { \ | 264 void js_class_name::JSDestructor(v8::Local<v8::Object> obj) { \ |
| 265 js_class_name* pObj = (js_class_name*)FXJS_GetPrivate(nullptr, obj); \ | 265 js_class_name* pObj = (js_class_name*)FXJS_GetPrivate(nullptr, obj); \ |
| 266 pObj->ExitInstance(); \ | 266 pObj->ExitInstance(); \ |
| 267 delete pObj; \ | 267 delete pObj; \ |
| 268 } \ | 268 } \ |
| 269 void js_class_name::DefineProps(v8::Isolate* pIsolate) { \ | 269 void js_class_name::DefineProps(v8::Isolate* pIsolate) { \ |
| 270 for (size_t i = 0; i < FX_ArraySize(JS_Class_Properties) - 1; ++i) { \ | 270 for (size_t i = 0; i < FX_ArraySize(JS_Class_Properties) - 1; ++i) { \ |
| 271 FXJS_DefineObjProperty( \ | 271 FXJS_DefineObjProperty( \ |
| 272 pIsolate, g_nObjDefnID, JS_Class_Properties[i].pName, \ | 272 pIsolate, g_nObjDefnID, JS_Class_Properties[i].pName, \ |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 FX_BOOL bRet = pObj->QueryProperty(propname.c_str()); | 359 FX_BOOL bRet = pObj->QueryProperty(propname.c_str()); |
| 360 info.GetReturnValue().Set(bRet ? 4 : 0); | 360 info.GetReturnValue().Set(bRet ? 4 : 0); |
| 361 } | 361 } |
| 362 | 362 |
| 363 template <class Alt> | 363 template <class Alt> |
| 364 void JSSpecialPropGet(const char* class_name, | 364 void JSSpecialPropGet(const char* class_name, |
| 365 v8::Local<v8::String> property, | 365 v8::Local<v8::String> property, |
| 366 const v8::PropertyCallbackInfo<v8::Value>& info) { | 366 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 367 v8::Isolate* isolate = info.GetIsolate(); | 367 v8::Isolate* isolate = info.GetIsolate(); |
| 368 CJS_Runtime* pRuntime = | 368 CJS_Runtime* pRuntime = |
| 369 static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(isolate)); | 369 static_cast<CJS_Runtime*>(FXJS_GetCurrentEngineFromIsolate(isolate)); |
| 370 if (!pRuntime) | 370 if (!pRuntime) |
| 371 return; | 371 return; |
| 372 IJS_Context* pContext = pRuntime->GetCurrentContext(); | 372 IJS_Context* pContext = pRuntime->GetCurrentContext(); |
| 373 CJS_Object* pJSObj = | 373 CJS_Object* pJSObj = |
| 374 reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder())); | 374 reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder())); |
| 375 Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); | 375 Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); |
| 376 v8::String::Utf8Value utf8_value(property); | 376 v8::String::Utf8Value utf8_value(property); |
| 377 CFX_WideString propname = CFX_WideString::FromUTF8( | 377 CFX_WideString propname = CFX_WideString::FromUTF8( |
| 378 CFX_ByteStringC(*utf8_value, utf8_value.length())); | 378 CFX_ByteStringC(*utf8_value, utf8_value.length())); |
| 379 CFX_WideString sError; | 379 CFX_WideString sError; |
| 380 CJS_PropValue value(pRuntime); | 380 CJS_PropValue value(pRuntime); |
| 381 value.StartGetting(); | 381 value.StartGetting(); |
| 382 if (!pObj->DoProperty(pContext, propname.c_str(), value, sError)) { | 382 if (!pObj->DoProperty(pContext, propname.c_str(), value, sError)) { |
| 383 FXJS_Error(isolate, JSFormatErrorString(class_name, "GetProperty", sError)); | 383 FXJS_Error(isolate, JSFormatErrorString(class_name, "GetProperty", sError)); |
| 384 return; | 384 return; |
| 385 } | 385 } |
| 386 info.GetReturnValue().Set(value.GetJSValue()->ToV8Value(isolate)); | 386 info.GetReturnValue().Set(value.GetJSValue()->ToV8Value(isolate)); |
| 387 } | 387 } |
| 388 | 388 |
| 389 template <class Alt> | 389 template <class Alt> |
| 390 void JSSpecialPropPut(const char* class_name, | 390 void JSSpecialPropPut(const char* class_name, |
| 391 v8::Local<v8::String> property, | 391 v8::Local<v8::String> property, |
| 392 v8::Local<v8::Value> value, | 392 v8::Local<v8::Value> value, |
| 393 const v8::PropertyCallbackInfo<v8::Value>& info) { | 393 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 394 v8::Isolate* isolate = info.GetIsolate(); | 394 v8::Isolate* isolate = info.GetIsolate(); |
| 395 CJS_Runtime* pRuntime = | 395 CJS_Runtime* pRuntime = |
| 396 static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(isolate)); | 396 static_cast<CJS_Runtime*>(FXJS_GetCurrentEngineFromIsolate(isolate)); |
| 397 if (!pRuntime) | 397 if (!pRuntime) |
| 398 return; | 398 return; |
| 399 IJS_Context* pContext = pRuntime->GetCurrentContext(); | 399 IJS_Context* pContext = pRuntime->GetCurrentContext(); |
| 400 CJS_Object* pJSObj = | 400 CJS_Object* pJSObj = |
| 401 reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder())); | 401 reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder())); |
| 402 Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); | 402 Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); |
| 403 v8::String::Utf8Value utf8_value(property); | 403 v8::String::Utf8Value utf8_value(property); |
| 404 CFX_WideString propname = CFX_WideString::FromUTF8( | 404 CFX_WideString propname = CFX_WideString::FromUTF8( |
| 405 CFX_ByteStringC(*utf8_value, utf8_value.length())); | 405 CFX_ByteStringC(*utf8_value, utf8_value.length())); |
| 406 CFX_WideString sError; | 406 CFX_WideString sError; |
| 407 CJS_PropValue PropValue(pRuntime, CJS_Value(pRuntime, value)); | 407 CJS_PropValue PropValue(pRuntime, CJS_Value(pRuntime, value)); |
| 408 PropValue.StartSetting(); | 408 PropValue.StartSetting(); |
| 409 if (!pObj->DoProperty(pContext, propname.c_str(), PropValue, sError)) { | 409 if (!pObj->DoProperty(pContext, propname.c_str(), PropValue, sError)) { |
| 410 FXJS_Error(isolate, JSFormatErrorString(class_name, "PutProperty", sError)); | 410 FXJS_Error(isolate, JSFormatErrorString(class_name, "PutProperty", sError)); |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 | 413 |
| 414 template <class Alt> | 414 template <class Alt> |
| 415 void JSSpecialPropDel(const char* class_name, | 415 void JSSpecialPropDel(const char* class_name, |
| 416 v8::Local<v8::String> property, | 416 v8::Local<v8::String> property, |
| 417 const v8::PropertyCallbackInfo<v8::Boolean>& info) { | 417 const v8::PropertyCallbackInfo<v8::Boolean>& info) { |
| 418 v8::Isolate* isolate = info.GetIsolate(); | 418 v8::Isolate* isolate = info.GetIsolate(); |
| 419 IJS_Runtime* pRuntime = FXJS_GetRuntimeFromIsolate(isolate); | 419 CJS_Runtime* pRuntime = |
| 420 static_cast<CJS_Runtime*>(FXJS_GetCurrentEngineFromIsolate(isolate)); |
| 420 if (!pRuntime) | 421 if (!pRuntime) |
| 421 return; | 422 return; |
| 422 IJS_Context* pContext = pRuntime->GetCurrentContext(); | 423 IJS_Context* pContext = pRuntime->GetCurrentContext(); |
| 423 CJS_Object* pJSObj = | 424 CJS_Object* pJSObj = |
| 424 reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder())); | 425 reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder())); |
| 425 Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); | 426 Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); |
| 426 v8::String::Utf8Value utf8_value(property); | 427 v8::String::Utf8Value utf8_value(property); |
| 427 CFX_WideString propname = CFX_WideString::FromUTF8( | 428 CFX_WideString propname = CFX_WideString::FromUTF8( |
| 428 CFX_ByteStringC(*utf8_value, utf8_value.length())); | 429 CFX_ByteStringC(*utf8_value, utf8_value.length())); |
| 429 CFX_WideString sError; | 430 CFX_WideString sError; |
| 430 if (!pObj->DelProperty(pContext, propname.c_str(), sError)) { | 431 if (!pObj->DelProperty(pContext, propname.c_str(), sError)) { |
| 431 CFX_ByteString cbName; | 432 CFX_ByteString cbName; |
| 432 cbName.Format("%s.%s", class_name, "DelProperty"); | 433 cbName.Format("%s.%s", class_name, "DelProperty"); |
| 433 // Probably a missing call to JSFX_Error(). | 434 // Probably a missing call to JSFX_Error(). |
| 434 } | 435 } |
| 435 } | 436 } |
| 436 | 437 |
| 437 template <FX_BOOL (*F)(IJS_Context*, | 438 template <FX_BOOL (*F)(IJS_Context*, |
| 438 const std::vector<CJS_Value>&, | 439 const std::vector<CJS_Value>&, |
| 439 CJS_Value&, | 440 CJS_Value&, |
| 440 CFX_WideString&)> | 441 CFX_WideString&)> |
| 441 void JSGlobalFunc(const char* func_name_string, | 442 void JSGlobalFunc(const char* func_name_string, |
| 442 const v8::FunctionCallbackInfo<v8::Value>& info) { | 443 const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 443 CJS_Runtime* pRuntime = | 444 CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>( |
| 444 static_cast<CJS_Runtime*>(FXJS_GetRuntimeFromIsolate(info.GetIsolate())); | 445 FXJS_GetCurrentEngineFromIsolate(info.GetIsolate())); |
| 445 if (!pRuntime) | 446 if (!pRuntime) |
| 446 return; | 447 return; |
| 447 IJS_Context* pContext = pRuntime->GetCurrentContext(); | 448 IJS_Context* pContext = pRuntime->GetCurrentContext(); |
| 448 std::vector<CJS_Value> parameters; | 449 std::vector<CJS_Value> parameters; |
| 449 for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) { | 450 for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) { |
| 450 parameters.push_back(CJS_Value(pRuntime, info[i])); | 451 parameters.push_back(CJS_Value(pRuntime, info[i])); |
| 451 } | 452 } |
| 452 CJS_Value valueRes(pRuntime); | 453 CJS_Value valueRes(pRuntime); |
| 453 CFX_WideString sError; | 454 CFX_WideString sError; |
| 454 if (!(*F)(pContext, parameters, valueRes, sError)) { | 455 if (!(*F)(pContext, parameters, valueRes, sError)) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 479 #define IMPLEMENT_JS_STATIC_GLOBAL_FUN(js_class_name) \ | 480 #define IMPLEMENT_JS_STATIC_GLOBAL_FUN(js_class_name) \ |
| 480 void js_class_name::DefineJSObjects(v8::Isolate* pIsolate) { \ | 481 void js_class_name::DefineJSObjects(v8::Isolate* pIsolate) { \ |
| 481 for (size_t i = 0; i < FX_ArraySize(global_methods) - 1; ++i) { \ | 482 for (size_t i = 0; i < FX_ArraySize(global_methods) - 1; ++i) { \ |
| 482 FXJS_DefineGlobalMethod(pIsolate, \ | 483 FXJS_DefineGlobalMethod(pIsolate, \ |
| 483 js_class_name::global_methods[i].pName, \ | 484 js_class_name::global_methods[i].pName, \ |
| 484 js_class_name::global_methods[i].pMethodCall); \ | 485 js_class_name::global_methods[i].pMethodCall); \ |
| 485 } \ | 486 } \ |
| 486 } | 487 } |
| 487 | 488 |
| 488 #endif // FPDFSDK_JAVASCRIPT_JS_DEFINE_H_ | 489 #endif // FPDFSDK_JAVASCRIPT_JS_DEFINE_H_ |
| OLD | NEW |