lib: make safe primordials safe to iterate

PR-URL: https://github.com/nodejs/node/pull/36391
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Antoine du Hamel
2020-12-04 12:35:49 +01:00
committed by Node.js GitHub Bot
parent 7c808170f5
commit 0a5969c62a
4 changed files with 55 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
'use strict';
const {
ArrayPrototypeForEach,
ArrayPrototypeMap,
ArrayPrototypePush,
FunctionPrototypeBind,
@@ -315,8 +316,7 @@ class WritableWorkerStdio extends Writable {
[kStdioWantsMoreDataCallback]() {
const cbs = this[kWritableCallbacks];
this[kWritableCallbacks] = [];
for (const cb of cbs)
cb();
ArrayPrototypeForEach(cbs, (cb) => cb());
if ((this[kPort][kWaitingStreams] -= cbs.length) === 0)
this[kPort].unref();
}