src: fix v8 local handling in node_url.cc
Calling `.As<Object>()` on a non-object aborts in debug mode, but `node_url.cc` relied on it. Address that by using `Local<Value>` until it has been confirmed that the handle actually is an object. PR-URL: https://github.com/nodejs/node/pull/11064 Reviewed-By: Michal Zasso <targos@protonmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
a7172b5d3c
commit
0d290a2ae0
@ -636,8 +636,8 @@ namespace url {
|
|||||||
const char* input,
|
const char* input,
|
||||||
const size_t len,
|
const size_t len,
|
||||||
enum url_parse_state override,
|
enum url_parse_state override,
|
||||||
Local<Object> base_obj,
|
Local<Value> base_obj,
|
||||||
Local<Object> context_obj,
|
Local<Value> context_obj,
|
||||||
Local<Function> cb) {
|
Local<Function> cb) {
|
||||||
Isolate* isolate = env->isolate();
|
Isolate* isolate = env->isolate();
|
||||||
Local<Context> context = env->context();
|
Local<Context> context = env->context();
|
||||||
@ -654,9 +654,9 @@ namespace url {
|
|||||||
struct url_data base;
|
struct url_data base;
|
||||||
struct url_data url;
|
struct url_data url;
|
||||||
if (context_obj->IsObject())
|
if (context_obj->IsObject())
|
||||||
HarvestContext(env, &url, context_obj);
|
HarvestContext(env, &url, context_obj.As<Object>());
|
||||||
if (has_base)
|
if (has_base)
|
||||||
HarvestBase(env, &base, base_obj);
|
HarvestBase(env, &base, base_obj.As<Object>());
|
||||||
|
|
||||||
std::string buffer;
|
std::string buffer;
|
||||||
url.scheme.reserve(len);
|
url.scheme.reserve(len);
|
||||||
@ -1321,8 +1321,8 @@ namespace url {
|
|||||||
Parse(env, args.This(),
|
Parse(env, args.This(),
|
||||||
*input, input.length(),
|
*input, input.length(),
|
||||||
override,
|
override,
|
||||||
args[2].As<Object>(),
|
args[2],
|
||||||
args[3].As<Object>(),
|
args[3],
|
||||||
args[4].As<Function>());
|
args[4].As<Function>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user