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 bc0eb0a

Browse filesBrowse files
targosBethGriggs
authored andcommitted
src: make LoadEnvironment with string work with builtin modules path
Fixes: #40605 PR-URL: #40607 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 64c6575 commit bc0eb0a
Copy full SHA for bc0eb0a

File tree

Expand file treeCollapse file tree

1 file changed

+10
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-7
lines changed
Open diff view settings
Collapse file

‎src/node_native_module.cc‎

Copy file name to clipboardExpand all lines: src/node_native_module.cc
+10-7Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,16 @@ static std::string OnDiskFileName(const char* id) {
207207
MaybeLocal<String> NativeModuleLoader::LoadBuiltinModuleSource(Isolate* isolate,
208208
const char* id) {
209209
#ifdef NODE_BUILTIN_MODULES_PATH
210+
if (strncmp(id, "embedder_main_", strlen("embedder_main_")) == 0) {
211+
#endif // NODE_BUILTIN_MODULES_PATH
212+
const auto source_it = source_.find(id);
213+
if (UNLIKELY(source_it == source_.end())) {
214+
fprintf(stderr, "Cannot find native builtin: \"%s\".\n", id);
215+
ABORT();
216+
}
217+
return source_it->second.ToStringChecked(isolate);
218+
#ifdef NODE_BUILTIN_MODULES_PATH
219+
}
210220
std::string filename = OnDiskFileName(id);
211221

212222
std::string contents;
@@ -222,13 +232,6 @@ MaybeLocal<String> NativeModuleLoader::LoadBuiltinModuleSource(Isolate* isolate,
222232
}
223233
return String::NewFromUtf8(
224234
isolate, contents.c_str(), v8::NewStringType::kNormal, contents.length());
225-
#else
226-
const auto source_it = source_.find(id);
227-
if (UNLIKELY(source_it == source_.end())) {
228-
fprintf(stderr, "Cannot find native builtin: \"%s\".\n", id);
229-
ABORT();
230-
}
231-
return source_it->second.ToStringChecked(isolate);
232235
#endif // NODE_BUILTIN_MODULES_PATH
233236
}
234237

0 commit comments

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