Skip to content

Commit 6cad1d2

Browse files
committed
lib: add Promise methods to avoid-prototype-pollution lint rule
nodejs/node#43849
1 parent 1ae2279 commit 6cad1d2

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

patches/node/repl_fix_crash_when_sharedarraybuffer_disabled.patch

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,27 @@ index a771b1813731edf4f0dd60f3505799e389f1d876..b9461677e2d7d1df192e752496e62cca
2525
bench.start();
2626
for (let i = 0; i < n; i++)
2727
diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js
28-
index e21c1b1fe2cc7f55d3782419913568f51f1a87ea..1b6a8242bbd9eeb901950f1b9016bc2b85af5951 100644
28+
index f7ead4084ed4ed6a682bc62e7ad6fc350381d3b9..200da882076c9e099b221a33b4b933a6db906640 100644
2929
--- a/lib/internal/main/worker_thread.js
3030
+++ b/lib/internal/main/worker_thread.js
31-
@@ -9,7 +9,7 @@ const {
32-
ArrayPrototypeSplice,
31+
@@ -10,7 +10,7 @@ const {
3332
ObjectDefineProperty,
34-
PromisePrototypeCatch,
33+
PromisePrototypeThen,
34+
RegExpPrototypeExec,
3535
- globalThis: { Atomics },
3636
+ globalThis: { Atomics, SharedArrayBuffer },
3737
} = primordials;
3838

3939
const {
40-
@@ -150,6 +150,9 @@ port.on('message', (message) => {
41-
const originalCwd = process.cwd;
40+
@@ -156,6 +156,8 @@ port.on('message', (message) => {
4241

4342
process.cwd = function() {
43+
const currentCounter = Atomics.load(cwdCounter, 0);
4444
+ // SharedArrayBuffers can be disabled with --no-harmony-sharedarraybuffer.
4545
+ if (typeof SharedArrayBuffer === 'undefined') return originalCwd();
46-
+
47-
const currentCounter = Atomics.load(cwdCounter, 0);
4846
if (currentCounter === lastCounter)
4947
return cachedCwd;
48+
lastCounter = currentCounter;
5049
diff --git a/lib/internal/worker.js b/lib/internal/worker.js
5150
index 8e396195209b83dff572792a78ee75d12d1f6610..4bb09b6ab5c31206a622814cbcd793c434b885d4 100644
5251
--- a/lib/internal/worker.js

0 commit comments

Comments
 (0)