Commit cc7538d0 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[cleanup] Fix uses of deprecated v8::Object::Set/Get

Replace uses of Get/Set with Context versions that return a
Maybe/MaybeLocal and check their return value mostly using
ToLocalChecked or Check.

Bug: v8:7283, v8:8562
Change-Id: Id8614f6e599cad628f3de8614d5a600d2148eb76
Reviewed-on: https://chromium-review.googlesource.com/c/1449676
Commit-Queue: Dan Elphick <delphick@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Dan Elphick <delphick@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#628313}
parent 74c7050a
......@@ -120,7 +120,8 @@ bool Equals(const PP_Var& var,
if (v8_array->Length() != array_var->elements().size())
return false;
for (uint32_t i = 0; i < v8_array->Length(); ++i) {
v8::Local<v8::Value> child_v8 = v8_array->Get(i);
v8::Local<v8::Value> child_v8 =
v8_array->Get(context, i).ToLocalChecked();
if (!Equals(array_var->elements()[i].get(), child_v8, visited_ids))
return false;
}
......@@ -394,7 +395,7 @@ TEST_F(V8VarConverterTest, Cycles) {
ASSERT_FALSE(FromV8ValueSync(object, context, &var_result));
// Array with self reference.
array->Set(0, array);
array->Set(context, 0, array).Check();
ASSERT_FALSE(FromV8ValueSync(array, context, &var_result));
}
}
......
......@@ -470,7 +470,7 @@ std::unique_ptr<base::Value> V8ValueConverterImpl::FromV8Array(
// Only fields with integer keys are carried over to the ListValue.
for (uint32_t i = 0; i < val->Length(); ++i) {
v8::TryCatch try_catch(isolate);
v8::Local<v8::Value> child_v8 = val->Get(i);
v8::Local<v8::Value> child_v8;
v8::MaybeLocal<v8::Value> maybe_child =
val->Get(isolate->GetCurrentContext(), i);
if (try_catch.HasCaught() || !maybe_child.ToLocal(&child_v8)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment