summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_class.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-29 23:32:39 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-29 23:32:39 +0000
commit8020fd856805ed5c5f48a7a5f3a346ea6948355f (patch)
tree9d48cc070aa3cedac222e1b7dab5a1bcd90a6e98 /fxjs/cfxjse_class.cpp
parentb6dbcb211b1ecca9aea7afb70de27d216af15ec9 (diff)
downloadpdfium-8020fd856805ed5c5f48a7a5f3a346ea6948355f.tar.xz
Stop using deprecated V8 APIs in CFXJSE_Class.
Change-Id: I15b191114a0c464264deccf60f3ae5da287e5a0b Reviewed-on: https://pdfium-review.googlesource.com/41390 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_class.cpp')
-rw-r--r--fxjs/cfxjse_class.cpp24
1 files changed, 17 insertions, 7 deletions
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<v8::String> local_str =
@@ -150,7 +152,8 @@ void DynPropGetterAdapter(const FXJSE_CLASS_DESCRIPTOR* lpClass,
hCallBackInfo->SetInternalField(
1, v8::String::NewFromUtf8(
pIsolate, reinterpret_cast<const char*>(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<FXJSE_CLASS_DESCRIPTOR*>(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<v8::ObjectTemplate> 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::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));
}
@@ -319,7 +326,10 @@ CFXJSE_Class* CFXJSE_Class::Create(
v8::External::New(
pIsolate, const_cast<FXJSE_CLASS_DESCRIPTOR*>(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();