-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: remove calls to deprecated v8 functions (NumberValue) #22094
Conversation
Remove all calls to deprecated v8 functions (here: Value::NumberValue) inside the code (src directory only).
src/async_wrap.cc
Outdated
args[0]->IsNumber() | ||
? args[0] | ||
->NumberValue(args.GetIsolate()->GetCurrentContext()) | ||
.ToChecked() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… args[0].As<Number>()->Value() …
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/async_wrap.cc
Outdated
wrap->AsyncReset(execution_async_id); | ||
} | ||
|
||
|
||
void AsyncWrap::QueueDestroyAsyncId(const FunctionCallbackInfo<Value>& args) { | ||
CHECK(args[0]->IsNumber()); | ||
AsyncWrap::EmitDestroy( | ||
Environment::GetCurrent(args), args[0]->NumberValue()); | ||
Environment::GetCurrent(args), | ||
args[0]->NumberValue(args.GetIsolate()->GetCurrentContext()).ToChecked()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We skip validation of the argument in JS land when async hooks checks are disabled – so we probably don’t want ToChecked()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Umm, dunno. There's literally a CHECK
above, so I thought ToChecked
would work here. I mean, it might still crash, sure, but nowhere it didn't crash earlier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right, I missed that – in that case, we don’t need NumberValue()
either and can cast via .As<Number>()
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:P You're right. Updating the PR.
Landing this. |
Landed in c6a54af |
Remove all calls to deprecated v8 functions (here: Value::NumberValue) inside the code (src directory only). PR-URL: #22094 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Remove all calls to deprecated v8 functions (here: Value::NumberValue) inside the code (src directory only). PR-URL: #22094 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Remove all calls to deprecated v8 functions (here:
Value::NumberValue) inside the code (src directory only).
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes/cc @addaleax @hashseed