summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2022-10-14 11:51:39 +0200
committerGitHub <noreply@github.com>2022-10-14 09:51:39 +0000
commite6e28981909f220ff0b98a13c692c0203eaf6035 (patch)
tree47af99a319746206d61d974e57b5ddab35392dba
parent0d6dbc08bec50aa1548703bf53dc632e0aeefbd6 (diff)
fix(ext/web/streams): enqueue to second branch before closing (#16269)
Co-authored-by: Luca Casonato <hello@lcas.dev>
-rw-r--r--ext/web/06_streams.js9
-rw-r--r--tools/wpt/expectation.json8
2 files changed, 10 insertions, 7 deletions
diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js
index 361e5e055..c783b9518 100644
--- a/ext/web/06_streams.js
+++ b/ext/web/06_streams.js
@@ -2616,6 +2616,7 @@
assert(typeof cloneForBranch2 === "boolean");
const reader = acquireReadableStreamDefaultReader(stream);
let reading = false;
+ let readAgain = false;
let canceled1 = false;
let canceled2 = false;
/** @type {any} */
@@ -2634,6 +2635,7 @@
function pullAlgorithm() {
if (reading === true) {
+ readAgain = true;
return resolvePromiseWith(undefined);
}
reading = true;
@@ -2641,7 +2643,7 @@
const readRequest = {
chunkSteps(value) {
queueMicrotask(() => {
- reading = false;
+ readAgain = false;
const value1 = value;
const value2 = value;
@@ -2663,6 +2665,11 @@
value2,
);
}
+
+ reading = false;
+ if (readAgain === true) {
+ pullAlgorithm();
+ }
});
},
closeSteps() {
diff --git a/tools/wpt/expectation.json b/tools/wpt/expectation.json
index 558ada79a..ed43da7e5 100644
--- a/tools/wpt/expectation.json
+++ b/tools/wpt/expectation.json
@@ -1336,12 +1336,8 @@
"patched-global.any.worker.html": true,
"reentrant-strategies.any.html": true,
"reentrant-strategies.any.worker.html": true,
- "tee.any.html": [
- "ReadableStream teeing: enqueue() and close() while both branches are pulling"
- ],
- "tee.any.worker.html": [
- "ReadableStream teeing: enqueue() and close() while both branches are pulling"
- ],
+ "tee.any.html": true,
+ "tee.any.worker.html": true,
"templated.any.html": true,
"templated.any.worker.html": true
},