Diff
Modified: trunk/LayoutTests/ChangeLog (203410 => 203411)
--- trunk/LayoutTests/ChangeLog 2016-07-19 17:23:59 UTC (rev 203410)
+++ trunk/LayoutTests/ChangeLog 2016-07-19 17:27:32 UTC (rev 203411)
@@ -1,3 +1,13 @@
+2016-07-19 Youenn Fablet <[email protected]>
+
+ [Streams API] ReadableStreamController methods should throw if its stream is not readable
+ https://bugs.webkit.org/show_bug.cgi?id=159871
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ * streams/reference-implementation/pipe-to-options.html: Updated test case according whatwg original test.
+ * streams/reference-implementation/readable-stream-templated.html: Ditto.
+
2016-07-19 Simon Fraser <[email protected]>
Bubbles appear split for a brief moment in Messages
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (203410 => 203411)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-07-19 17:23:59 UTC (rev 203410)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-07-19 17:27:32 UTC (rev 203411)
@@ -1,3 +1,12 @@
+2016-07-19 Youenn Fablet <[email protected]>
+
+ [Streams API] ReadableStreamController methods should throw if its stream is not readable
+ https://bugs.webkit.org/show_bug.cgi?id=159871
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ * web-platform-tests/streams/readable-streams/bad-underlying-sources.https-expected.txt:
+
2016-07-19 Youenn Fablet <[email protected]>
Refresh WPT tests up to 98ec1ad
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/bad-underlying-sources.https-expected.txt (203410 => 203411)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/bad-underlying-sources.https-expected.txt 2016-07-19 17:23:59 UTC (rev 203410)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/bad-underlying-sources.https-expected.txt 2016-07-19 17:27:32 UTC (rev 203411)
@@ -7,14 +7,14 @@
PASS Underlying source pull: throwing method (second pull)
PASS Underlying source cancel: throwing getter
PASS Underlying source cancel: throwing method
-FAIL Underlying source: calling enqueue on an empty canceled stream should throw assert_throws: Calling enqueue after canceling should throw function "() => controller.enqueue('a')" did not throw
-FAIL Underlying source: calling enqueue on a non-empty canceled stream should throw assert_throws: Calling enqueue after canceling should throw function "() => controller.enqueue('c')" did not throw
+PASS Underlying source: calling enqueue on an empty canceled stream should throw
+PASS Underlying source: calling enqueue on a non-empty canceled stream should throw
PASS Underlying source: calling enqueue on a closed stream should throw
-FAIL Underlying source: calling enqueue on an errored stream should throw assert_throws: call to enqueue should throw the error function "() => c.enqueue('a')" threw object "Error: boo" ("Error") expected object "TypeError" ("TypeError")
+PASS Underlying source: calling enqueue on an errored stream should throw
PASS Underlying source: calling close twice on an empty stream should throw the second time
PASS Underlying source: calling close twice on a non-empty stream should throw the second time
-FAIL Underlying source: calling close on an empty canceled stream should throw assert_throws: Calling close after canceling should throw function "() => controller.close()" did not throw
-FAIL Underlying source: calling close on a non-empty canceled stream should throw assert_throws: Calling close after canceling should throw function "() => controller.close()" did not throw
+PASS Underlying source: calling close on an empty canceled stream should throw
+PASS Underlying source: calling close on a non-empty canceled stream should throw
PASS Underlying source: calling close after error should throw
PASS Underlying source: calling error twice should throw the second time
PASS Underlying source: calling error after close should throw
@@ -30,14 +30,14 @@
PASS Underlying source pull: throwing method (second pull)
PASS Underlying source cancel: throwing getter
PASS Underlying source cancel: throwing method
-FAIL Underlying source: calling enqueue on an empty canceled stream should throw assert_throws: Calling enqueue after canceling should throw function "() => controller.enqueue('a')" did not throw
-FAIL Underlying source: calling enqueue on a non-empty canceled stream should throw assert_throws: Calling enqueue after canceling should throw function "() => controller.enqueue('c')" did not throw
+PASS Underlying source: calling enqueue on an empty canceled stream should throw
+PASS Underlying source: calling enqueue on a non-empty canceled stream should throw
PASS Underlying source: calling enqueue on a closed stream should throw
-FAIL Underlying source: calling enqueue on an errored stream should throw assert_throws: call to enqueue should throw the error function "() => c.enqueue('a')" threw object "Error: boo" ("Error") expected object "TypeError" ("TypeError")
+PASS Underlying source: calling enqueue on an errored stream should throw
PASS Underlying source: calling close twice on an empty stream should throw the second time
PASS Underlying source: calling close twice on a non-empty stream should throw the second time
-FAIL Underlying source: calling close on an empty canceled stream should throw assert_throws: Calling close after canceling should throw function "() => controller.close()" did not throw
-FAIL Underlying source: calling close on a non-empty canceled stream should throw assert_throws: Calling close after canceling should throw function "() => controller.close()" did not throw
+PASS Underlying source: calling close on an empty canceled stream should throw
+PASS Underlying source: calling close on a non-empty canceled stream should throw
PASS Underlying source: calling close after error should throw
PASS Underlying source: calling error twice should throw the second time
PASS Underlying source: calling error after close should throw
Modified: trunk/LayoutTests/streams/reference-implementation/pipe-to-options.html (203410 => 203411)
--- trunk/LayoutTests/streams/reference-implementation/pipe-to-options.html 2016-07-19 17:23:59 UTC (rev 203410)
+++ trunk/LayoutTests/streams/reference-implementation/pipe-to-options.html 2016-07-19 17:27:32 UTC (rev 203411)
@@ -14,7 +14,7 @@
c.enqueue('a');
setTimeout(test1.step_func(function() { c.enqueue('b'); }), 200);
setTimeout(test1.step_func(function() {
- c.enqueue('c'); // Enqueue after cancel should not throw.
+ assert_throws(new TypeError(), function() { c.enqueue('c'); }); // Enqueue after cancel should throw.
assert_true(cancelCalled);
test1.done();
}), 500);
@@ -45,7 +45,7 @@
c.enqueue('a');
setTimeout(test2.step_func(function() { c.enqueue('b'); }), 200);
setTimeout(test2.step_func(function() {
- c.enqueue('c'); // Enqueue after cancel should not throw.
+ assert_throws(new TypeError(), function() { c.enqueue('c'); }); // Enqueue after cancel should throw.
assert_true(cancelCalled);
test2.done();
}), 500);
Modified: trunk/LayoutTests/streams/reference-implementation/readable-stream-templated.html (203410 => 203411)
--- trunk/LayoutTests/streams/reference-implementation/readable-stream-templated.html 2016-07-19 17:23:59 UTC (rev 203410)
+++ trunk/LayoutTests/streams/reference-implementation/readable-stream-templated.html 2016-07-19 17:27:32 UTC (rev 203411)
@@ -400,10 +400,23 @@
templatedRSTwoChunksClosed('ReadableStream (two chunks enqueued async, then closed)', function() {
return new ReadableStream({
+ _cancelled: false,
start: function(c) {
- setTimeout(function() { c.enqueue(chunks[0]); }, 100);
- setTimeout(function() { c.enqueue(chunks[1]); }, 200);
- setTimeout(function() { c.close(); }, 300);
+ setTimeout(() => {
+ if (!this._cancelled)
+ c.enqueue(chunks[0]);
+ }, 100);
+ setTimeout(() => {
+ if (!this._cancelled)
+ c.enqueue(chunks[1]);
+ }, 200);
+ setTimeout(() => {
+ if (!this._cancelled)
+ c.close();
+ }, 300);
+ },
+ cancel: function(reason) {
+ this._cancelled = true;
}
})},
chunks
Modified: trunk/Source/WebCore/ChangeLog (203410 => 203411)
--- trunk/Source/WebCore/ChangeLog 2016-07-19 17:23:59 UTC (rev 203410)
+++ trunk/Source/WebCore/ChangeLog 2016-07-19 17:27:32 UTC (rev 203411)
@@ -1,3 +1,17 @@
+2016-07-19 Youenn Fablet <[email protected]>
+
+ [Streams API] ReadableStreamController methods should throw if its stream is not readable
+ https://bugs.webkit.org/show_bug.cgi?id=159871
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ Spec now mandates close and enqueue to throw if ReadableStream is not readable.
+ Covered by rebased and/or modified tests.
+
+ * Modules/streams/ReadableStreamController.js:
+ (enqueue): Throwing a TypeError if controlled stream is not readable.
+ (close): Ditto.
+
2016-07-19 Simon Fraser <[email protected]>
Bubbles appear split for a brief moment in Messages
Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamController.js (203410 => 203411)
--- trunk/Source/WebCore/Modules/streams/ReadableStreamController.js 2016-07-19 17:23:59 UTC (rev 203410)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamController.js 2016-07-19 17:27:32 UTC (rev 203411)
@@ -33,12 +33,13 @@
throw new @TypeError("Function should be called on a ReadableStreamController");
const stream = this.@controlledReadableStream;
- if (stream.@state === @streamErrored)
- throw stream.@storedError;
if (stream.@closeRequested)
throw new @TypeError("ReadableStream is requested to close");
+ if (stream.@state !== @streamReadable)
+ throw new @TypeError("ReadableStream is not readable");
+
return @enqueueInReadableStream(stream, chunk);
}
@@ -67,8 +68,8 @@
if (stream.@closeRequested)
throw new @TypeError("ReadableStream is already requested to close");
- if (stream.@state === @streamErrored)
- throw new @TypeError("ReadableStream is already errored");
+ if (stream.@state !== @streamReadable)
+ throw new @TypeError("ReadableStream is not readable");
@closeReadableStream(stream);
}