- Revision
- 217044
- Author
- [email protected]
- Date
- 2017-05-18 05:56:46 -0700 (Thu, 18 May 2017)
Log Message
[Readable Streams API] Align getDesiredSize with spec
https://bugs.webkit.org/show_bug.cgi?id=172220
Patch by Romain Bellessort <[email protected]> on 2017-05-18
Reviewed by Chris Dumez.
LayoutTests/imported/w3c:
Updated test expectations (tests are now passing).
* web-platform-tests/streams/readable-byte-streams/general-expected.txt: Updated.
* web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt: Updated.
* web-platform-tests/streams/readable-streams/general-expected.txt: Updated.
* web-platform-tests/streams/readable-streams/general.dedicatedworker-expected.txt: Updated.
Source/WebCore:
Aligned implementation of getDesiredSize operation for both controllers:
- https://streams.spec.whatwg.org/#readable-stream-default-controller-get-desired-size
- https://streams.spec.whatwg.org/#readable-byte-stream-controller-get-desired-size
Implementation slightly differs from spec as queueTotalSize refactoring is not
yet implemented, but behavior is now similar.
No new tests (already covered by WPT tests, corresponding expectations have been updated).
* Modules/streams/ReadableByteStreamInternals.js:
(readableByteStreamControllerGetDesiredSize): Updated.
* Modules/streams/ReadableStreamInternals.js:
(readableStreamDefaultControllerGetDesiredSize): Updated.
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (217043 => 217044)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-05-18 12:00:31 UTC (rev 217043)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-05-18 12:56:46 UTC (rev 217044)
@@ -1,3 +1,17 @@
+2017-05-18 Romain Bellessort <[email protected]>
+
+ [Readable Streams API] Align getDesiredSize with spec
+ https://bugs.webkit.org/show_bug.cgi?id=172220
+
+ Reviewed by Chris Dumez.
+
+ Updated test expectations (tests are now passing).
+
+ * web-platform-tests/streams/readable-byte-streams/general-expected.txt: Updated.
+ * web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt: Updated.
+ * web-platform-tests/streams/readable-streams/general-expected.txt: Updated.
+ * web-platform-tests/streams/readable-streams/general.dedicatedworker-expected.txt: Updated.
+
2017-05-17 Chris Dumez <[email protected]>
Setting URL.search to '' results in a stringified URL ending in '?'
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general-expected.txt (217043 => 217044)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general-expected.txt 2017-05-18 12:00:31 UTC (rev 217043)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general-expected.txt 2017-05-18 12:56:46 UTC (rev 217044)
@@ -5,8 +5,8 @@
PASS ReadableStream with byte source: Construct and expect start and pull being called
PASS ReadableStream with byte source: No automatic pull call if start doesn't finish
PASS ReadableStream with byte source: Construct with highWaterMark of 0
-FAIL ReadableStream with byte source: desiredSize when closed assert_equals: after closing, desiredSize must be 0 expected 0 but got 10
-FAIL ReadableStream with byte source: desiredSize when errored assert_equals: after erroring, desiredSize must be null expected (object) null but got (number) 10
+PASS ReadableStream with byte source: desiredSize when closed
+PASS ReadableStream with byte source: desiredSize when errored
PASS ReadableStream with byte source: getReader(), then releaseLock()
PASS ReadableStream with byte source: getReader() with mode set to byob, then releaseLock()
PASS ReadableStream with byte source: Test that closing a stream does not release a reader automatically
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt (217043 => 217044)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt 2017-05-18 12:00:31 UTC (rev 217043)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt 2017-05-18 12:56:46 UTC (rev 217044)
@@ -5,8 +5,8 @@
PASS ReadableStream with byte source: Construct and expect start and pull being called
PASS ReadableStream with byte source: No automatic pull call if start doesn't finish
PASS ReadableStream with byte source: Construct with highWaterMark of 0
-FAIL ReadableStream with byte source: desiredSize when closed assert_equals: after closing, desiredSize must be 0 expected 0 but got 10
-FAIL ReadableStream with byte source: desiredSize when errored assert_equals: after erroring, desiredSize must be null expected (object) null but got (number) 10
+PASS ReadableStream with byte source: desiredSize when closed
+PASS ReadableStream with byte source: desiredSize when errored
PASS ReadableStream with byte source: getReader(), then releaseLock()
PASS ReadableStream with byte source: getReader() with mode set to byob, then releaseLock()
PASS ReadableStream with byte source: Test that closing a stream does not release a reader automatically
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/general-expected.txt (217043 => 217044)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/general-expected.txt 2017-05-18 12:00:31 UTC (rev 217043)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/general-expected.txt 2017-05-18 12:56:46 UTC (rev 217044)
@@ -30,8 +30,8 @@
PASS ReadableStream: enqueue should throw when the stream is readable but draining
PASS ReadableStream: enqueue should throw when the stream is closed
PASS ReadableStream: should call underlying source methods as methods
-FAIL ReadableStream: desiredSize when closed assert_equals: after closing, desiredSize must be 0 expected 0 but got 10
-FAIL ReadableStream: desiredSize when errored assert_equals: after erroring, desiredSize must be null expected (object) null but got (number) 10
+PASS ReadableStream: desiredSize when closed
+PASS ReadableStream: desiredSize when errored
PASS ReadableStream strategies: the default strategy should give desiredSize of 1 to start, decreasing by 1 per enqueue
PASS ReadableStream strategies: the default strategy should continue giving desiredSize of 1 if the chunks are read immediately
PASS ReadableStream integration test: adapting a random push source
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/general.dedicatedworker-expected.txt (217043 => 217044)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/general.dedicatedworker-expected.txt 2017-05-18 12:00:31 UTC (rev 217043)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/general.dedicatedworker-expected.txt 2017-05-18 12:56:46 UTC (rev 217044)
@@ -30,8 +30,8 @@
PASS ReadableStream: enqueue should throw when the stream is readable but draining
PASS ReadableStream: enqueue should throw when the stream is closed
PASS ReadableStream: should call underlying source methods as methods
-FAIL ReadableStream: desiredSize when closed assert_equals: after closing, desiredSize must be 0 expected 0 but got 10
-FAIL ReadableStream: desiredSize when errored assert_equals: after erroring, desiredSize must be null expected (object) null but got (number) 10
+PASS ReadableStream: desiredSize when closed
+PASS ReadableStream: desiredSize when errored
PASS ReadableStream strategies: the default strategy should give desiredSize of 1 to start, decreasing by 1 per enqueue
PASS ReadableStream strategies: the default strategy should continue giving desiredSize of 1 if the chunks are read immediately
PASS ReadableStream integration test: adapting a random push source
Modified: trunk/Source/WebCore/ChangeLog (217043 => 217044)
--- trunk/Source/WebCore/ChangeLog 2017-05-18 12:00:31 UTC (rev 217043)
+++ trunk/Source/WebCore/ChangeLog 2017-05-18 12:56:46 UTC (rev 217044)
@@ -1,3 +1,24 @@
+2017-05-18 Romain Bellessort <[email protected]>
+
+ [Readable Streams API] Align getDesiredSize with spec
+ https://bugs.webkit.org/show_bug.cgi?id=172220
+
+ Reviewed by Chris Dumez.
+
+ Aligned implementation of getDesiredSize operation for both controllers:
+ - https://streams.spec.whatwg.org/#readable-stream-default-controller-get-desired-size
+ - https://streams.spec.whatwg.org/#readable-byte-stream-controller-get-desired-size
+
+ Implementation slightly differs from spec as queueTotalSize refactoring is not
+ yet implemented, but behavior is now similar.
+
+ No new tests (already covered by WPT tests, corresponding expectations have been updated).
+
+ * Modules/streams/ReadableByteStreamInternals.js:
+ (readableByteStreamControllerGetDesiredSize): Updated.
+ * Modules/streams/ReadableStreamInternals.js:
+ (readableStreamDefaultControllerGetDesiredSize): Updated.
+
2017-05-18 Tim Horton <[email protected]>
More WebKit2 header cleanup
Modified: trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js (217043 => 217044)
--- trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js 2017-05-18 12:00:31 UTC (rev 217043)
+++ trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js 2017-05-18 12:56:46 UTC (rev 217044)
@@ -186,6 +186,13 @@
{
"use strict";
+ const stream = controller.@controlledReadableStream;
+
+ if (stream.@state === @streamErrored)
+ return null;
+ if (stream.@state === @streamClosed)
+ return 0;
+
return controller.@strategyHWM - controller.@totalQueuedBytes;
}
Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js (217043 => 217044)
--- trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js 2017-05-18 12:00:31 UTC (rev 217043)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js 2017-05-18 12:56:46 UTC (rev 217044)
@@ -333,6 +333,13 @@
{
"use strict";
+ const stream = controller.@controlledReadableStream;
+
+ if (stream.@state === @streamErrored)
+ return null;
+ if (stream.@state === @streamClosed)
+ return 0;
+
return [email protected] - [email protected];
}