lib: refactor to avoid unsafe array iteration

PR-URL: https://github.com/nodejs/node/pull/40271
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
Antoine du Hamel
2021-09-30 23:13:32 +02:00
committed by Node.js GitHub Bot
parent 5ae72b712c
commit e2382d0ce0

View File

@@ -2,6 +2,7 @@
const {
ArrayPrototypePush,
ArrayPrototypePushApply,
ArrayPrototypeSlice,
StringPrototypeSlice,
} = primordials;
@@ -27,8 +28,8 @@ async function linker(specifier, referencingModule) {
} else if (process.platform === 'win32') {
ArrayPrototypePush(tickArguments, '--windows');
}
ArrayPrototypePush(tickArguments,
...ArrayPrototypeSlice(process.argv, 1));
ArrayPrototypePushApply(tickArguments,
ArrayPrototypeSlice(process.argv, 1));
const context = vm.createContext({
arguments: tickArguments,