Skip to content

Commit d921030

Browse files
bind hooks to null
nodejs#35524 did this (not sure whether it's necessary)
1 parent e7093f7 commit d921030

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/internal/modules/esm/loader.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,20 @@ class ESMLoader {
145145

146146
if (globalPreloader) ArrayPrototypePush(
147147
this.#globalPreloaders,
148-
globalPreloader,
148+
FunctionPrototypeBind(globalPreloader, null), // [1]
149149
);
150150
if (resolver) ArrayPrototypePush(
151151
this.#resolvers,
152-
resolver,
152+
FunctionPrototypeBind(resolver, null), // [1]
153153
);
154154
if (loader) ArrayPrototypePush(
155155
this.#loaders,
156-
loader,
156+
FunctionPrototypeBind(loader, null), // [1]
157157
);
158158
}
159159

160+
// [1] ensure hook function is not bound to ESMLoader instance
161+
160162
this.preload();
161163
}
162164

0 commit comments

Comments
 (0)