Skip to content

Commit 59e5a39

Browse files
ryzokukentargos
authored andcommitted
src: remove calls to deprecated v8 functions (BooleanValue)
Remove all calls to deprecated v8 functions (here: Value::BooleanValue) inside the code (src directory only). PR-URL: #22075 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent c8880ea commit 59e5a39

File tree

7 files changed

+15
-12
lines changed

7 files changed

+15
-12
lines changed

lib/internal/crypto/cipher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Cipher.prototype.final = function final(outputEncoding) {
182182

183183

184184
Cipher.prototype.setAutoPadding = function setAutoPadding(ap) {
185-
if (!this._handle.setAutoPadding(ap))
185+
if (!this._handle.setAutoPadding(!!ap))
186186
throw new ERR_CRYPTO_INVALID_STATE('setAutoPadding');
187187
return this;
188188
};

lib/internal/readline.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ if (process.binding('config').hasIntl) {
3636
options = options || {};
3737
if (!Number.isInteger(str))
3838
str = stripVTControlCharacters(String(str));
39-
return icu.getStringWidth(str,
40-
Boolean(options.ambiguousAsFullWidth),
41-
Boolean(options.expandEmojiSequence));
39+
return icu.getStringWidth(
40+
str,
41+
Boolean(options.ambiguousAsFullWidth),
42+
Boolean(options.expandEmojiSequence)
43+
);
4244
};
4345
isFullWidthCodePoint =
4446
function isFullWidthCodePoint(code, options) {

lib/net.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,7 @@ if (process.platform === 'win32') {
17241724
}
17251725

17261726
if (handle._simultaneousAccepts !== simultaneousAccepts) {
1727-
handle.setSimultaneousAccepts(simultaneousAccepts);
1727+
handle.setSimultaneousAccepts(!!simultaneousAccepts);
17281728
handle._simultaneousAccepts = simultaneousAccepts;
17291729
}
17301730
};

src/node_crypto.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3093,7 +3093,7 @@ void CipherBase::SetAutoPadding(const FunctionCallbackInfo<Value>& args) {
30933093
CipherBase* cipher;
30943094
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder());
30953095

3096-
bool b = cipher->SetAutoPadding(args.Length() < 1 || args[0]->BooleanValue());
3096+
bool b = cipher->SetAutoPadding(args.Length() < 1 || args[0]->IsTrue());
30973097
args.GetReturnValue().Set(b); // Possibly report invalid state failure
30983098
}
30993099

@@ -5187,7 +5187,8 @@ void SetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
51875187
CHECK(!force_fips_crypto);
51885188
Environment* env = Environment::GetCurrent(args);
51895189
const bool enabled = FIPS_mode();
5190-
const bool enable = args[0]->BooleanValue();
5190+
bool enable;
5191+
if (!args[0]->BooleanValue(env->context()).To(&enable)) return;
51915192
if (enable == enabled)
51925193
return; // No action needed.
51935194
if (!FIPS_mode_set(enable)) {

src/node_file.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
14601460

14611461
const enum encoding encoding = ParseEncoding(env->isolate(), args[1], UTF8);
14621462

1463-
bool with_types = args[2]->BooleanValue();
1463+
bool with_types = args[2]->IsTrue();
14641464

14651465
FSReqBase* req_wrap_async = GetReqWrap(env, args[3]);
14661466
if (req_wrap_async != nullptr) { // readdir(path, encoding, withTypes, req)

src/node_i18n.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,8 +815,8 @@ static void GetStringWidth(const FunctionCallbackInfo<Value>& args) {
815815
if (args.Length() < 1)
816816
return;
817817

818-
bool ambiguous_as_full_width = args[1]->BooleanValue();
819-
bool expand_emoji_sequence = args[2]->BooleanValue();
818+
bool ambiguous_as_full_width = args[1]->IsTrue();
819+
bool expand_emoji_sequence = args[2]->IsTrue();
820820

821821
if (args[0]->IsNumber()) {
822822
args.GetReturnValue().Set(

src/tcp_wrap.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void TCPWrap::SetNoDelay(const FunctionCallbackInfo<Value>& args) {
168168
ASSIGN_OR_RETURN_UNWRAP(&wrap,
169169
args.Holder(),
170170
args.GetReturnValue().Set(UV_EBADF));
171-
int enable = static_cast<int>(args[0]->BooleanValue());
171+
int enable = static_cast<int>(args[0]->IsTrue());
172172
int err = uv_tcp_nodelay(&wrap->handle_, enable);
173173
args.GetReturnValue().Set(err);
174174
}
@@ -192,7 +192,7 @@ void TCPWrap::SetSimultaneousAccepts(const FunctionCallbackInfo<Value>& args) {
192192
ASSIGN_OR_RETURN_UNWRAP(&wrap,
193193
args.Holder(),
194194
args.GetReturnValue().Set(UV_EBADF));
195-
bool enable = args[0]->BooleanValue();
195+
bool enable = args[0]->IsTrue();
196196
int err = uv_tcp_simultaneous_accepts(&wrap->handle_, enable);
197197
args.GetReturnValue().Set(err);
198198
}

0 commit comments

Comments
 (0)