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 _JS_DEFINE_H_ | 7 #ifndef _JS_DEFINE_H_ |
8 #define _JS_DEFINE_H_ | 8 #define _JS_DEFINE_H_ |
9 | 9 |
10 typedef v8::Value JSValue; | 10 typedef v8::Value JSValue; |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 {\ | 325 {\ |
326 v8::Isolate* isolate = info.GetIsolate();\ | 326 v8::Isolate* isolate = info.GetIsolate();\ |
327 v8::String::Utf8Value utf8_value(property);\ | 327 v8::String::Utf8Value utf8_value(property);\ |
328 CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_val
ue.length());\ | 328 CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_val
ue.length());\ |
329 CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\ | 329 CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\ |
330 ASSERT(pJSObj != NULL);\ | 330 ASSERT(pJSObj != NULL);\ |
331 class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\ | 331 class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\ |
332 ASSERT(pObj != NULL);\ | 332 ASSERT(pObj != NULL);\ |
333 FX_BOOL bRet = FALSE;\ | 333 FX_BOOL bRet = FALSE;\ |
334 MEMLEAKCHECK_1();\ | 334 MEMLEAKCHECK_1();\ |
335 » bRet = pObj->QueryProperty((FX_LPCWSTR)propname);\ | 335 » bRet = pObj->QueryProperty(propname.c_str());\ |
336 » MEMLEAKCHECK_2(class_name, (FX_LPCWSTR)prop_name);\ | 336 » MEMLEAKCHECK_2(class_name, prop_name.c_str());\ |
337 if (bRet)\ | 337 if (bRet)\ |
338 {\ | 338 {\ |
339 info.GetReturnValue().Set(0x004);\ | 339 info.GetReturnValue().Set(0x004);\ |
340 return ;\ | 340 return ;\ |
341 }\ | 341 }\ |
342 else\ | 342 else\ |
343 {\ | 343 {\ |
344 info.GetReturnValue().Set(0);\ | 344 info.GetReturnValue().Set(0);\ |
345 return ;\ | 345 return ;\ |
346 }\ | 346 }\ |
(...skipping 10 matching lines...) Expand all Loading... |
357 CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_val
ue.length());\ | 357 CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_val
ue.length());\ |
358 CJS_PropValue value(isolate);\ | 358 CJS_PropValue value(isolate);\ |
359 value.StartGetting();\ | 359 value.StartGetting();\ |
360 CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\ | 360 CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\ |
361 ASSERT(pJSObj != NULL);\ | 361 ASSERT(pJSObj != NULL);\ |
362 class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\ | 362 class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\ |
363 ASSERT(pObj != NULL);\ | 363 ASSERT(pObj != NULL);\ |
364 JS_ErrorString sError;\ | 364 JS_ErrorString sError;\ |
365 FX_BOOL bRet = FALSE;\ | 365 FX_BOOL bRet = FALSE;\ |
366 MEMLEAKCHECK_1();\ | 366 MEMLEAKCHECK_1();\ |
367 » bRet = pObj->DoProperty(cc, (FX_LPCWSTR)propname, value, sError);\ | 367 » bRet = pObj->DoProperty(cc, propname.c_str(), value, sError);\ |
368 MEMLEAKCHECK_2(class_name, L"GetProperty");\ | 368 MEMLEAKCHECK_2(class_name, L"GetProperty");\ |
369 if (bRet)\ | 369 if (bRet)\ |
370 {\ | 370 {\ |
371 info.GetReturnValue().Set((v8::Handle<v8::Value>)value);\ | 371 info.GetReturnValue().Set((v8::Handle<v8::Value>)value);\ |
372 return ;\ | 372 return ;\ |
373 }\ | 373 }\ |
374 else\ | 374 else\ |
375 {\ | 375 {\ |
376 CFX_ByteString cbName;\ | 376 CFX_ByteString cbName;\ |
377 cbName.Format("%s.%s", #class_name, L"GetProperty");\ | 377 cbName.Format("%s.%s", #class_name, L"GetProperty");\ |
(...skipping 14 matching lines...) Expand all Loading... |
392 CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_val
ue.length());\ | 392 CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_val
ue.length());\ |
393 CJS_PropValue PropValue(CJS_Value(isolate,value,VT_unknown));\ | 393 CJS_PropValue PropValue(CJS_Value(isolate,value,VT_unknown));\ |
394 PropValue.StartSetting();\ | 394 PropValue.StartSetting();\ |
395 CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\ | 395 CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\ |
396 if(!pJSObj) return;\ | 396 if(!pJSObj) return;\ |
397 class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\ | 397 class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\ |
398 ASSERT(pObj != NULL);\ | 398 ASSERT(pObj != NULL);\ |
399 JS_ErrorString sError;\ | 399 JS_ErrorString sError;\ |
400 FX_BOOL bRet = FALSE;\ | 400 FX_BOOL bRet = FALSE;\ |
401 MEMLEAKCHECK_1();\ | 401 MEMLEAKCHECK_1();\ |
402 » bRet = pObj->DoProperty(cc, (FX_LPCWSTR)propname, PropValue, sError);\ | 402 » bRet = pObj->DoProperty(cc, propname.c_str(), PropValue, sError);\ |
403 MEMLEAKCHECK_2(class_name,L"PutProperty");\ | 403 MEMLEAKCHECK_2(class_name,L"PutProperty");\ |
404 if (bRet)\ | 404 if (bRet)\ |
405 {\ | 405 {\ |
406 return ;\ | 406 return ;\ |
407 }\ | 407 }\ |
408 else\ | 408 else\ |
409 {\ | 409 {\ |
410 CFX_ByteString cbName;\ | 410 CFX_ByteString cbName;\ |
411 cbName.Format("%s.%s", #class_name, "PutProperty");\ | 411 cbName.Format("%s.%s", #class_name, "PutProperty");\ |
412 JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\ | 412 JS_Error(NULL,CFX_WideString::FromLocal(cbName), sError);\ |
(...skipping 11 matching lines...) Expand all Loading... |
424 IFXJS_Context* cc = pRuntime->GetCurrentContext();\ | 424 IFXJS_Context* cc = pRuntime->GetCurrentContext();\ |
425 v8::String::Utf8Value utf8_value(property);\ | 425 v8::String::Utf8Value utf8_value(property);\ |
426 CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_val
ue.length());\ | 426 CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_val
ue.length());\ |
427 CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\ | 427 CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());\ |
428 ASSERT(pJSObj != NULL);\ | 428 ASSERT(pJSObj != NULL);\ |
429 class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\ | 429 class_alternate* pObj = (class_alternate*)pJSObj->GetEmbedObject();\ |
430 ASSERT(pObj != NULL);\ | 430 ASSERT(pObj != NULL);\ |
431 JS_ErrorString sError;\ | 431 JS_ErrorString sError;\ |
432 FX_BOOL bRet = FALSE;\ | 432 FX_BOOL bRet = FALSE;\ |
433 MEMLEAKCHECK_1();\ | 433 MEMLEAKCHECK_1();\ |
434 » bRet = pObj->DelProperty(cc, (FX_LPCWSTR)propname, sError);\ | 434 » bRet = pObj->DelProperty(cc, propname.c_str(), sError);\ |
435 MEMLEAKCHECK_2(class_name,L"DelProperty");\ | 435 MEMLEAKCHECK_2(class_name,L"DelProperty");\ |
436 if (bRet)\ | 436 if (bRet)\ |
437 {\ | 437 {\ |
438 return ;\ | 438 return ;\ |
439 }\ | 439 }\ |
440 else\ | 440 else\ |
441 {\ | 441 {\ |
442 CFX_ByteString cbName;\ | 442 CFX_ByteString cbName;\ |
443 cbName.Format("%s.%s", #class_name, "DelProperty");\ | 443 cbName.Format("%s.%s", #class_name, "DelProperty");\ |
444 return ;\ | 444 return ;\ |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 else if (strcmp(sType,VALUE_NAME_NULL) == 0) | 672 else if (strcmp(sType,VALUE_NAME_NULL) == 0) |
673 return VT_null; | 673 return VT_null; |
674 else if (strcmp(sType,VALUE_NAME_UNDEFINED) == 0) | 674 else if (strcmp(sType,VALUE_NAME_UNDEFINED) == 0) |
675 return VT_undefined; | 675 return VT_undefined; |
676 */ | 676 */ |
677 | 677 |
678 return VT_unknown; | 678 return VT_unknown; |
679 } | 679 } |
680 | 680 |
681 #endif //_JS_DEFINE_H_ | 681 #endif //_JS_DEFINE_H_ |
OLD | NEW |