Skip to content

Commit

Permalink
util: fix WASM crashes on Node v22.2.0 if it reaches the new Buffer()…
Browse files Browse the repository at this point in the history
… deprecation warning nodejs#53075
  • Loading branch information
Uzlopak committed May 21, 2024
1 parent a7dad43 commit b175a73
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/internal/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const {
SafeWeakRef,
StringPrototypeIncludes,
StringPrototypeReplace,
StringPrototypeStartsWith,
StringPrototypeToLowerCase,
StringPrototypeToUpperCase,
Symbol,
Expand Down Expand Up @@ -515,11 +516,14 @@ function isInsideNodeModules() {
if (ArrayIsArray(stack)) {
for (const frame of stack) {
const filename = frame.getFileName();
// If a filename does not start with / or contain \,
// it's likely from Node.js core.

if (
filename[0] !== '/' &&
StringPrototypeIncludes(filename, '\\') === false
filename == null ||
StringPrototypeStartsWith(filename, 'node:') === true ||
(
filename[0] !== '/' &&
StringPrototypeIncludes(filename, '\\') === false
)
) {
continue;
}
Expand Down

0 comments on commit b175a73

Please sign in to comment.