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>
This commit is contained in:
parent
a84e0ec0dd
commit
0043c6f548
@ -708,7 +708,9 @@ void ModuleWrap::Resolve(const FunctionCallbackInfo<Value>& args) {
|
|||||||
return node::THROW_ERR_MISSING_MODULE(env, msg.c_str());
|
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(
|
static MaybeLocal<Promise> ImportModuleDynamically(
|
||||||
|
@ -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
|
// 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
|
// returns the JS URL object. Be mindful of the JS<->Native boundary
|
||||||
// crossing that is required.
|
// crossing that is required.
|
||||||
const Local<Value> URL::ToObject(Environment* env) const {
|
MaybeLocal<Value> URL::ToObject(Environment* env) const {
|
||||||
Isolate* isolate = env->isolate();
|
Isolate* isolate = env->isolate();
|
||||||
Local<Context> context = env->context();
|
Local<Context> context = env->context();
|
||||||
Context::Scope context_scope(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);
|
->Call(env->context(), undef, arraysize(argv), argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret.ToLocalChecked();
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetURLConstructor(const FunctionCallbackInfo<Value>& args) {
|
static void SetURLConstructor(const FunctionCallbackInfo<Value>& args) {
|
||||||
|
@ -11,10 +11,6 @@
|
|||||||
namespace node {
|
namespace node {
|
||||||
namespace url {
|
namespace url {
|
||||||
|
|
||||||
using v8::Local;
|
|
||||||
using v8::Value;
|
|
||||||
|
|
||||||
|
|
||||||
#define PARSESTATES(XX) \
|
#define PARSESTATES(XX) \
|
||||||
XX(kSchemeStart) \
|
XX(kSchemeStart) \
|
||||||
XX(kScheme) \
|
XX(kScheme) \
|
||||||
@ -171,7 +167,7 @@ class URL {
|
|||||||
// Get the file URL from native file system path.
|
// Get the file URL from native file system path.
|
||||||
static URL FromFilePath(const std::string& file_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(const URL&) = default;
|
||||||
URL& operator=(const URL&) = default;
|
URL& operator=(const URL&) = default;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user