Title: [194391] trunk
Revision
194391
Author
calva...@igalia.com
Date
2015-12-23 10:13:57 -0800 (Wed, 23 Dec 2015)

Log Message

[Streams API] In RS during enqueuing error should be reported only if readable
https://bugs.webkit.org/show_bug.cgi?id=152505

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Updated imported spec tests.

* web-platform-tests/streams-api/README.txt: Updated spec version.
* web-platform-tests/streams-api/readable-streams/bad-strategies-expected.txt: Expectations.
* web-platform-tests/streams-api/readable-streams/bad-strategies.js: Added two new tests.

Source/WebCore:

This commit fixes last spec change done in
https://github.com/whatwg/streams/commit/4ba861e6f60c248060811830e11271c84b439cc3.

Test: imported/w3c/web-platform-tests/streams-api/readable-streams/bad-strategies.html

* Modules/streams/ReadableStreamInternals.js:
(enqueueInReadableStream): Call @errorReadableStream only if state is readable.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (194390 => 194391)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2015-12-23 16:56:13 UTC (rev 194390)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2015-12-23 18:13:57 UTC (rev 194391)
@@ -1,3 +1,16 @@
+2015-12-23  Xabier Rodriguez Calvar  <calva...@igalia.com>
+
+        [Streams API] In RS during enqueuing error should be reported only if readable
+        https://bugs.webkit.org/show_bug.cgi?id=152505
+
+        Reviewed by Youenn Fablet.
+
+        Updated imported spec tests.
+
+        * web-platform-tests/streams-api/README.txt: Updated spec version.
+        * web-platform-tests/streams-api/readable-streams/bad-strategies-expected.txt: Expectations.
+        * web-platform-tests/streams-api/readable-streams/bad-strategies.js: Added two new tests.
+
 2015-12-21  Xabier Rodriguez Calvar  <calva...@igalia.com>
 
         [Streams API] imported/w3c/web-platform-tests/streams-api/readable-streams/cancel.html has a flaky test

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams-api/README.txt (194390 => 194391)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams-api/README.txt	2015-12-23 16:56:13 UTC (rev 194390)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams-api/README.txt	2015-12-23 18:13:57 UTC (rev 194391)
@@ -3,4 +3,4 @@
 There is a plan to move these tests to web-platform-tests repository so from that moment on this importation will be
 automatic.
 
-Current version: https://github.com/whatwg/streams/tree/f7cb0eac03e6a6d045d6e8c09df1f9f8a264fdef/reference-implementation/web-platform-tests.
+Current version: https://github.com/whatwg/streams/tree/2e7f87e45806d58114592c923aed299798d10161/reference-implementation/web-platform-tests.

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams-api/readable-streams/bad-strategies-expected.txt (194390 => 194391)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams-api/readable-streams/bad-strategies-expected.txt	2015-12-23 16:56:13 UTC (rev 194390)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams-api/readable-streams/bad-strategies-expected.txt	2015-12-23 18:13:57 UTC (rev 194391)
@@ -1,5 +1,7 @@
 
 PASS Readable stream: throwing strategy.size getter 
+PASS Readable stream: strategy.size errors the stream and then throws 
+PASS Readable stream: strategy.size errors the stream and then returns Infinity 
 PASS Readable stream: throwing strategy.size method 
 PASS Readable stream: throwing strategy.highWaterMark getter 
 PASS Readable stream: invalid strategy.highWaterMark 
@@ -10,6 +12,8 @@
     new ReadableStream({}, {
       get size() {
  ..." threw object "ReferenceError: Can't find variable: ReadableStream" ("ReferenceError") expected object "Error: a unique string" ("Error")
+FAIL Readable stream: strategy.size errors the stream and then throws Can't find variable: ReadableStream
+FAIL Readable stream: strategy.size errors the stream and then returns Infinity Can't find variable: ReadableStream
 FAIL Readable stream: throwing strategy.size method Can't find variable: ReadableStream
 FAIL Readable stream: throwing strategy.highWaterMark getter assert_throws: construction should re-throw the error function "() => {
     new ReadableStream({}, {

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams-api/readable-streams/bad-strategies.js (194390 => 194391)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams-api/readable-streams/bad-strategies.js	2015-12-23 16:56:13 UTC (rev 194390)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams-api/readable-streams/bad-strategies.js	2015-12-23 18:13:57 UTC (rev 194391)
@@ -19,6 +19,60 @@
 
 }, 'Readable stream: throwing strategy.size getter');
 
+test(() => {
+
+  const theError = new Error('a unique string');
+
+  let controller;
+  const rs = new ReadableStream(
+    {
+      start(c) {
+        controller = c;
+      }
+    },
+    {
+      size() {
+        controller.error(theError);
+        throw theError;
+      },
+      highWaterMark: 5
+    }
+  );
+
+  assert_throws(theError, () => {
+    controller.enqueue('a');
+  }, 'enqueue should re-throw the error');
+
+}, 'Readable stream: strategy.size errors the stream and then throws');
+
+test(() => {
+
+  const theError = new Error('a unique string');
+
+  let controller;
+  const rs = new ReadableStream(
+    {
+      start(c) {
+        controller = c;
+      }
+    },
+    {
+      size() {
+        controller.error(theError);
+        return Infinity;
+      },
+      highWaterMark: 5
+    }
+  );
+
+  try {
+    controller.enqueue('a');
+  } catch (error) {
+    assert_equals(error.name, 'RangeError', 'enqueue should throw a RangeError');
+  }
+
+}, 'Readable stream: strategy.size errors the stream and then returns Infinity');
+
 promise_test(() => {
 
   const theError = new Error('a unique string');

Modified: trunk/Source/WebCore/ChangeLog (194390 => 194391)


--- trunk/Source/WebCore/ChangeLog	2015-12-23 16:56:13 UTC (rev 194390)
+++ trunk/Source/WebCore/ChangeLog	2015-12-23 18:13:57 UTC (rev 194391)
@@ -1,3 +1,18 @@
+2015-12-23  Xabier Rodriguez Calvar  <calva...@igalia.com>
+
+        [Streams API] In RS during enqueuing error should be reported only if readable
+        https://bugs.webkit.org/show_bug.cgi?id=152505
+
+        Reviewed by Youenn Fablet.
+
+        This commit fixes last spec change done in
+        https://github.com/whatwg/streams/commit/4ba861e6f60c248060811830e11271c84b439cc3.
+
+        Test: imported/w3c/web-platform-tests/streams-api/readable-streams/bad-strategies.html
+
+        * Modules/streams/ReadableStreamInternals.js:
+        (enqueueInReadableStream): Call @errorReadableStream only if state is readable.
+
 2015-12-23  Chris Aljoudi <ch...@chrismatic.io> and Alex Christensen <achristen...@webkit.org>
 
         Content blockers should be able to promote http to https

Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js (194390 => 194391)


--- trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js	2015-12-23 16:56:13 UTC (rev 194390)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js	2015-12-23 18:13:57 UTC (rev 194391)
@@ -328,7 +328,8 @@
         @enqueueValueWithSize(stream.@queue, chunk, size);
     }
     catch(error) {
-        @errorReadableStream(stream, error);
+        if (stream.@state === @streamReadable)
+            @errorReadableStream(stream, error);
         throw error;
     }
     @requestReadableStreamPull(stream);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to