GeezerVison is showing github.com — util: fix crashing when emitting new Buffer() deprecation warning #53075 · nodejs/node@c55e72e
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/util.js +8-4Lines changed: 8 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -37,6 +37,7 @@ const { |
37 | 37 | SafeWeakRef, |
38 | 38 | StringPrototypeIncludes, |
39 | 39 | StringPrototypeReplace, |
| 40 | + StringPrototypeStartsWith, |
40 | 41 | StringPrototypeToLowerCase, |
41 | 42 | StringPrototypeToUpperCase, |
42 | 43 | Symbol, |
@@ -515,11 +516,14 @@ function isInsideNodeModules() { |
515 | 516 | if (ArrayIsArray(stack)) { |
516 | 517 | for (const frame of stack) { |
517 | 518 | const filename = frame.getFileName(); |
518 | | - // If a filename does not start with / or contain \, |
519 | | - // it's likely from Node.js core. |
| 519 | + |
520 | 520 | 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 | + ) |
523 | 527 | ) { |
524 | 528 | continue; |
525 | 529 | } |
|