GeezerVison is showing github.com — util: fix crashing when emitting new Buffer() deprecation warning #53075 · nodejs/node@ce877c6
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, |
@@ -502,11 +503,14 @@ function isInsideNodeModules() { |
502 | 503 | if (ArrayIsArray(stack)) { |
503 | 504 | for (const frame of stack) { |
504 | 505 | const filename = frame.getFileName(); |
505 | | - // If a filename does not start with / or contain \, |
506 | | - // it's likely from Node.js core. |
| 506 | + |
507 | 507 | if ( |
508 | | - filename[0] !== '/' && |
509 | | - StringPrototypeIncludes(filename, '\\') === false |
| 508 | + filename == null || |
| 509 | + StringPrototypeStartsWith(filename, 'node:') === true || |
| 510 | + ( |
| 511 | + filename[0] !== '/' && |
| 512 | + StringPrototypeIncludes(filename, '\\') === false |
| 513 | + ) |
510 | 514 | ) { |
511 | 515 | continue; |
512 | 516 | } |
|