[v8] Fix uses of deprecated Object::Set in zircon
Always use the Context variant of Set and check its return value. Also
converts ToChecked() cases where the value is not actually examined to
use Check().
Bug: v8:7283
Change-Id: I427df9de56c46882b70d2f5cb8b04623b1dcc176
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1578562
Auto-Submit: Dan Elphick <delphick@chromium.org>
Reviewed-by: Wez <wez@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#653952}
diff --git a/build/fuchsia/fidlgen_js/runtime/zircon.cc b/build/fuchsia/fidlgen_js/runtime/zircon.cc
index 4f1dc5c..55ccb101 100644
--- a/build/fuchsia/fidlgen_js/runtime/zircon.cc
+++ b/build/fuchsia/fidlgen_js/runtime/zircon.cc
@@ -308,10 +308,13 @@
: isolate_(isolate), wait_set_(std::make_unique<WaitSet>()) {
DCHECK_EQ(isolate->GetData(gin::kEmbedderFuchsia), nullptr);
isolate->SetData(gin::kEmbedderFuchsia, wait_set_.get());
+ v8::Local<v8::Context> context = isolate->GetCurrentContext();
-#define SET_CONSTANT(k) \
- global->Set(gin::StringToSymbol(isolate, "$" #k), \
- gin::ConvertToV8(isolate, k))
+#define SET_CONSTANT(k) \
+ global \
+ ->Set(context, gin::StringToSymbol(isolate, "$" #k), \
+ gin::ConvertToV8(isolate, k)) \
+ .Check()
// zx_status_t.
SET_CONSTANT(ZX_OK);
@@ -361,8 +364,6 @@
SET_CONSTANT(ZX_ERR_CONNECTION_RESET);
SET_CONSTANT(ZX_ERR_CONNECTION_ABORTED);
- v8::Local<v8::Context> context = isolate->GetCurrentContext();
-
// Handle APIs.
global
->Set(context, gin::StringToSymbol(isolate, "$ZxObjectWaitOne"),
@@ -370,14 +371,14 @@
base::BindRepeating(ZxObjectWaitOne))
->GetFunction(context)
.ToLocalChecked())
- .ToChecked();
+ .Check();
global
->Set(context, gin::StringToSymbol(isolate, "$zx_handle_close"),
gin::CreateFunctionTemplate(isolate,
base::BindRepeating(zx_handle_close))
->GetFunction(context)
.ToLocalChecked())
- .ToChecked();
+ .Check();
SET_CONSTANT(ZX_HANDLE_INVALID);
SET_CONSTANT(ZX_TIME_INFINITE);
@@ -388,21 +389,21 @@
base::BindRepeating(&ZxChannelCreate))
->GetFunction(context)
.ToLocalChecked())
- .ToChecked();
+ .Check();
global
->Set(context, gin::StringToSymbol(isolate, "$ZxChannelWrite"),
gin::CreateFunctionTemplate(isolate,
base::BindRepeating(&ZxChannelWrite))
->GetFunction(context)
.ToLocalChecked())
- .ToChecked();
+ .Check();
global
->Set(context, gin::StringToSymbol(isolate, "$ZxChannelRead"),
gin::CreateFunctionTemplate(isolate,
base::BindRepeating(&ZxChannelRead))
->GetFunction(context)
.ToLocalChecked())
- .ToChecked();
+ .Check();
SET_CONSTANT(ZX_CHANNEL_READABLE);
SET_CONSTANT(ZX_CHANNEL_WRITABLE);
SET_CONSTANT(ZX_CHANNEL_PEER_CLOSED);
@@ -418,14 +419,14 @@
base::BindRepeating(&StrToUtf8Array))
->GetFunction(context)
.ToLocalChecked())
- .ToChecked();
+ .Check();
global
->Set(context, gin::StringToSymbol(isolate, "$FidlJsUtf8ArrayToStr"),
gin::CreateFunctionTemplate(isolate,
base::BindRepeating(&Utf8ArrayToStr))
->GetFunction(context)
.ToLocalChecked())
- .ToChecked();
+ .Check();
#undef SET_CONSTANT
}