diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-12-19 23:11:35 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-12-31 01:10:36 +0100 |
commit | 0043c6f5482993f7d91d6a78edeb310147895fb5 (patch) | |
tree | e08a22ae1593c16275f13103e67f7e07b227b464 /src | |
parent | a84e0ec0dd20d0585d5c626f7ba333eb38d2221a (diff) | |
download | android-node-v8-0043c6f5482993f7d91d6a78edeb310147895fb5.tar.gz android-node-v8-0043c6f5482993f7d91d6a78edeb310147895fb5.tar.bz2 android-node-v8-0043c6f5482993f7d91d6a78edeb310147895fb5.zip |
src: pass along MaybeLocal<> state from `URL::ToObject()`
PR-URL: https://github.com/nodejs/node/pull/25141
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'src')
-rw-r--r-- | src/module_wrap.cc | 4 | ||||
-rw-r--r-- | src/node_url.cc | 4 | ||||
-rw-r--r-- | src/node_url.h | 6 |
3 files changed, 6 insertions, 8 deletions
diff --git a/src/module_wrap.cc b/src/module_wrap.cc index 3860ec745e..243352fe64 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -708,7 +708,9 @@ void ModuleWrap::Resolve(const FunctionCallbackInfo<Value>& args) { return node::THROW_ERR_MISSING_MODULE(env, msg.c_str()); } - args.GetReturnValue().Set(result.FromJust().ToObject(env)); + MaybeLocal<Value> obj = result.FromJust().ToObject(env); + if (!obj.IsEmpty()) + args.GetReturnValue().Set(obj.ToLocalChecked()); } static MaybeLocal<Promise> ImportModuleDynamically( diff --git a/src/node_url.cc b/src/node_url.cc index d5dba61ae4..d028a66dbe 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -2381,7 +2381,7 @@ URL URL::FromFilePath(const std::string& file_path) { // This function works by calling out to a JS function that creates and // returns the JS URL object. Be mindful of the JS<->Native boundary // crossing that is required. -const Local<Value> URL::ToObject(Environment* env) const { +MaybeLocal<Value> URL::ToObject(Environment* env) const { Isolate* isolate = env->isolate(); Local<Context> context = env->context(); Context::Scope context_scope(context); @@ -2417,7 +2417,7 @@ const Local<Value> URL::ToObject(Environment* env) const { ->Call(env->context(), undef, arraysize(argv), argv); } - return ret.ToLocalChecked(); + return ret; } static void SetURLConstructor(const FunctionCallbackInfo<Value>& args) { diff --git a/src/node_url.h b/src/node_url.h index 055393d22e..47b859b879 100644 --- a/src/node_url.h +++ b/src/node_url.h @@ -11,10 +11,6 @@ namespace node { namespace url { -using v8::Local; -using v8::Value; - - #define PARSESTATES(XX) \ XX(kSchemeStart) \ XX(kScheme) \ @@ -171,7 +167,7 @@ class URL { // Get the file URL from native file system path. static URL FromFilePath(const std::string& file_path); - const Local<Value> ToObject(Environment* env) const; + v8::MaybeLocal<v8::Value> ToObject(Environment* env) const; URL(const URL&) = default; URL& operator=(const URL&) = default; |