Title: [275667] trunk
Revision
275667
Author
[email protected]
Date
2021-04-08 11:37:33 -0700 (Thu, 08 Apr 2021)

Log Message

Streams: new test failure for canceling the branches of an errored tee'd stream
https://bugs.webkit.org/show_bug.cgi?id=223558
<rdar://problem/75924807>

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebased from WPT ToT.

* web-platform-tests/streams/readable-streams/tee.any-expected.txt:
* web-platform-tests/streams/readable-streams/tee.any.js:
(promise_test.async const):
(promise_test):
(promise_test.async t):
* web-platform-tests/streams/readable-streams/tee.any.worker-expected.txt:

Source/WebCore:

Align with latest version of the spec.
Covered by updated test.

* Modules/streams/ReadableStreamInternals.js:
(readableStreamTee):
(readableStreamTeePullFunction):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (275666 => 275667)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-04-08 18:30:02 UTC (rev 275666)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-04-08 18:37:33 UTC (rev 275667)
@@ -1,3 +1,20 @@
+2021-04-08  Youenn Fablet  <[email protected]>
+
+        Streams: new test failure for canceling the branches of an errored tee'd stream
+        https://bugs.webkit.org/show_bug.cgi?id=223558
+        <rdar://problem/75924807>
+
+        Reviewed by Alex Christensen.
+
+        Rebased from WPT ToT.
+
+        * web-platform-tests/streams/readable-streams/tee.any-expected.txt:
+        * web-platform-tests/streams/readable-streams/tee.any.js:
+        (promise_test.async const):
+        (promise_test):
+        (promise_test.async t):
+        * web-platform-tests/streams/readable-streams/tee.any.worker-expected.txt:
+
 2021-04-06  Zalan Bujtas  <[email protected]>
 
         [LFC][Integration] Enable inline box support (RenderInline)

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.any-expected.txt (275666 => 275667)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.any-expected.txt	2021-04-08 18:30:02 UTC (rev 275666)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.any-expected.txt	2021-04-08 18:37:33 UTC (rev 275667)
@@ -23,6 +23,8 @@
 PASS ReadableStream teeing: erroring the original should immediately error the branches
 PASS ReadableStream teeing: canceling branch1 should finish when branch2 reads until end of stream
 PASS ReadableStream teeing: canceling branch1 should finish when original stream errors
+PASS ReadableStream teeing: canceling both branches in sequence with delay
+PASS ReadableStream teeing: failing to cancel when canceling both branches in sequence with delay
 PASS ReadableStreamTee should not use a modified ReadableStream constructor from the global object
 FAIL ReadableStreamTee should not pull more chunks than can fit in the branch queue assert_array_equals: pull should only be called once lengths differ, expected array ["pull"] length 1, got ["pull", "pull"] length 2
 FAIL ReadableStreamTee should only pull enough to fill the emptiest queue assert_array_equals: pull should be called twice lengths differ, expected array ["pull", "pull"] length 2, got ["pull", "pull", "pull", "pull"] length 4

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.any.js (275666 => 275667)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.any.js	2021-04-08 18:30:02 UTC (rev 275666)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.any.js	2021-04-08 18:37:33 UTC (rev 275667)
@@ -232,16 +232,19 @@
 
 }, 'ReadableStream teeing: failing to cancel the original stream should cause cancel() to reject on branches');
 
-test(() => {
+promise_test(t => {
 
+  const theError = { name: 'You just watch yourself!' };
   let controller;
   const stream = new ReadableStream({ start(c) { controller = c; } });
   const [branch1, branch2] = stream.tee();
 
-  controller.error("error");
+  controller.error(theError);
 
-  branch1.cancel().catch(_=>_);
-  branch2.cancel().catch(_=>_);
+  return Promise.all([
+    promise_rejects_exactly(t, theError, branch1.cancel()),
+    promise_rejects_exactly(t, theError, branch2.cancel())
+  ]);
 
 }, 'ReadableStream teeing: erroring a teed stream should properly handle canceled branches');
 
@@ -368,6 +371,42 @@
 
 }, 'ReadableStream teeing: canceling branch1 should finish when original stream errors');
 
+promise_test(async () => {
+
+  const rs = new ReadableStream({});
+
+  const [branch1, branch2] = rs.tee();
+
+  const cancel1 = branch1.cancel();
+  await flushAsyncEvents();
+  const cancel2 = branch2.cancel();
+
+  await Promise.all([cancel1, cancel2]);
+
+}, 'ReadableStream teeing: canceling both branches in sequence with delay');
+
+promise_test(async t => {
+
+  const theError = { name: 'boo!' };
+  const rs = new ReadableStream({
+    cancel() {
+      throw theError;
+    }
+  });
+
+  const [branch1, branch2] = rs.tee();
+
+  const cancel1 = branch1.cancel();
+  await flushAsyncEvents();
+  const cancel2 = branch2.cancel();
+
+  await Promise.all([
+    promise_rejects_exactly(t, theError, cancel1),
+    promise_rejects_exactly(t, theError, cancel2)
+  ]);
+
+}, 'ReadableStream teeing: failing to cancel when canceling both branches in sequence with delay');
+
 test(t => {
 
   // Copy original global.

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.any.worker-expected.txt (275666 => 275667)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.any.worker-expected.txt	2021-04-08 18:30:02 UTC (rev 275666)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.any.worker-expected.txt	2021-04-08 18:37:33 UTC (rev 275667)
@@ -16,6 +16,8 @@
 PASS ReadableStream teeing: erroring the original should immediately error the branches
 PASS ReadableStream teeing: canceling branch1 should finish when branch2 reads until end of stream
 PASS ReadableStream teeing: canceling branch1 should finish when original stream errors
+PASS ReadableStream teeing: canceling both branches in sequence with delay
+PASS ReadableStream teeing: failing to cancel when canceling both branches in sequence with delay
 PASS ReadableStreamTee should not use a modified ReadableStream constructor from the global object
 FAIL ReadableStreamTee should not pull more chunks than can fit in the branch queue assert_array_equals: pull should only be called once lengths differ, expected array ["pull"] length 1, got ["pull", "pull"] length 2
 FAIL ReadableStreamTee should only pull enough to fill the emptiest queue assert_array_equals: pull should be called twice lengths differ, expected array ["pull", "pull"] length 2, got ["pull", "pull", "pull", "pull"] length 4

Modified: trunk/Source/WebCore/ChangeLog (275666 => 275667)


--- trunk/Source/WebCore/ChangeLog	2021-04-08 18:30:02 UTC (rev 275666)
+++ trunk/Source/WebCore/ChangeLog	2021-04-08 18:37:33 UTC (rev 275667)
@@ -1,3 +1,18 @@
+2021-04-08  Youenn Fablet  <[email protected]>
+
+        Streams: new test failure for canceling the branches of an errored tee'd stream
+        https://bugs.webkit.org/show_bug.cgi?id=223558
+        <rdar://problem/75924807>
+
+        Reviewed by Alex Christensen.
+
+        Align with latest version of the spec.
+        Covered by updated test.
+
+        * Modules/streams/ReadableStreamInternals.js:
+        (readableStreamTee):
+        (readableStreamTeePullFunction):
+
 2021-04-08  Andres Gonzalez  <[email protected]>
 
         VoiceOver does not echo text insertions and deletions when a contenteditable div has a non editable descendant element with a content editable child

Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js (275666 => 275667)


--- trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js	2021-04-08 18:30:02 UTC (rev 275666)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js	2021-04-08 18:37:33 UTC (rev 275667)
@@ -424,7 +424,8 @@
         @readableStreamDefaultControllerError(branch1.@readableStreamController, e);
         @readableStreamDefaultControllerError(branch2.@readableStreamController, e);
         teeState.closedOrErrored = true;
-        teeState.cancelPromiseCapability.@resolve.@call();
+        if (!teeState.canceled1 || !teeState.canceled2)
+            teeState.cancelPromiseCapability.@resolve.@call();
     });
 
     // Additional fields compared to the spec, as they are needed within pull/cancel functions.
@@ -464,7 +465,8 @@
                 if (!teeState.canceled2)
                     @readableStreamDefaultControllerClose(teeState.branch2.@readableStreamController);
                 teeState.closedOrErrored = true;
-                teeState.cancelPromiseCapability.@resolve.@call();
+                if (!teeState.canceled1 || !teeState.canceled2)
+                    teeState.cancelPromiseCapability.@resolve.@call();
             }
             if (teeState.closedOrErrored)
                 return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to