| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 29bc735 commit 3962c73
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -356,16 +356,17 @@ function isInsideNodeModules() { | |||
| 356 | 356 | ||
| 357 | 357 | // Iterate over all stack frames and look for the first one not coming | |
| 358 | 358 | // from inside Node.js itself: | |
| 359 | - for (const frame of stack) { | ||
| 360 | - const filename = frame.getFileName(); | ||
| 361 | - // If a filename does not start with / or contain \, | ||
| 362 | - // it's likely from Node.js core. | ||
| 363 | - if (!/^\/|\\/.test(filename)) | ||
| 364 | - continue; | ||
| 365 | - return kNodeModulesRE.test(filename); | ||
| 359 | + if (Array.isArray(stack)) { | ||
| 360 | + for (const frame of stack) { | ||
| 361 | + const filename = frame.getFileName(); | ||
| 362 | + // If a filename does not start with / or contain \, | ||
| 363 | + // it's likely from Node.js core. | ||
| 364 | + if (!/^\/|\\/.test(filename)) | ||
| 365 | + continue; | ||
| 366 | + return kNodeModulesRE.test(filename); | ||
| 367 | + } | ||
| 366 | 368 | } | |
| 367 | - | ||
| 368 | - return false; // This should be unreachable. | ||
| 369 | + return false; | ||
| 369 | 370 | } | |
| 370 | 371 | ||
| 371 | 372 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,17 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + | ||
| 5 | + const bufferWarning = 'Buffer() is deprecated due to security and usability ' + | ||
| 6 | + 'issues. Please use the Buffer.alloc(), ' + | ||
| 7 | + 'Buffer.allocUnsafe(), or Buffer.from() methods instead.'; | ||
| 8 | + | ||
| 9 | + common.expectWarning('DeprecationWarning', bufferWarning, 'DEP0005'); | ||
| 10 | + | ||
| 11 | + // This is used to make sure that a warning is only emitted once even though | ||
| 12 | + // `new Buffer()` is called twice. | ||
| 13 | + process.on('warning', common.mustCall()); | ||
| 14 | + | ||
| 15 | + Error.prepareStackTrace = (err, trace) => new Buffer(10); | ||
| 16 | + | ||
| 17 | + new Error().stack; | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments