summaryrefslogtreecommitdiff
path: root/ext/fetch/26_fetch.js
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2022-10-29 18:25:23 +0900
committerGitHub <noreply@github.com>2022-10-29 18:25:23 +0900
commit59ac110edd1f376bed7fa6bbdbe2ee09c266bf74 (patch)
treeda654d1ecb6141b620141d634d99ca34c6d568db /ext/fetch/26_fetch.js
parentedaceecec771cf0395639175b5a21d20530f6080 (diff)
fix(core): fix APIs not to be affected by `Promise.prototype.then` modification (#16326)
Diffstat (limited to 'ext/fetch/26_fetch.js')
-rw-r--r--ext/fetch/26_fetch.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/ext/fetch/26_fetch.js b/ext/fetch/26_fetch.js
index 5c824898d..e522079bf 100644
--- a/ext/fetch/26_fetch.js
+++ b/ext/fetch/26_fetch.js
@@ -529,14 +529,15 @@
// 2.6.
// Rather than consuming the body as an ArrayBuffer, this passes each
// chunk to the feed as soon as it's available.
- (async () => {
- const reader = res.body.getReader();
- while (true) {
- const { value: chunk, done } = await reader.read();
- if (done) break;
- ops.op_wasm_streaming_feed(rid, chunk);
- }
- })().then(
+ PromisePrototypeThen(
+ (async () => {
+ const reader = res.body.getReader();
+ while (true) {
+ const { value: chunk, done } = await reader.read();
+ if (done) break;
+ ops.op_wasm_streaming_feed(rid, chunk);
+ }
+ })(),
// 2.7
() => core.close(rid),
// 2.8