| 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_INCLUDE_JAVASCRIPT_JS_DEFINE_H_ | 7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_JS_DEFINE_H_ |
| 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_JS_DEFINE_H_ | 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_JS_DEFINE_H_ |
| 9 | 9 |
| 10 #include "../jsapi/fxjs_v8.h" | 10 #include "../jsapi/fxjs_v8.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 #define JS_SPECIAL_STATIC_METHOD(method_name, class_alternate, class_name) \ | 182 #define JS_SPECIAL_STATIC_METHOD(method_name, class_alternate, class_name) \ |
| 183 static void method_name##_static( \ | 183 static void method_name##_static( \ |
| 184 const v8::FunctionCallbackInfo<v8::Value>& info) { \ | 184 const v8::FunctionCallbackInfo<v8::Value>& info) { \ |
| 185 JSMethod<class_alternate, &class_alternate::method_name>( \ | 185 JSMethod<class_alternate, &class_alternate::method_name>( \ |
| 186 #method_name, #class_name, info); \ | 186 #method_name, #class_name, info); \ |
| 187 } | 187 } |
| 188 | 188 |
| 189 /* ===================================== JS CLASS | 189 /* ===================================== JS CLASS |
| 190 * =============================================== */ | 190 * =============================================== */ |
| 191 | 191 |
| 192 #define DECLARE_JS_CLASS(js_class_name) \ | 192 #define DECLARE_JS_CLASS(js_class_name) \ |
| 193 static void JSConstructor(IFXJS_Context* cc, v8::Local<v8::Object> obj, \ | 193 static void JSConstructor(IFXJS_Context* cc, v8::Local<v8::Object> obj, \ |
| 194 v8::Local<v8::Object> global); \ | 194 v8::Local<v8::Object> global); \ |
| 195 static void JSDestructor(v8::Local<v8::Object> obj); \ | 195 static void JSDestructor(v8::Local<v8::Object> obj); \ |
| 196 static int DefineJSObjects(v8::Isolate* pIsolate, FXJSOBJTYPE eObjType); \ | 196 static void DefineJSObjects(v8::Isolate* pIsolate, FXJSOBJTYPE eObjType); \ |
| 197 static JSConstSpec JS_Class_Consts[]; \ | 197 static JSConstSpec JS_Class_Consts[]; \ |
| 198 static JSPropertySpec JS_Class_Properties[]; \ | 198 static JSPropertySpec JS_Class_Properties[]; \ |
| 199 static JSMethodSpec JS_Class_Methods[]; \ | 199 static JSMethodSpec JS_Class_Methods[]; \ |
| 200 static const wchar_t* m_pClassName | 200 static const wchar_t* m_pClassName |
| 201 | 201 |
| 202 #define IMPLEMENT_JS_CLASS_RICH(js_class_name, class_alternate, class_name) \ | 202 #define IMPLEMENT_JS_CLASS_RICH(js_class_name, class_alternate, class_name) \ |
| 203 const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name); \ | 203 const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name); \ |
| 204 void js_class_name::JSConstructor(IFXJS_Context* cc, \ | 204 void js_class_name::JSConstructor(IFXJS_Context* cc, \ |
| 205 v8::Local<v8::Object> obj, \ | 205 v8::Local<v8::Object> obj, \ |
| 206 v8::Local<v8::Object> global) { \ | 206 v8::Local<v8::Object> global) { \ |
| 207 CJS_Object* pObj = new js_class_name(obj); \ | 207 CJS_Object* pObj = new js_class_name(obj); \ |
| 208 pObj->SetEmbedObject(new class_alternate(pObj)); \ | 208 pObj->SetEmbedObject(new class_alternate(pObj)); \ |
| 209 JS_SetPrivate(NULL, obj, (void*)pObj); \ | 209 JS_SetPrivate(NULL, obj, (void*)pObj); \ |
| 210 pObj->InitInstance(cc); \ | 210 pObj->InitInstance(cc); \ |
| 211 } \ | 211 } \ |
| 212 \ | 212 \ |
| 213 void js_class_name::JSDestructor(v8::Local<v8::Object> obj) { \ | 213 void js_class_name::JSDestructor(v8::Local<v8::Object> obj) { \ |
| 214 js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL, obj); \ | 214 js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL, obj); \ |
| 215 pObj->ExitInstance(); \ | 215 pObj->ExitInstance(); \ |
| 216 delete pObj; \ | 216 delete pObj; \ |
| 217 } \ | 217 } \ |
| 218 \ | 218 \ |
| 219 int js_class_name::DefineJSObjects(v8::Isolate* pIsolate, \ | 219 void js_class_name::DefineJSObjects(v8::Isolate* pIsolate, \ |
| 220 FXJSOBJTYPE eObjType) { \ | 220 FXJSOBJTYPE eObjType) { \ |
| 221 int nObjDefnID = JS_DefineObj(pIsolate, js_class_name::m_pClassName, \ | 221 int nObjDefnID = JS_DefineObj(pIsolate, js_class_name::m_pClassName, \ |
| 222 eObjType, JSConstructor, JSDestructor); \ | 222 eObjType, JSConstructor, JSDestructor); \ |
| 223 if (nObjDefnID < 0) \ | 223 for (int i = 0; i < FX_ArraySize(JS_Class_Properties) - 1; ++i) { \ |
| 224 return -1; \ | 224 JS_DefineObjProperty(pIsolate, nObjDefnID, JS_Class_Properties[i].pName, \ |
| 225 for (int i = 0; i < FX_ArraySize(JS_Class_Properties) - 1; ++i) { \ | 225 JS_Class_Properties[i].pPropGet, \ |
| 226 if (JS_DefineObjProperty(pIsolate, nObjDefnID, \ | 226 JS_Class_Properties[i].pPropPut); \ |
| 227 JS_Class_Properties[i].pName, \ | 227 } \ |
| 228 JS_Class_Properties[i].pPropGet, \ | 228 for (int i = 0; i < FX_ArraySize(JS_Class_Methods) - 1; ++i) { \ |
| 229 JS_Class_Properties[i].pPropPut) < 0) \ | 229 JS_DefineObjMethod(pIsolate, nObjDefnID, JS_Class_Methods[i].pName, \ |
| 230 return -1; \ | 230 JS_Class_Methods[i].pMethodCall); \ |
| 231 } \ | 231 } \ |
| 232 for (int i = 0; i < FX_ArraySize(JS_Class_Methods) - 1; ++i) { \ | |
| 233 if (JS_DefineObjMethod(pIsolate, nObjDefnID, JS_Class_Methods[i].pName, \ | |
| 234 JS_Class_Methods[i].pMethodCall) < 0) \ | |
| 235 return -1; \ | |
| 236 } \ | |
| 237 return nObjDefnID; \ | |
| 238 } | 232 } |
| 239 | 233 |
| 240 #define IMPLEMENT_JS_CLASS(js_class_name, class_name) \ | 234 #define IMPLEMENT_JS_CLASS(js_class_name, class_name) \ |
| 241 IMPLEMENT_JS_CLASS_RICH(js_class_name, class_name, class_name) | 235 IMPLEMENT_JS_CLASS_RICH(js_class_name, class_name, class_name) |
| 242 | 236 |
| 243 /* ======================================== CONST CLASS | 237 /* ======================================== CONST CLASS |
| 244 * ============================================ */ | 238 * ============================================ */ |
| 245 | 239 |
| 246 #define DECLARE_JS_CLASS_CONST() \ | 240 #define DECLARE_JS_CLASS_CONST() \ |
| 247 static int DefineJSObjects(v8::Isolate* pIsolate, FXJSOBJTYPE eObjType); \ | 241 static void DefineJSObjects(v8::Isolate* pIsolate, FXJSOBJTYPE eObjType); \ |
| 248 static JSConstSpec JS_Class_Consts[]; \ | 242 static JSConstSpec JS_Class_Consts[]; \ |
| 249 static const wchar_t* m_pClassName | 243 static const wchar_t* m_pClassName |
| 250 | 244 |
| 251 #define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \ | 245 #define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \ |
| 252 const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name); \ | 246 const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name); \ |
| 253 int js_class_name::DefineJSObjects(v8::Isolate* pIsolate, \ | 247 void js_class_name::DefineJSObjects(v8::Isolate* pIsolate, \ |
| 254 FXJSOBJTYPE eObjType) { \ | 248 FXJSOBJTYPE eObjType) { \ |
| 255 int nObjDefnID = JS_DefineObj(pIsolate, js_class_name::m_pClassName, \ | 249 int nObjDefnID = JS_DefineObj(pIsolate, js_class_name::m_pClassName, \ |
| 256 eObjType, NULL, NULL); \ | 250 eObjType, NULL, NULL); \ |
| 257 if (nObjDefnID >= 0) { \ | 251 for (int i = 0; i < FX_ArraySize(JS_Class_Consts) - 1; ++i) { \ |
| 258 for (int i = 0, sz = sizeof(JS_Class_Consts) / sizeof(JSConstSpec) - 1; \ | 252 JS_DefineObjConst( \ |
| 259 i < sz; i++) { \ | 253 pIsolate, nObjDefnID, JS_Class_Consts[i].pName, \ |
| 260 if (JS_Class_Consts[i].t == 0) { \ | 254 JS_Class_Consts[i].t == 0 \ |
| 261 if (JS_DefineObjConst( \ | 255 ? JS_NewNumber(pIsolate, JS_Class_Consts[i].number) \ |
| 262 pIsolate, nObjDefnID, JS_Class_Consts[i].pName, \ | 256 : JS_NewString(pIsolate, JS_Class_Consts[i].string)); \ |
| 263 JS_NewNumber(pIsolate, JS_Class_Consts[i].number)) < 0) \ | 257 } \ |
| 264 return -1; \ | |
| 265 } else { \ | |
| 266 if (JS_DefineObjConst( \ | |
| 267 pIsolate, nObjDefnID, JS_Class_Consts[i].pName, \ | |
| 268 JS_NewString(pIsolate, JS_Class_Consts[i].string)) < 0) \ | |
| 269 return -1; \ | |
| 270 } \ | |
| 271 } \ | |
| 272 return nObjDefnID; \ | |
| 273 } \ | |
| 274 return -1; \ | |
| 275 } | 258 } |
| 276 | 259 |
| 277 /* ===================================== SPECIAL JS CLASS | 260 /* ===================================== SPECIAL JS CLASS |
| 278 * =============================================== */ | 261 * =============================================== */ |
| 279 | 262 |
| 280 template <class Alt> | 263 template <class Alt> |
| 281 void JSSpecialPropQuery(const char*, | 264 void JSSpecialPropQuery(const char*, |
| 282 v8::Local<v8::String> property, | 265 v8::Local<v8::String> property, |
| 283 const v8::PropertyCallbackInfo<v8::Integer>& info) { | 266 const v8::PropertyCallbackInfo<v8::Integer>& info) { |
| 284 v8::Isolate* isolate = info.GetIsolate(); | 267 v8::Isolate* isolate = info.GetIsolate(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 CFX_WideString propname = | 343 CFX_WideString propname = |
| 361 CFX_WideString::FromUTF8(*utf8_value, utf8_value.length()); | 344 CFX_WideString::FromUTF8(*utf8_value, utf8_value.length()); |
| 362 CFX_WideString sError; | 345 CFX_WideString sError; |
| 363 if (!pObj->DelProperty(pRuntimeContext, propname.c_str(), sError)) { | 346 if (!pObj->DelProperty(pRuntimeContext, propname.c_str(), sError)) { |
| 364 CFX_ByteString cbName; | 347 CFX_ByteString cbName; |
| 365 cbName.Format("%s.%s", class_name, "DelProperty"); | 348 cbName.Format("%s.%s", class_name, "DelProperty"); |
| 366 // Probably a missing call to JS_Error(). | 349 // Probably a missing call to JS_Error(). |
| 367 } | 350 } |
| 368 } | 351 } |
| 369 | 352 |
| 370 #define DECLARE_SPECIAL_JS_CLASS(js_class_name) \ | 353 #define DECLARE_SPECIAL_JS_CLASS(js_class_name) \ |
| 371 static void JSConstructor(IFXJS_Context* cc, v8::Local<v8::Object> obj, \ | 354 static void JSConstructor(IFXJS_Context* cc, v8::Local<v8::Object> obj, \ |
| 372 v8::Local<v8::Object> global); \ | 355 v8::Local<v8::Object> global); \ |
| 373 static void JSDestructor(v8::Local<v8::Object> obj); \ | 356 static void JSDestructor(v8::Local<v8::Object> obj); \ |
| 374 static JSConstSpec JS_Class_Consts[]; \ | 357 static JSConstSpec JS_Class_Consts[]; \ |
| 375 static JSPropertySpec JS_Class_Properties[]; \ | 358 static JSPropertySpec JS_Class_Properties[]; \ |
| 376 static JSMethodSpec JS_Class_Methods[]; \ | 359 static JSMethodSpec JS_Class_Methods[]; \ |
| 377 static int DefineJSObjects(v8::Isolate* pIsolate, FXJSOBJTYPE eObjType); \ | 360 static void DefineJSObjects(v8::Isolate* pIsolate, FXJSOBJTYPE eObjType); \ |
| 378 static const wchar_t* m_pClassName; \ | 361 static const wchar_t* m_pClassName; \ |
| 379 static void queryprop_##js_class_name##_static( \ | 362 static void queryprop_##js_class_name##_static( \ |
| 380 v8::Local<v8::String> property, \ | 363 v8::Local<v8::String> property, \ |
| 381 const v8::PropertyCallbackInfo<v8::Integer>& info); \ | 364 const v8::PropertyCallbackInfo<v8::Integer>& info); \ |
| 382 static void getprop_##js_class_name##_static( \ | 365 static void getprop_##js_class_name##_static( \ |
| 383 v8::Local<v8::String> property, \ | 366 v8::Local<v8::String> property, \ |
| 384 const v8::PropertyCallbackInfo<v8::Value>& info); \ | 367 const v8::PropertyCallbackInfo<v8::Value>& info); \ |
| 385 static void putprop_##js_class_name##_static( \ | 368 static void putprop_##js_class_name##_static( \ |
| 386 v8::Local<v8::String> property, v8::Local<v8::Value> value, \ | 369 v8::Local<v8::String> property, v8::Local<v8::Value> value, \ |
| 387 const v8::PropertyCallbackInfo<v8::Value>& info); \ | 370 const v8::PropertyCallbackInfo<v8::Value>& info); \ |
| 388 static void delprop_##js_class_name##_static( \ | 371 static void delprop_##js_class_name##_static( \ |
| 389 v8::Local<v8::String> property, \ | 372 v8::Local<v8::String> property, \ |
| 390 const v8::PropertyCallbackInfo<v8::Boolean>& info) | 373 const v8::PropertyCallbackInfo<v8::Boolean>& info) |
| 391 | 374 |
| 392 #define IMPLEMENT_SPECIAL_JS_CLASS(js_class_name, class_alternate, class_name) \ | 375 #define IMPLEMENT_SPECIAL_JS_CLASS(js_class_name, class_alternate, class_name) \ |
| 393 const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name); \ | 376 const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name); \ |
| 394 void js_class_name::queryprop_##js_class_name##_static( \ | 377 void js_class_name::queryprop_##js_class_name##_static( \ |
| 395 v8::Local<v8::String> property, \ | 378 v8::Local<v8::String> property, \ |
| 396 const v8::PropertyCallbackInfo<v8::Integer>& info) { \ | 379 const v8::PropertyCallbackInfo<v8::Integer>& info) { \ |
| 397 JSSpecialPropQuery<class_alternate>(#class_name, property, info); \ | 380 JSSpecialPropQuery<class_alternate>(#class_name, property, info); \ |
| 398 } \ | 381 } \ |
| 399 void js_class_name::getprop_##js_class_name##_static( \ | 382 void js_class_name::getprop_##js_class_name##_static( \ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 420 pObj->InitInstance(cc); \ | 403 pObj->InitInstance(cc); \ |
| 421 } \ | 404 } \ |
| 422 \ | 405 \ |
| 423 void js_class_name::JSDestructor(v8::Local<v8::Object> obj) { \ | 406 void js_class_name::JSDestructor(v8::Local<v8::Object> obj) { \ |
| 424 js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL, obj); \ | 407 js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL, obj); \ |
| 425 ASSERT(pObj != NULL); \ | 408 ASSERT(pObj != NULL); \ |
| 426 pObj->ExitInstance(); \ | 409 pObj->ExitInstance(); \ |
| 427 delete pObj; \ | 410 delete pObj; \ |
| 428 } \ | 411 } \ |
| 429 \ | 412 \ |
| 430 int js_class_name::DefineJSObjects(v8::Isolate* pIsolate, \ | 413 void js_class_name::DefineJSObjects(v8::Isolate* pIsolate, \ |
| 431 FXJSOBJTYPE eObjType) { \ | 414 FXJSOBJTYPE eObjType) { \ |
| 432 int nObjDefnID = JS_DefineObj(pIsolate, js_class_name::m_pClassName, \ | 415 int nObjDefnID = JS_DefineObj(pIsolate, js_class_name::m_pClassName, \ |
| 433 eObjType, JSConstructor, JSDestructor); \ | 416 eObjType, JSConstructor, JSDestructor); \ |
| 434 \ | |
| 435 if (nObjDefnID < 0) \ | |
| 436 return -1; \ | |
| 437 for (int i = 0; i < FX_ArraySize(JS_Class_Properties) - 1; ++i) { \ | 417 for (int i = 0; i < FX_ArraySize(JS_Class_Properties) - 1; ++i) { \ |
| 438 if (JS_DefineObjProperty(pIsolate, nObjDefnID, \ | 418 JS_DefineObjProperty(pIsolate, nObjDefnID, JS_Class_Properties[i].pName, \ |
| 439 JS_Class_Properties[i].pName, \ | 419 JS_Class_Properties[i].pPropGet, \ |
| 440 JS_Class_Properties[i].pPropGet, \ | 420 JS_Class_Properties[i].pPropPut); \ |
| 441 JS_Class_Properties[i].pPropPut) < 0) \ | |
| 442 return -1; \ | |
| 443 } \ | 421 } \ |
| 444 \ | 422 \ |
| 445 for (int i = 0; i < FX_ArraySize(JS_Class_Methods) - 1; ++i) { \ | 423 for (int i = 0; i < FX_ArraySize(JS_Class_Methods) - 1; ++i) { \ |
| 446 if (JS_DefineObjMethod(pIsolate, nObjDefnID, JS_Class_Methods[i].pName, \ | 424 JS_DefineObjMethod(pIsolate, nObjDefnID, JS_Class_Methods[i].pName, \ |
| 447 JS_Class_Methods[i].pMethodCall) < 0) \ | 425 JS_Class_Methods[i].pMethodCall); \ |
| 448 return -1; \ | |
| 449 } \ | 426 } \ |
| 450 if (JS_DefineObjAllProperties( \ | 427 JS_DefineObjAllProperties( \ |
| 451 pIsolate, nObjDefnID, \ | 428 pIsolate, nObjDefnID, \ |
| 452 js_class_name::queryprop_##js_class_name##_static, \ | 429 js_class_name::queryprop_##js_class_name##_static, \ |
| 453 js_class_name::getprop_##js_class_name##_static, \ | 430 js_class_name::getprop_##js_class_name##_static, \ |
| 454 js_class_name::putprop_##js_class_name##_static, \ | 431 js_class_name::putprop_##js_class_name##_static, \ |
| 455 js_class_name::delprop_##js_class_name##_static) < 0) \ | 432 js_class_name::delprop_##js_class_name##_static); \ |
| 456 return -1; \ | |
| 457 return nObjDefnID; \ | |
| 458 } | 433 } |
| 459 | 434 |
| 460 /* ======================================== GLOBAL METHODS | 435 /* ======================================== GLOBAL METHODS |
| 461 * ============================================ */ | 436 * ============================================ */ |
| 462 | 437 |
| 463 template <FX_BOOL (*F)(IFXJS_Context* cc, | 438 template <FX_BOOL (*F)(IFXJS_Context* cc, |
| 464 const CJS_Parameters& params, | 439 const CJS_Parameters& params, |
| 465 CJS_Value& vRet, | 440 CJS_Value& vRet, |
| 466 CFX_WideString& sError)> | 441 CFX_WideString& sError)> |
| 467 void JSGlobalFunc(const char* func_name_string, | 442 void JSGlobalFunc(const char* func_name_string, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 486 } | 461 } |
| 487 | 462 |
| 488 #define JS_STATIC_GLOBAL_FUN(fun_name) \ | 463 #define JS_STATIC_GLOBAL_FUN(fun_name) \ |
| 489 static void fun_name##_static( \ | 464 static void fun_name##_static( \ |
| 490 const v8::FunctionCallbackInfo<v8::Value>& info) { \ | 465 const v8::FunctionCallbackInfo<v8::Value>& info) { \ |
| 491 JSGlobalFunc<fun_name>(#fun_name, info); \ | 466 JSGlobalFunc<fun_name>(#fun_name, info); \ |
| 492 } | 467 } |
| 493 | 468 |
| 494 #define JS_STATIC_DECLARE_GLOBAL_FUN() \ | 469 #define JS_STATIC_DECLARE_GLOBAL_FUN() \ |
| 495 static JSMethodSpec global_methods[]; \ | 470 static JSMethodSpec global_methods[]; \ |
| 496 static int DefineJSObjects(v8::Isolate* pIsolate) | 471 static void DefineJSObjects(v8::Isolate* pIsolate) |
| 497 | 472 |
| 498 #define BEGIN_JS_STATIC_GLOBAL_FUN(js_class_name) \ | 473 #define BEGIN_JS_STATIC_GLOBAL_FUN(js_class_name) \ |
| 499 JSMethodSpec js_class_name::global_methods[] = { | 474 JSMethodSpec js_class_name::global_methods[] = { |
| 500 #define JS_STATIC_GLOBAL_FUN_ENTRY(method_name) \ | 475 #define JS_STATIC_GLOBAL_FUN_ENTRY(method_name) \ |
| 501 JS_STATIC_METHOD_ENTRY(method_name) | 476 JS_STATIC_METHOD_ENTRY(method_name) |
| 502 | 477 |
| 503 #define END_JS_STATIC_GLOBAL_FUN() END_JS_STATIC_METHOD() | 478 #define END_JS_STATIC_GLOBAL_FUN() END_JS_STATIC_METHOD() |
| 504 | 479 |
| 505 #define IMPLEMENT_JS_STATIC_GLOBAL_FUN(js_class_name) \ | 480 #define IMPLEMENT_JS_STATIC_GLOBAL_FUN(js_class_name) \ |
| 506 int js_class_name::DefineJSObjects(v8::Isolate* pIsolate) { \ | 481 void js_class_name::DefineJSObjects(v8::Isolate* pIsolate) { \ |
| 507 for (int i = 0; i < FX_ArraySize(global_methods) - 1; ++i) { \ | 482 for (int i = 0; i < FX_ArraySize(global_methods) - 1; ++i) { \ |
| 508 if (JS_DefineGlobalMethod( \ | 483 JS_DefineGlobalMethod(pIsolate, js_class_name::global_methods[i].pName, \ |
| 509 pIsolate, js_class_name::global_methods[i].pName, \ | 484 js_class_name::global_methods[i].pMethodCall); \ |
| 510 js_class_name::global_methods[i].pMethodCall) < 0) \ | 485 } \ |
| 511 return -1; \ | |
| 512 } \ | |
| 513 return 0; \ | |
| 514 } | 486 } |
| 515 | 487 |
| 516 /* ============================================================ */ | |
| 517 | |
| 518 #define VALUE_NAME_STRING L"string" | |
| 519 #define VALUE_NAME_NUMBER L"number" | |
| 520 #define VALUE_NAME_BOOLEAN L"boolean" | |
| 521 #define VALUE_NAME_DATE L"date" | |
| 522 #define VALUE_NAME_OBJECT L"object" | |
| 523 #define VALUE_NAME_FXOBJ L"fxobj" | |
| 524 #define VALUE_NAME_NULL L"null" | |
| 525 #define VALUE_NAME_UNDEFINED L"undefined" | |
| 526 | |
| 527 FXJSVALUETYPE GET_VALUE_TYPE(v8::Local<v8::Value> p); | 488 FXJSVALUETYPE GET_VALUE_TYPE(v8::Local<v8::Value> p); |
| 528 | 489 |
| 529 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_DEFINE_H_ | 490 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_DEFINE_H_ |
| OLD | NEW |