Title: [209649] trunk
Revision
209649
Author
commit-qu...@webkit.org
Date
2016-12-09 21:56:13 -0800 (Fri, 09 Dec 2016)

Log Message

[Readable Streams API] Implement ReadableByteStreamController desiredSize
https://bugs.webkit.org/show_bug.cgi?id=165599

Patch by Romain Bellessort <romain.belless...@crf.canon.fr> on 2016-12-09
Reviewed by Darin Adler.

Source/WebCore:

Implemented ReadableByteStreamController attribute desiredSize.

Added test to check desiredSize value.

* Modules/streams/ReadableByteStreamController.js:
(desiredSize):
* Modules/streams/ReadableByteStreamInternals.js:
(readableByteStreamControllerGetDesiredSize):

LayoutTests:

Added test to check ReadableByteStreamController desiredSize value.

* streams/readable-byte-stream-controller-expected.txt: Added expectation for new test.
* streams/readable-byte-stream-controller.js: Added new test for desiredSize.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (209648 => 209649)


--- trunk/LayoutTests/ChangeLog	2016-12-10 05:18:33 UTC (rev 209648)
+++ trunk/LayoutTests/ChangeLog	2016-12-10 05:56:13 UTC (rev 209649)
@@ -1,3 +1,15 @@
+2016-12-09  Romain Bellessort  <romain.belless...@crf.canon.fr>
+
+        [Readable Streams API] Implement ReadableByteStreamController desiredSize
+        https://bugs.webkit.org/show_bug.cgi?id=165599
+
+        Reviewed by Darin Adler.
+
+        Added test to check ReadableByteStreamController desiredSize value.
+
+        * streams/readable-byte-stream-controller-expected.txt: Added expectation for new test.
+        * streams/readable-byte-stream-controller.js: Added new test for desiredSize.
+
 2016-12-09  Ryosuke Niwa  <rn...@webkit.org>
 
         document.pointerLockElement exposes a node inside a shadow tree

Modified: trunk/LayoutTests/streams/readable-byte-stream-controller-expected.txt (209648 => 209649)


--- trunk/LayoutTests/streams/readable-byte-stream-controller-expected.txt	2016-12-10 05:18:33 UTC (rev 209648)
+++ trunk/LayoutTests/streams/readable-byte-stream-controller-expected.txt	2016-12-10 05:56:13 UTC (rev 209649)
@@ -10,6 +10,7 @@
 PASS Calling read() on a reader associated to a controller that has been errored should fail with provided error 
 PASS Calling read() on a reader associated to a controller that has been closed should not be rejected 
 FAIL Calling read() after a chunk has been enqueued should result in obtaining said chunk ReadableByteStreamController enqueue() is not implemented
+PASS By default initial value of desiredSize should be 1 
 PASS Creating a ReadableStream with an underlyingSource with type property set to 'bytes' should succeed 
 PASS ReadableByteStreamController instances should have the correct list of properties 
 PASS Calling error() with a this object different from ReadableByteStreamController should throw a TypeError 
@@ -21,4 +22,5 @@
 PASS Calling read() on a reader associated to a controller that has been errored should fail with provided error 
 PASS Calling read() on a reader associated to a controller that has been closed should not be rejected 
 FAIL Calling read() after a chunk has been enqueued should result in obtaining said chunk ReadableByteStreamController enqueue() is not implemented
+PASS By default initial value of desiredSize should be 1 
 

Modified: trunk/LayoutTests/streams/readable-byte-stream-controller.js (209648 => 209649)


--- trunk/LayoutTests/streams/readable-byte-stream-controller.js	2016-12-10 05:18:33 UTC (rev 209648)
+++ trunk/LayoutTests/streams/readable-byte-stream-controller.js	2016-12-10 05:56:13 UTC (rev 209649)
@@ -217,4 +217,17 @@
     );
 });
 
+test(function() {
+    let controller;
+
+    const rs = new ReadableStream({
+        start: function(c) {
+            controller = c;
+        },
+        type: "bytes"
+    });
+
+    assert_equals(controller.desiredSize, 1, "by default initial value of desiredSize should be 1");
+}, "By default initial value of desiredSize should be 1");
+
 done();

Modified: trunk/Source/WebCore/ChangeLog (209648 => 209649)


--- trunk/Source/WebCore/ChangeLog	2016-12-10 05:18:33 UTC (rev 209648)
+++ trunk/Source/WebCore/ChangeLog	2016-12-10 05:56:13 UTC (rev 209649)
@@ -1,3 +1,19 @@
+2016-12-09  Romain Bellessort  <romain.belless...@crf.canon.fr>
+
+        [Readable Streams API] Implement ReadableByteStreamController desiredSize
+        https://bugs.webkit.org/show_bug.cgi?id=165599
+
+        Reviewed by Darin Adler.
+
+        Implemented ReadableByteStreamController attribute desiredSize.
+
+        Added test to check desiredSize value.
+
+        * Modules/streams/ReadableByteStreamController.js:
+        (desiredSize):
+        * Modules/streams/ReadableByteStreamInternals.js:
+        (readableByteStreamControllerGetDesiredSize):
+
 2016-12-09  Ryosuke Niwa  <rn...@webkit.org>
 
         document.pointerLockElement exposes a node inside a shadow tree

Modified: trunk/Source/WebCore/Modules/streams/ReadableByteStreamController.js (209648 => 209649)


--- trunk/Source/WebCore/Modules/streams/ReadableByteStreamController.js	2016-12-10 05:18:33 UTC (rev 209648)
+++ trunk/Source/WebCore/Modules/streams/ReadableByteStreamController.js	2016-12-10 05:56:13 UTC (rev 209649)
@@ -74,7 +74,8 @@
 {
     "use strict";
 
-    //FIXME: Implement appropriate behavior.
-    @throwTypeError("ReadableByteStreamController desiredSize is not implemented");
+    if (!@isReadableByteStreamController(this))
+        throw @makeGetterTypeError("ReadableByteStreamController", "desiredSize");
+
+    return @readableByteStreamControllerGetDesiredSize(this);
 }
-

Modified: trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js (209648 => 209649)


--- trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js	2016-12-10 05:18:33 UTC (rev 209648)
+++ trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js	2016-12-10 05:56:13 UTC (rev 209649)
@@ -125,3 +125,10 @@
 
     // FIXME: To be implemented in conjunction with ReadableStreamBYOBRequest.
 }
+
+function readableByteStreamControllerGetDesiredSize(controller)
+{
+   "use strict";
+
+   return controller.@strategyHWM - controller.@totalQueuedBytes;
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to