diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index d32c8c2ba68788..e39c5e8972cd8b 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -61,6 +61,7 @@ using v8::EscapableHandleScope; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; +using v8::Int32; using v8::Integer; using v8::Local; using v8::Null; @@ -1959,23 +1960,23 @@ void GetAddrInfo(const FunctionCallbackInfo& args) { int32_t flags = 0; if (args[3]->IsInt32()) { - flags = args[3]->Int32Value(env->context()).FromJust(); + flags = args[3].As()->Value(); } int family; - switch (args[2]->Int32Value(env->context()).FromJust()) { - case 0: - family = AF_UNSPEC; - break; - case 4: - family = AF_INET; - break; - case 6: - family = AF_INET6; - break; - default: - CHECK(0 && "bad address family"); + switch (args[2].As()->Value()) { + case 0: + family = AF_UNSPEC; + break; + case 4: + family = AF_INET; + break; + case 6: + family = AF_INET6; + break; + default: + CHECK(0 && "bad address family"); } auto req_wrap = new GetAddrInfoReqWrap(env, req_wrap_obj, args[4]->IsTrue()); diff --git a/src/js_stream.cc b/src/js_stream.cc index 902aff7abee43e..4769a9c56d633f 100644 --- a/src/js_stream.cc +++ b/src/js_stream.cc @@ -14,6 +14,7 @@ using v8::Context; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; +using v8::Int32; using v8::Local; using v8::Object; using v8::String; @@ -154,7 +155,8 @@ void JSStream::Finish(const FunctionCallbackInfo& args) { CHECK(args[0]->IsObject()); Wrap* w = static_cast(StreamReq::FromObject(args[0].As())); - w->Done(args[1]->Int32Value()); + CHECK(args[1]->IsInt32()); + w->Done(args[1].As()->Value()); } diff --git a/src/node.cc b/src/node.cc index acaab53c133661..f1d678ffa86810 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1198,7 +1198,8 @@ static void Exit(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); WaitForInspectorDisconnect(env); v8_platform.StopTracingAgent(); - env->Exit(args[0]->Int32Value()); + int code = args[0]->Int32Value(env->context()).FromMaybe(0); + env->Exit(code); } extern "C" void node_module_register(void* m) { diff --git a/src/node_crypto.cc b/src/node_crypto.cc index d2eac96db39e89..7b0bb6c1637dab 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1045,7 +1045,7 @@ void SecureContext::SetSessionTimeout(const FunctionCallbackInfo& args) { sc->env(), "Session timeout must be a 32-bit integer"); } - int32_t sessionTimeout = args[0]->Int32Value(); + int32_t sessionTimeout = args[0].As()->Value(); SSL_CTX_set_timeout(sc->ctx_.get(), sessionTimeout); } @@ -1267,7 +1267,8 @@ int SecureContext::TicketKeyCallback(SSL* ssl, {0, 0}).ToLocalChecked(); Local arr = ret.As(); - int r = arr->Get(kTicketKeyReturnIndex)->Int32Value(); + int r = + arr->Get(kTicketKeyReturnIndex)->Int32Value(env->context()).FromJust(); if (r < 0) return r; @@ -3629,14 +3630,10 @@ void Sign::SignFinal(const FunctionCallbackInfo& args) { char* buf = Buffer::Data(args[0]); CHECK(args[2]->IsInt32()); - Maybe maybe_padding = args[2]->Int32Value(env->context()); - CHECK(maybe_padding.IsJust()); - int padding = maybe_padding.ToChecked(); + int padding = args[2].As()->Value(); CHECK(args[3]->IsInt32()); - Maybe maybe_salt_len = args[3]->Int32Value(env->context()); - CHECK(maybe_salt_len.IsJust()); - int salt_len = maybe_salt_len.ToChecked(); + int salt_len = args[3].As()->Value(); ClearErrorOnReturn clear_error_on_return; unsigned char md_value[8192]; @@ -3783,8 +3780,6 @@ SignBase::Error Verify::VerifyFinal(const char* key_pem, void Verify::VerifyFinal(const FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - ClearErrorOnReturn clear_error_on_return; Verify* verify; @@ -3797,14 +3792,10 @@ void Verify::VerifyFinal(const FunctionCallbackInfo& args) { ssize_t hlen = Buffer::Length(args[1]); CHECK(args[2]->IsInt32()); - Maybe maybe_padding = args[2]->Int32Value(env->context()); - CHECK(maybe_padding.IsJust()); - int padding = maybe_padding.ToChecked(); + int padding = args[2].As()->Value(); CHECK(args[3]->IsInt32()); - Maybe maybe_salt_len = args[3]->Int32Value(env->context()); - CHECK(maybe_salt_len.IsJust()); - int salt_len = maybe_salt_len.ToChecked(); + int salt_len = args[3].As()->Value(); bool verify_result; Error err = verify->VerifyFinal(kbuf, klen, hbuf, hlen, padding, salt_len, @@ -4076,14 +4067,14 @@ void DiffieHellman::New(const FunctionCallbackInfo& args) { if (args.Length() == 2) { if (args[0]->IsInt32()) { if (args[1]->IsInt32()) { - initialized = diffieHellman->Init(args[0]->Int32Value(), - args[1]->Int32Value()); + initialized = diffieHellman->Init(args[0].As()->Value(), + args[1].As()->Value()); } } else { if (args[1]->IsInt32()) { initialized = diffieHellman->Init(Buffer::Data(args[0]), Buffer::Length(args[0]), - args[1]->Int32Value()); + args[1].As()->Value()); } else { initialized = diffieHellman->Init(Buffer::Data(args[0]), Buffer::Length(args[0]), diff --git a/src/node_dtrace.cc b/src/node_dtrace.cc index 66e24afcacd974..517d32064ea232 100644 --- a/src/node_dtrace.cc +++ b/src/node_dtrace.cc @@ -69,13 +69,15 @@ using v8::Value; if ((*(const char **)valp = *_##member) == nullptr) \ *(const char **)valp = ""; -#define SLURP_INT(obj, member, valp) \ - if (!(obj)->IsObject()) { \ - return node::THROW_ERR_INVALID_ARG_TYPE(env, \ - "expected object for " #obj " to contain integer member " #member);\ - } \ - *valp = obj->Get(OneByteString(env->isolate(), #member)) \ - ->Int32Value(); +#define SLURP_INT(obj, member, valp) \ + if (!(obj)->IsObject()) { \ + return node::THROW_ERR_INVALID_ARG_TYPE( \ + env, \ + "expected object for " #obj " to contain integer member " #member); \ + } \ + *valp = obj->Get(OneByteString(env->isolate(), #member)) \ + ->Int32Value(env->context()) \ + .FromJust(); #define SLURP_OBJECT(obj, member, valp) \ if (!(obj)->IsObject()) { \ diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index bab15a8c4bdf6c..f2ec2c0bbde4f2 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -57,6 +57,7 @@ using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; +using v8::Int32; using v8::Integer; using v8::Local; using v8::MaybeLocal; @@ -361,8 +362,9 @@ class Parser : public AsyncWrap, public StreamListener { static void New(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); + CHECK(args[0]->IsInt32()); http_parser_type type = - static_cast(args[0]->Int32Value()); + static_cast(args[0].As()->Value()); CHECK(type == HTTP_REQUEST || type == HTTP_RESPONSE); new Parser(env, args.This(), type); } @@ -458,8 +460,9 @@ class Parser : public AsyncWrap, public StreamListener { static void Reinitialize(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); + CHECK(args[0]->IsInt32()); http_parser_type type = - static_cast(args[0]->Int32Value()); + static_cast(args[0].As()->Value()); CHECK(type == HTTP_REQUEST || type == HTTP_RESPONSE); Parser* parser; diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 9543ab60737912..abe8addfadccde 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -87,6 +87,7 @@ namespace node { using v8::Context; using v8::FunctionCallbackInfo; using v8::HandleScope; +using v8::Int32; using v8::Isolate; using v8::Local; using v8::MaybeLocal; @@ -502,7 +503,8 @@ void Transcode(const FunctionCallbackInfo&args) { void ICUErrorName(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - UErrorCode status = static_cast(args[0]->Int32Value()); + CHECK(args[0]->IsInt32()); + UErrorCode status = static_cast(args[0].As()->Value()); args.GetReturnValue().Set( String::NewFromUtf8(env->isolate(), u_errorName(status), diff --git a/src/node_process.cc b/src/node_process.cc index 087a7a773eb8c3..ba774fd8fa652e 100644 --- a/src/node_process.cc +++ b/src/node_process.cc @@ -165,12 +165,15 @@ void HrtimeBigInt(const FunctionCallbackInfo& args) { void Kill(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); + Local context = env->context(); if (args.Length() != 2) return env->ThrowError("Bad argument."); - int pid = args[0]->Int32Value(); - int sig = args[1]->Int32Value(); + int pid; + if (!args[0]->Int32Value(context).To(&pid)) return; + int sig; + if (!args[1]->Int32Value(context).To(&sig)) return; int err = uv_kill(pid, sig); args.GetReturnValue().Set(err); } diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 482375cd6169ba..cd15603f0b036d 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -45,6 +45,7 @@ using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; +using v8::Int32; using v8::Local; using v8::Number; using v8::Object; @@ -419,7 +420,8 @@ class ZCtx : public AsyncWrap, public ThreadPoolWork { static void New(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); CHECK(args[0]->IsInt32()); - node_zlib_mode mode = static_cast(args[0]->Int32Value()); + node_zlib_mode mode = + static_cast(args[0].As()->Value()); new ZCtx(env, args.This(), mode); } @@ -459,7 +461,8 @@ class ZCtx : public AsyncWrap, public ThreadPoolWork { "invalid windowBits"); } - int level = args[1]->Int32Value(); + int level; + if (!args[1]->Int32Value(context).To(&level)) return; CHECK((level >= Z_MIN_LEVEL && level <= Z_MAX_LEVEL) && "invalid compression level"); @@ -506,7 +509,12 @@ class ZCtx : public AsyncWrap, public ThreadPoolWork { CHECK(args.Length() == 2 && "params(level, strategy)"); ZCtx* ctx; ASSIGN_OR_RETURN_UNWRAP(&ctx, args.Holder()); - ctx->Params(args[0]->Int32Value(), args[1]->Int32Value()); + Environment* env = ctx->env(); + int level; + if (!args[0]->Int32Value(env->context()).To(&level)) return; + int strategy; + if (!args[1]->Int32Value(env->context()).To(&strategy)) return; + ctx->Params(level, strategy); } static void Reset(const FunctionCallbackInfo &args) { diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 8fcf7007f59df7..00c0eef6549464 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -173,7 +173,8 @@ void PipeWrap::Bind(const FunctionCallbackInfo& args) { void PipeWrap::SetPendingInstances(const FunctionCallbackInfo& args) { PipeWrap* wrap; ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); - int instances = args[0]->Int32Value(); + CHECK(args[0]->IsInt32()); + int instances = args[0].As()->Value(); uv_pipe_pending_instances(&wrap->handle_, instances); } #endif @@ -193,7 +194,9 @@ void PipeWrap::Fchmod(const v8::FunctionCallbackInfo& args) { void PipeWrap::Listen(const FunctionCallbackInfo& args) { PipeWrap* wrap; ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); - int backlog = args[0]->Int32Value(); + Environment* env = wrap->env(); + int backlog; + if (!args[0]->Int32Value(env->context()).To(&backlog)) return; int err = uv_listen(reinterpret_cast(&wrap->handle_), backlog, OnConnection); @@ -207,7 +210,8 @@ void PipeWrap::Open(const FunctionCallbackInfo& args) { PipeWrap* wrap; ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); - int fd = args[0]->Int32Value(); + int fd; + if (!args[0]->Int32Value(env->context()).To(&fd)) return; int err = uv_pipe_open(&wrap->handle_, fd); wrap->set_fd(fd); diff --git a/src/process_wrap.cc b/src/process_wrap.cc index e06afd84ffb7c8..70f656ae5e67d3 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -36,6 +36,7 @@ using v8::Context; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; +using v8::Int32; using v8::Integer; using v8::Local; using v8::Number; @@ -158,7 +159,7 @@ class ProcessWrap : public HandleWrap { js_options->Get(context, env->uid_string()).ToLocalChecked(); if (!uid_v->IsUndefined() && !uid_v->IsNull()) { CHECK(uid_v->IsInt32()); - const int32_t uid = uid_v->Int32Value(context).FromJust(); + const int32_t uid = uid_v.As()->Value(); options.flags |= UV_PROCESS_SETUID; options.uid = static_cast(uid); } @@ -168,7 +169,7 @@ class ProcessWrap : public HandleWrap { js_options->Get(context, env->gid_string()).ToLocalChecked(); if (!gid_v->IsUndefined() && !gid_v->IsNull()) { CHECK(gid_v->IsInt32()); - const int32_t gid = gid_v->Int32Value(context).FromJust(); + const int32_t gid = gid_v.As()->Value(); options.flags |= UV_PROCESS_SETGID; options.gid = static_cast(gid); } diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc index 0ba3fb3ceb7990..78b4155fd59640 100644 --- a/src/signal_wrap.cc +++ b/src/signal_wrap.cc @@ -88,7 +88,9 @@ class SignalWrap : public HandleWrap { static void Start(const FunctionCallbackInfo& args) { SignalWrap* wrap; ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); - int signum = args[0]->Int32Value(); + Environment* env = wrap->env(); + int signum; + if (!args[0]->Int32Value(env->context()).To(&signum)) return; #if defined(__POSIX__) && HAVE_INSPECTOR if (signum == SIGPROF) { Environment* env = Environment::GetCurrent(args); diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc index 77449b9569d9cd..46d895e38a7389 100644 --- a/src/spawn_sync.cc +++ b/src/spawn_sync.cc @@ -35,6 +35,7 @@ using v8::Context; using v8::EscapableHandleScope; using v8::FunctionCallbackInfo; using v8::HandleScope; +using v8::Int32; using v8::Integer; using v8::Isolate; using v8::Just; @@ -783,7 +784,7 @@ Maybe SyncProcessRunner::ParseOptions(Local js_value) { js_options->Get(context, env()->uid_string()).ToLocalChecked(); if (IsSet(js_uid)) { CHECK(js_uid->IsInt32()); - const int32_t uid = js_uid->Int32Value(context).FromJust(); + const int32_t uid = js_uid.As()->Value(); uv_process_options_.uid = static_cast(uid); uv_process_options_.flags |= UV_PROCESS_SETUID; } @@ -792,7 +793,7 @@ Maybe SyncProcessRunner::ParseOptions(Local js_value) { js_options->Get(context, env()->gid_string()).ToLocalChecked(); if (IsSet(js_gid)) { CHECK(js_gid->IsInt32()); - const int32_t gid = js_gid->Int32Value(context).FromJust(); + const int32_t gid = js_gid.As()->Value(); uv_process_options_.gid = static_cast(gid); uv_process_options_.flags |= UV_PROCESS_SETGID; } @@ -833,7 +834,7 @@ Maybe SyncProcessRunner::ParseOptions(Local js_value) { js_options->Get(context, env()->kill_signal_string()).ToLocalChecked(); if (IsSet(js_kill_signal)) { CHECK(js_kill_signal->IsInt32()); - kill_signal_ = js_kill_signal->Int32Value(context).FromJust(); + kill_signal_ = js_kill_signal.As()->Value(); } Local js_stdio = diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index 7b544d153144c9..dd507e6ebde6f4 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -180,7 +180,9 @@ void TCPWrap::SetKeepAlive(const FunctionCallbackInfo& args) { ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder(), args.GetReturnValue().Set(UV_EBADF)); - int enable = args[0]->Int32Value(); + Environment* env = wrap->env(); + int enable; + if (!args[0]->Int32Value(env->context()).To(&enable)) return; unsigned int delay = args[1].As()->Value(); int err = uv_tcp_keepalive(&wrap->handle_, enable, delay); args.GetReturnValue().Set(err); @@ -220,8 +222,10 @@ void TCPWrap::Bind(const FunctionCallbackInfo& args) { ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder(), args.GetReturnValue().Set(UV_EBADF)); - node::Utf8Value ip_address(args.GetIsolate(), args[0]); - int port = args[1]->Int32Value(); + Environment* env = wrap->env(); + node::Utf8Value ip_address(env->isolate(), args[0]); + int port; + if (!args[1]->Int32Value(env->context()).To(&port)) return; sockaddr_in addr; int err = uv_ip4_addr(*ip_address, port, &addr); if (err == 0) { @@ -238,8 +242,10 @@ void TCPWrap::Bind6(const FunctionCallbackInfo& args) { ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder(), args.GetReturnValue().Set(UV_EBADF)); - node::Utf8Value ip6_address(args.GetIsolate(), args[0]); - int port = args[1]->Int32Value(); + Environment* env = wrap->env(); + node::Utf8Value ip6_address(env->isolate(), args[0]); + int port; + if (!args[1]->Int32Value(env->context()).To(&port)) return; sockaddr_in6 addr; int err = uv_ip6_addr(*ip6_address, port, &addr); if (err == 0) { @@ -256,7 +262,9 @@ void TCPWrap::Listen(const FunctionCallbackInfo& args) { ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder(), args.GetReturnValue().Set(UV_EBADF)); - int backlog = args[0]->Int32Value(); + Environment* env = wrap->env(); + int backlog; + if (!args[0]->Int32Value(env->context()).To(&backlog)) return; int err = uv_listen(reinterpret_cast(&wrap->handle_), backlog, OnConnection); @@ -300,12 +308,11 @@ void TCPWrap::Connect(const FunctionCallbackInfo& args) { void TCPWrap::Connect6(const FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - TCPWrap* wrap; ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder(), args.GetReturnValue().Set(UV_EBADF)); + Environment* env = wrap->env(); CHECK(args[0]->IsObject()); CHECK(args[1]->IsString()); @@ -313,7 +320,8 @@ void TCPWrap::Connect6(const FunctionCallbackInfo& args) { Local req_wrap_obj = args[0].As(); node::Utf8Value ip_address(env->isolate(), args[1]); - int port = args[2]->Int32Value(); + int port; + if (!args[2]->Int32Value(env->context()).To(&port)) return; sockaddr_in6 addr; int err = uv_ip6_addr(*ip_address, port, &addr); diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index f1cfa300f8f215..8151ba02a2aae4 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -75,7 +75,8 @@ uv_tty_t* TTYWrap::UVHandle() { void TTYWrap::GuessHandleType(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - int fd = args[0]->Int32Value(); + int fd; + if (!args[0]->Int32Value(env->context()).To(&fd)) return; CHECK_GE(fd, 0); uv_handle_type t = uv_guess_handle(fd); @@ -97,7 +98,9 @@ void TTYWrap::GuessHandleType(const FunctionCallbackInfo& args) { void TTYWrap::IsTTY(const FunctionCallbackInfo& args) { - int fd = args[0]->Int32Value(); + Environment* env = Environment::GetCurrent(args); + int fd; + if (!args[0]->Int32Value(env->context()).To(&fd)) return; CHECK_GE(fd, 0); bool rc = uv_guess_handle(fd) == UV_TTY; args.GetReturnValue().Set(rc); @@ -144,7 +147,8 @@ void TTYWrap::New(const FunctionCallbackInfo& args) { // normal function. CHECK(args.IsConstructCall()); - int fd = args[0]->Int32Value(); + int fd; + if (!args[0]->Int32Value(env->context()).To(&fd)) return; CHECK_GE(fd, 0); int err = 0; diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 27d4c7959c3f87..c7ca7fc44d67de 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -267,14 +267,17 @@ void UDPWrap::BufferSize(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(size); } - -#define X(name, fn) \ - void UDPWrap::name(const FunctionCallbackInfo& args) { \ - UDPWrap* wrap = Unwrap(args.Holder()); \ - CHECK_EQ(args.Length(), 1); \ - int flag = args[0]->Int32Value(); \ - int err = wrap == nullptr ? UV_EBADF : fn(&wrap->handle_, flag); \ - args.GetReturnValue().Set(err); \ +#define X(name, fn) \ + void UDPWrap::name(const FunctionCallbackInfo& args) { \ + UDPWrap* wrap = Unwrap(args.Holder()); \ + Environment* env = wrap->env(); \ + CHECK_EQ(args.Length(), 1); \ + int flag; \ + if (!args[0]->Int32Value(env->context()).To(&flag)) { \ + return; \ + } \ + int err = wrap == nullptr ? UV_EBADF : fn(&wrap->handle_, flag); \ + args.GetReturnValue().Set(err); \ } X(SetTTL, uv_udp_set_ttl) diff --git a/src/uv.cc b/src/uv.cc index 45791b28a935f0..da67fce80390eb 100644 --- a/src/uv.cc +++ b/src/uv.cc @@ -43,7 +43,8 @@ using v8::Value; // lib/util.getSystemErrorName() void ErrName(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - int err = args[0]->Int32Value(); + int err; + if (!args[0]->Int32Value(env->context()).To(&err)) return; CHECK_LT(err, 0); const char* name = uv_err_name(err); args.GetReturnValue().Set(OneByteString(env->isolate(), name)); diff --git a/test/parallel/test-http-parser-bad-ref.js b/test/parallel/test-http-parser-bad-ref.js index 60151c63488143..b44bc3f453a325 100644 --- a/test/parallel/test-http-parser-bad-ref.js +++ b/test/parallel/test-http-parser-bad-ref.js @@ -25,7 +25,7 @@ function flushPool() { function demoBug(part1, part2) { flushPool(); - const parser = new HTTPParser('REQUEST'); + const parser = new HTTPParser(0); parser.headers = []; parser.url = ''; diff --git a/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js index a3acda54a1ca9a..aac356df2a00ed 100644 --- a/test/sequential/test-async-wrap-getasyncid.js +++ b/test/sequential/test-async-wrap-getasyncid.js @@ -148,7 +148,7 @@ if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check { const { HTTPParser } = internalBinding('http_parser'); - testInitialized(new HTTPParser(), 'HTTPParser'); + testInitialized(new HTTPParser(0), 'HTTPParser'); }