Skip to content

Commit

Permalink
bind hooks to null
Browse files Browse the repository at this point in the history
nodejs#35524 did this (not sure whether it's necessary)
  • Loading branch information
JakobJingleheimer committed Apr 18, 2021
1 parent e7093f7 commit d921030
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/internal/modules/esm/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,20 @@ class ESMLoader {

if (globalPreloader) ArrayPrototypePush(
this.#globalPreloaders,
globalPreloader,
FunctionPrototypeBind(globalPreloader, null), // [1]
);
if (resolver) ArrayPrototypePush(
this.#resolvers,
resolver,
FunctionPrototypeBind(resolver, null), // [1]
);
if (loader) ArrayPrototypePush(
this.#loaders,
loader,
FunctionPrototypeBind(loader, null), // [1]
);
}

// [1] ensure hook function is not bound to ESMLoader instance

this.preload();
}

Expand Down

0 comments on commit d921030

Please sign in to comment.