Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e00b326

Browse filesBrowse files
addaleaxtargos
authored andcommitted
src: pass along MaybeLocal<> state from URL::ToObject()
PR-URL: #25141 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
1 parent ae86192 commit e00b326
Copy full SHA for e00b326

File tree

Expand file treeCollapse file tree

3 files changed

+6
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+6
-8
lines changed
Open diff view settings
Collapse file

‎src/module_wrap.cc‎

Copy file name to clipboardExpand all lines: src/module_wrap.cc
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,9 @@ void ModuleWrap::Resolve(const FunctionCallbackInfo<Value>& args) {
708708
return node::THROW_ERR_MISSING_MODULE(env, msg.c_str());
709709
}
710710

711-
args.GetReturnValue().Set(result.FromJust().ToObject(env));
711+
MaybeLocal<Value> obj = result.FromJust().ToObject(env);
712+
if (!obj.IsEmpty())
713+
args.GetReturnValue().Set(obj.ToLocalChecked());
712714
}
713715

714716
static MaybeLocal<Promise> ImportModuleDynamically(
Collapse file

‎src/node_url.cc‎

Copy file name to clipboardExpand all lines: src/node_url.cc
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,7 +2381,7 @@ URL URL::FromFilePath(const std::string& file_path) {
23812381
// This function works by calling out to a JS function that creates and
23822382
// returns the JS URL object. Be mindful of the JS<->Native boundary
23832383
// crossing that is required.
2384-
const Local<Value> URL::ToObject(Environment* env) const {
2384+
MaybeLocal<Value> URL::ToObject(Environment* env) const {
23852385
Isolate* isolate = env->isolate();
23862386
Local<Context> context = env->context();
23872387
Context::Scope context_scope(context);
@@ -2417,7 +2417,7 @@ const Local<Value> URL::ToObject(Environment* env) const {
24172417
->Call(env->context(), undef, arraysize(argv), argv);
24182418
}
24192419

2420-
return ret.ToLocalChecked();
2420+
return ret;
24212421
}
24222422

24232423
static void SetURLConstructor(const FunctionCallbackInfo<Value>& args) {
Collapse file

‎src/node_url.h‎

Copy file name to clipboardExpand all lines: src/node_url.h
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
namespace node {
1212
namespace url {
1313

14-
using v8::Local;
15-
using v8::Value;
16-
17-
1814
#define PARSESTATES(XX) \
1915
XX(kSchemeStart) \
2016
XX(kScheme) \
@@ -171,7 +167,7 @@ class URL {
171167
// Get the file URL from native file system path.
172168
static URL FromFilePath(const std::string& file_path);
173169

174-
const Local<Value> ToObject(Environment* env) const;
170+
v8::MaybeLocal<v8::Value> ToObject(Environment* env) const;
175171

176172
URL(const URL&) = default;
177173
URL& operator=(const URL&) = default;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.