From 8020fd856805ed5c5f48a7a5f3a346ea6948355f Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 29 Aug 2018 23:32:39 +0000 Subject: Stop using deprecated V8 APIs in CFXJSE_Class. Change-Id: I15b191114a0c464264deccf60f3ae5da287e5a0b Reviewed-on: https://pdfium-review.googlesource.com/41390 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- fxjs/cfxjse_class.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'fxjs') diff --git a/fxjs/cfxjse_class.cpp b/fxjs/cfxjse_class.cpp index 8e49ebe373..deecf8b179 100644 --- a/fxjs/cfxjse_class.cpp +++ b/fxjs/cfxjse_class.cpp @@ -72,9 +72,11 @@ void Context_GlobalObjToString( if (info.This() == info.Holder() && lpClass->name) { ByteString szStringVal = ByteString::Format("[object %s]", lpClass->name); - info.GetReturnValue().Set(v8::String::NewFromUtf8( - info.GetIsolate(), szStringVal.c_str(), v8::String::kNormalString, - szStringVal.GetLength())); + info.GetReturnValue().Set( + v8::String::NewFromUtf8(info.GetIsolate(), szStringVal.c_str(), + v8::NewStringType::kNormal, + szStringVal.GetLength()) + .ToLocalChecked()); return; } v8::Local local_str = @@ -150,7 +152,8 @@ void DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass, hCallBackInfo->SetInternalField( 1, v8::String::NewFromUtf8( pIsolate, reinterpret_cast(szPropName.raw_str()), - v8::String::kNormalString, szPropName.GetLength())); + v8::NewStringType::kNormal, szPropName.GetLength()) + .ToLocalChecked()); pValue->ForceSetValue( v8::Function::New(pValue->GetIsolate()->GetCurrentContext(), DynPropGetterAdapter_MethodCallback, hCallBackInfo, @@ -293,7 +296,9 @@ CFXJSE_Class* CFXJSE_Class::Create( v8::External::New( pIsolate, const_cast(lpClassDefinition))); hFunctionTemplate->SetClassName( - v8::String::NewFromUtf8(pIsolate, lpClassDefinition->name)); + v8::String::NewFromUtf8(pIsolate, lpClassDefinition->name, + v8::NewStringType::kNormal) + .ToLocalChecked()); hFunctionTemplate->InstanceTemplate()->SetInternalFieldCount(2); v8::Local hObjectTemplate = hFunctionTemplate->InstanceTemplate(); @@ -307,7 +312,9 @@ CFXJSE_Class* CFXJSE_Class::Create( lpClassDefinition->methods + i))); fun->RemovePrototype(); hObjectTemplate->Set( - v8::String::NewFromUtf8(pIsolate, lpClassDefinition->methods[i].name), + v8::String::NewFromUtf8(pIsolate, lpClassDefinition->methods[i].name, + v8::NewStringType::kNormal) + .ToLocalChecked(), fun, static_cast(v8::ReadOnly | v8::DontDelete)); } @@ -319,7 +326,10 @@ CFXJSE_Class* CFXJSE_Class::Create( v8::External::New( pIsolate, const_cast(lpClassDefinition))); fun->RemovePrototype(); - hObjectTemplate->Set(v8::String::NewFromUtf8(pIsolate, "toString"), fun); + hObjectTemplate->Set(v8::String::NewFromUtf8(pIsolate, "toString", + v8::NewStringType::kNormal) + .ToLocalChecked(), + fun); } pClass->m_hTemplate.Reset(lpContext->GetIsolate(), hFunctionTemplate); CFXJSE_Class* pResult = pClass.get(); -- cgit v1.2.3