From a24264eb18962a1fdbc5a4d10fd7bcf65a401a54 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 28 Jan 2017 21:18:55 -0800 Subject: [PATCH] src: fix v8 local handling in node_url.cc Calling `.As()` on a non-object aborts in debug mode, but `node_url.cc` relied on it. Address that by using `Local` 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 Reviewed-By: Timothy Gu Reviewed-By: Joyee Cheung Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- src/node_url.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/node_url.cc b/src/node_url.cc index 92cb8efbb84389..7f21051c54e5ac 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -636,8 +636,8 @@ namespace url { const char* input, const size_t len, enum url_parse_state override, - Local base_obj, - Local context_obj, + Local base_obj, + Local context_obj, Local cb) { Isolate* isolate = env->isolate(); Local context = env->context(); @@ -654,9 +654,9 @@ namespace url { struct url_data base; struct url_data url; if (context_obj->IsObject()) - HarvestContext(env, &url, context_obj); + HarvestContext(env, &url, context_obj.As()); if (has_base) - HarvestBase(env, &base, base_obj); + HarvestBase(env, &base, base_obj.As()); std::string buffer; url.scheme.reserve(len); @@ -1321,8 +1321,8 @@ namespace url { Parse(env, args.This(), *input, input.length(), override, - args[2].As(), - args[3].As(), + args[2], + args[3], args[4].As()); }