diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2023-03-13 19:24:31 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-13 19:24:31 +0900 |
commit | e5673f5ed85774831234fe70290d5802bbd47c15 (patch) | |
tree | 59a8deb3e81bc596ec73afcaae01de9a1cb1e845 /cli/tests/unit | |
parent | bcb6ee9d0864f490f6da47cbe2593310b21333ff (diff) |
fix(core): `SafePromiseAll` to be unaffected by `Array#@@iterator` (#17542)
Diffstat (limited to 'cli/tests/unit')
-rw-r--r-- | cli/tests/unit/command_test.ts | 6 | ||||
-rw-r--r-- | cli/tests/unit/flash_test.ts | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/cli/tests/unit/command_test.ts b/cli/tests/unit/command_test.ts index b9fa8295b..0763a7ac6 100644 --- a/cli/tests/unit/command_test.ts +++ b/cli/tests/unit/command_test.ts @@ -851,10 +851,11 @@ Deno.test( Deno.test( { permissions: { read: true, run: true } }, - async function commandWithPromisePrototypeThenOverride() { + async function commandWithPrototypePollution() { const originalThen = Promise.prototype.then; + const originalSymbolIterator = Array.prototype[Symbol.iterator]; try { - Promise.prototype.then = () => { + Promise.prototype.then = Array.prototype[Symbol.iterator] = () => { throw new Error(); }; await new Deno.Command(Deno.execPath(), { @@ -862,6 +863,7 @@ Deno.test( }).output(); } finally { Promise.prototype.then = originalThen; + Array.prototype[Symbol.iterator] = originalSymbolIterator; } }, ); diff --git a/cli/tests/unit/flash_test.ts b/cli/tests/unit/flash_test.ts index ebee7a024..d32e0a54f 100644 --- a/cli/tests/unit/flash_test.ts +++ b/cli/tests/unit/flash_test.ts @@ -2272,10 +2272,11 @@ Deno.test( Deno.test( { permissions: { net: true } }, - async function serveWithPromisePrototypeThenOverride() { + async function serveWithPrototypePollution() { const originalThen = Promise.prototype.then; + const originalSymbolIterator = Array.prototype[Symbol.iterator]; try { - Promise.prototype.then = () => { + Promise.prototype.then = Array.prototype[Symbol.iterator] = () => { throw new Error(); }; const ac = new AbortController(); @@ -2292,6 +2293,7 @@ Deno.test( await server; } finally { Promise.prototype.then = originalThen; + Array.prototype[Symbol.iterator] = originalSymbolIterator; } }, ); |