mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
worker: refactor to avoid unsafe array iteration
PR-URL: https://github.com/nodejs/node/pull/37346 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Harshitha K P <harshitha014@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
9417fd0bc8
commit
698bffaa90
1 file changed
+3
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
const {
|
||||
ArrayPrototypeConcat,
|
||||
ArrayPrototypeForEach,
|
||||
ArrayPrototypeSplice,
|
||||
ObjectDefineProperty,
|
||||
PromisePrototypeCatch,
|
||||
@@ -181,8 +182,9 @@ port.on('message', (message) => {
|
||||
}
|
||||
} else if (message.type === STDIO_PAYLOAD) {
|
||||
const { stream, chunks } = message;
|
||||
for (const { chunk, encoding } of chunks)
|
||||
ArrayPrototypeForEach(chunks, ({ chunk, encoding }) => {
|
||||
process[stream].push(chunk, encoding);
|
||||
});
|
||||
} else {
|
||||
assert(
|
||||
message.type === STDIO_WANTS_MORE_DATA,
|
||||
|
||||
Reference in new issue
Block a user