Skip to content

Commit 9914677

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 <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 96213c8 commit 9914677

File tree

7 files changed

+15
-12
lines changed

7 files changed

+15
-12
lines changed

lib/internal/crypto/cipher.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Cipher.prototype.final = function final(outputEncoding) {
181181

182182

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

lib/internal/readline.js

+5-3
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,7 @@ if (process.platform === 'win32') {
17231723
}
17241724

17251725
if (handle._simultaneousAccepts !== simultaneousAccepts) {
1726-
handle.setSimultaneousAccepts(simultaneousAccepts);
1726+
handle.setSimultaneousAccepts(!!simultaneousAccepts);
17271727
handle._simultaneousAccepts = simultaneousAccepts;
17281728
}
17291729
};

src/node_crypto.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -3096,7 +3096,7 @@ void CipherBase::SetAutoPadding(const FunctionCallbackInfo<Value>& args) {
30963096
CipherBase* cipher;
30973097
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder());
30983098

3099-
bool b = cipher->SetAutoPadding(args.Length() < 1 || args[0]->BooleanValue());
3099+
bool b = cipher->SetAutoPadding(args.Length() < 1 || args[0]->IsTrue());
31003100
args.GetReturnValue().Set(b); // Possibly report invalid state failure
31013101
}
31023102

@@ -5190,7 +5190,8 @@ void SetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
51905190
CHECK(!force_fips_crypto);
51915191
Environment* env = Environment::GetCurrent(args);
51925192
const bool enabled = FIPS_mode();
5193-
const bool enable = args[0]->BooleanValue();
5193+
bool enable;
5194+
if (!args[0]->BooleanValue(env->context()).To(&enable)) return;
51945195
if (enable == enabled)
51955196
return; // No action needed.
51965197
if (!FIPS_mode_set(enable)) {

src/node_file.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,7 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
13161316

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

1319-
bool with_types = args[2]->BooleanValue();
1319+
bool with_types = args[2]->IsTrue();
13201320

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

src/node_i18n.cc

+2-2
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

+2-2
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)