summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_value.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-28 23:12:22 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-28 23:12:22 +0000
commitda379c7af512aa7baa221d38b04c8aa9912b4e02 (patch)
tree2d98da7f03c36051aa96a372126020fc3eb94c12 /fxjs/cfxjse_value.cpp
parentcf59f804ea8bc83fe0d70148de15a3b5cedc801f (diff)
downloadpdfium-da379c7af512aa7baa221d38b04c8aa9912b4e02.tar.xz
Stop using deprecated v8::ObjectTemplate::NewInstance().
Fix nits in affected files. Change-Id: I3a0363c9b7c28359fd1c7cea305e4f7705a228c2 Reviewed-on: https://pdfium-review.googlesource.com/41355 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_value.cpp')
-rw-r--r--fxjs/cfxjse_value.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/fxjs/cfxjse_value.cpp b/fxjs/cfxjse_value.cpp
index 6afba97c2d..6d0f6f7fdf 100644
--- a/fxjs/cfxjse_value.cpp
+++ b/fxjs/cfxjse_value.cpp
@@ -84,7 +84,10 @@ void CFXJSE_Value::SetObject(CFXJSE_HostObject* lpObject,
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(GetIsolate());
v8::Local<v8::FunctionTemplate> hClass =
v8::Local<v8::FunctionTemplate>::New(GetIsolate(), pClass->m_hTemplate);
- v8::Local<v8::Object> hObject = hClass->InstanceTemplate()->NewInstance();
+ v8::Local<v8::Object> hObject =
+ hClass->InstanceTemplate()
+ ->NewInstance(GetIsolate()->GetCurrentContext())
+ .ToLocalChecked();
FXJSE_UpdateObjectBinding(hObject, lpObject);
m_hValue.Reset(GetIsolate(), hObject);
}
@@ -125,11 +128,11 @@ bool CFXJSE_Value::SetObjectProperty(const ByteStringView& szPropName,
v8::Local<v8::Value> hPropValue =
v8::Local<v8::Value>::New(GetIsolate(), lpPropValue->DirectGetValue());
- return (bool)hObject.As<v8::Object>()->Set(
+ return static_cast<bool>(hObject.As<v8::Object>()->Set(
v8::String::NewFromUtf8(GetIsolate(), szPropName.unterminated_c_str(),
v8::String::kNormalString,
szPropName.GetLength()),
- hPropValue);
+ hPropValue));
}
bool CFXJSE_Value::GetObjectProperty(const ByteStringView& szPropName,
@@ -159,7 +162,7 @@ bool CFXJSE_Value::SetObjectProperty(uint32_t uPropIdx,
v8::Local<v8::Value> hPropValue =
v8::Local<v8::Value>::New(GetIsolate(), lpPropValue->DirectGetValue());
- return (bool)hObject.As<v8::Object>()->Set(uPropIdx, hPropValue);
+ return static_cast<bool>(hObject.As<v8::Object>()->Set(uPropIdx, hPropValue));
}
bool CFXJSE_Value::GetObjectPropertyByIdx(uint32_t uPropIdx,
@@ -219,7 +222,7 @@ bool CFXJSE_Value::SetObjectOwnProperty(const ByteStringView& szPropName,
v8::Local<v8::Value>::New(GetIsolate(), lpPropValue->m_hValue);
return hObject.As<v8::Object>()
->DefineOwnProperty(
- m_pIsolate->GetCurrentContext(),
+ GetIsolate()->GetCurrentContext(),
v8::String::NewFromUtf8(GetIsolate(), szPropName.unterminated_c_str(),
v8::String::kNormalString,
szPropName.GetLength()),
@@ -249,7 +252,7 @@ bool CFXJSE_Value::SetFunctionBind(CFXJSE_Value* lpOldFunction,
v8::String::NewFromUtf8(GetIsolate(),
"(function (oldfunction, newthis) { return "
"oldfunction.bind(newthis); })");
- v8::Local<v8::Context> hContext = m_pIsolate->GetCurrentContext();
+ v8::Local<v8::Context> hContext = GetIsolate()->GetCurrentContext();
v8::Local<v8::Function> hBinderFunc =
v8::Script::Compile(hContext, hBinderFuncSource)
.ToLocalChecked()