Skip to content

Commit c55e72e

Browse files
Uzlopakaduh95
authored andcommitted
util: fix crashing when emitting new Buffer() deprecation warning #53075
PR-URL: #53089 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Tim Perry <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent dc99dd3 commit c55e72e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/internal/util.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const {
3737
SafeWeakRef,
3838
StringPrototypeIncludes,
3939
StringPrototypeReplace,
40+
StringPrototypeStartsWith,
4041
StringPrototypeToLowerCase,
4142
StringPrototypeToUpperCase,
4243
Symbol,
@@ -515,11 +516,14 @@ function isInsideNodeModules() {
515516
if (ArrayIsArray(stack)) {
516517
for (const frame of stack) {
517518
const filename = frame.getFileName();
518-
// If a filename does not start with / or contain \,
519-
// it's likely from Node.js core.
519+
520520
if (
521-
filename[0] !== '/' &&
522-
StringPrototypeIncludes(filename, '\\') === false
521+
filename == null ||
522+
StringPrototypeStartsWith(filename, 'node:') === true ||
523+
(
524+
filename[0] !== '/' &&
525+
StringPrototypeIncludes(filename, '\\') === false
526+
)
523527
) {
524528
continue;
525529
}

0 commit comments

Comments
 (0)