Title: [212748] trunk
Revision
212748
Author
[email protected]
Date
2017-02-21 13:53:28 -0800 (Tue, 21 Feb 2017)

Log Message

[Readable Streams API] Add ReadableStreamBYOBRequest view getter
https://bugs.webkit.org/show_bug.cgi?id=168652

Patch by Romain Bellessort <[email protected]> on 2017-02-21
Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Updated test expectations.

* web-platform-tests/streams/readable-byte-streams/general-expected.txt:
* web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt:

Source/WebCore:

Implemented getter for ReadableStreamBYOBRequest view attribute.

Added 1 test checking that view length corresponds to autoAllocateChunkSize.
Also updated test expectations for W3C imported tests.

* Modules/streams/ReadableByteStreamInternals.js:
(isReadableStreamBYOBRequest): Added.
* Modules/streams/ReadableStreamBYOBRequest.js:
(view): Added.

LayoutTests:

Added 1 test checking that view length corresponds to autoAllocateChunkSize.

* streams/readable-stream-byob-request-expected.txt: Updated.
* streams/readable-stream-byob-request.js: Added 1 test.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (212747 => 212748)


--- trunk/LayoutTests/ChangeLog	2017-02-21 21:47:40 UTC (rev 212747)
+++ trunk/LayoutTests/ChangeLog	2017-02-21 21:53:28 UTC (rev 212748)
@@ -1,3 +1,15 @@
+2017-02-21  Romain Bellessort  <[email protected]>
+
+        [Readable Streams API] Add ReadableStreamBYOBRequest view getter
+        https://bugs.webkit.org/show_bug.cgi?id=168652
+
+        Reviewed by Youenn Fablet.
+
+        Added 1 test checking that view length corresponds to autoAllocateChunkSize.
+
+        * streams/readable-stream-byob-request-expected.txt: Updated.
+        * streams/readable-stream-byob-request.js: Added 1 test.
+
 2017-02-21  Antti Koivisto  <[email protected]>
 
         REGRESSION(r207669): Crash after mutating selector text

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (212747 => 212748)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-02-21 21:47:40 UTC (rev 212747)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-02-21 21:53:28 UTC (rev 212748)
@@ -1,3 +1,15 @@
+2017-02-21  Romain Bellessort  <[email protected]>
+
+        [Readable Streams API] Add ReadableStreamBYOBRequest view getter
+        https://bugs.webkit.org/show_bug.cgi?id=168652
+
+        Reviewed by Youenn Fablet.
+
+        Updated test expectations.
+
+        * web-platform-tests/streams/readable-byte-streams/general-expected.txt:
+        * web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt:
+
 2017-02-21  Alex Christensen  <[email protected]>
 
         Unreviewed, rolling out r212699.

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general-expected.txt (212747 => 212748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general-expected.txt	2017-02-21 21:47:40 UTC (rev 212747)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general-expected.txt	2017-02-21 21:53:28 UTC (rev 212748)
@@ -14,7 +14,7 @@
 PASS ReadableStream with byte source: Automatic pull() after start() 
 PASS ReadableStream with byte source: Automatic pull() after start() and read() 
 FAIL ReadableStream with byte source: autoAllocateChunkSize assert_equals: pull() must have been invoked once expected 1 but got 0
-FAIL ReadableStream with byte source: Mix of auto allocate and BYOB promise_test: Unhandled rejection with value: object "TypeError: ReadableByteStreamController view is not implemented"
+FAIL ReadableStream with byte source: Mix of auto allocate and BYOB promise_test: Unhandled rejection with value: object "TypeError: ReadableStreamBYOBRequest respond() is not implemented"
 PASS ReadableStream with byte source: Automatic pull() after start() and read(view) 
 PASS ReadableStream with byte source: enqueue(), getReader(), then read() 
 PASS ReadableStream with byte source: Push source that doesn't understand pull signal 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt (212747 => 212748)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt	2017-02-21 21:47:40 UTC (rev 212747)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt	2017-02-21 21:53:28 UTC (rev 212748)
@@ -14,7 +14,7 @@
 PASS ReadableStream with byte source: Automatic pull() after start() 
 PASS ReadableStream with byte source: Automatic pull() after start() and read() 
 FAIL ReadableStream with byte source: autoAllocateChunkSize assert_equals: pull() must have been invoked once expected 1 but got 0
-FAIL ReadableStream with byte source: Mix of auto allocate and BYOB promise_test: Unhandled rejection with value: object "TypeError: ReadableByteStreamController view is not implemented"
+FAIL ReadableStream with byte source: Mix of auto allocate and BYOB promise_test: Unhandled rejection with value: object "TypeError: ReadableStreamBYOBRequest respond() is not implemented"
 PASS ReadableStream with byte source: Automatic pull() after start() and read(view) 
 PASS ReadableStream with byte source: enqueue(), getReader(), then read() 
 PASS ReadableStream with byte source: Push source that doesn't understand pull signal 

Modified: trunk/LayoutTests/streams/readable-stream-byob-request-expected.txt (212747 => 212748)


--- trunk/LayoutTests/streams/readable-stream-byob-request-expected.txt	2017-02-21 21:47:40 UTC (rev 212747)
+++ trunk/LayoutTests/streams/readable-stream-byob-request-expected.txt	2017-02-21 21:53:28 UTC (rev 212748)
@@ -1,6 +1,8 @@
 
 PASS ReadableStreamBYOBRequest instances should have the correct list of properties 
 PASS By default, byobRequest should be undefined 
+PASS byobRequest.view length should be equal to autoAllocateChunkSize 
 PASS ReadableStreamBYOBRequest instances should have the correct list of properties 
 PASS By default, byobRequest should be undefined 
+PASS byobRequest.view length should be equal to autoAllocateChunkSize 
 

Modified: trunk/LayoutTests/streams/readable-stream-byob-request.js (212747 => 212748)


--- trunk/LayoutTests/streams/readable-stream-byob-request.js	2017-02-21 21:47:40 UTC (rev 212747)
+++ trunk/LayoutTests/streams/readable-stream-byob-request.js	2017-02-21 21:53:28 UTC (rev 212748)
@@ -66,4 +66,23 @@
     assert_equals(controller.byobRequest, undefined, "by default byobRequest should be undefined");
 }, "By default, byobRequest should be undefined");
 
+test(function() {
+
+    let controller;
+    const autoAllocateChunkSize = 128;
+    const rs = new ReadableStream({
+        autoAllocateChunkSize,
+        start: function(c) {
+            controller = c;
+        },
+        type: "bytes"
+    });
+
+    rs.getReader().read();
+    const byobReq = controller.byobRequest;
+
+    assert_equals(byobReq.view.length, autoAllocateChunkSize, "byobRequest length should be equal to autoAllocateChunkSize value")
+
+}, "byobRequest.view length should be equal to autoAllocateChunkSize")
+
 done();

Modified: trunk/Source/WebCore/ChangeLog (212747 => 212748)


--- trunk/Source/WebCore/ChangeLog	2017-02-21 21:47:40 UTC (rev 212747)
+++ trunk/Source/WebCore/ChangeLog	2017-02-21 21:53:28 UTC (rev 212748)
@@ -1,3 +1,20 @@
+2017-02-21  Romain Bellessort  <[email protected]>
+
+        [Readable Streams API] Add ReadableStreamBYOBRequest view getter
+        https://bugs.webkit.org/show_bug.cgi?id=168652
+
+        Reviewed by Youenn Fablet.
+
+        Implemented getter for ReadableStreamBYOBRequest view attribute.
+        
+        Added 1 test checking that view length corresponds to autoAllocateChunkSize.
+        Also updated test expectations for W3C imported tests.
+
+        * Modules/streams/ReadableByteStreamInternals.js:
+        (isReadableStreamBYOBRequest): Added.
+        * Modules/streams/ReadableStreamBYOBRequest.js:
+        (view): Added.
+
 2017-02-21  Simon Fraser  <[email protected]>
 
         Clarify the status of 'webkitSubtle' and 'subtle' attributes on the WebCrypto API.

Modified: trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js (212747 => 212748)


--- trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js	2017-02-21 21:47:40 UTC (rev 212747)
+++ trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js	2017-02-21 21:53:28 UTC (rev 212748)
@@ -95,6 +95,15 @@
     return @isObject(controller) && !!controller.@underlyingByteSource;
 }
 
+function isReadableStreamBYOBRequest(byobRequest)
+{
+    "use strict";
+
+    // Same test mechanism as in isReadableStreamDefaultController (ReadableStreamInternals.js).
+    // See corresponding function for explanations.
+    return @isObject(byobRequest) && !!byobRequest.@associatedReadableByteStreamController;
+}
+
 function isReadableStreamBYOBReader(reader)
 {
     "use strict";

Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamBYOBRequest.js (212747 => 212748)


--- trunk/Source/WebCore/Modules/streams/ReadableStreamBYOBRequest.js	2017-02-21 21:47:40 UTC (rev 212747)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamBYOBRequest.js	2017-02-21 21:53:28 UTC (rev 212748)
@@ -45,6 +45,8 @@
 {
     "use strict";
 
-    // FIXME: Implement appropriate behavior.
-    @throwTypeError("ReadableByteStreamController view is not implemented");
+    if (!@isReadableStreamBYOBRequest(this))
+        throw @makeGetterTypeError("ReadableStreamBYOBRequest", "view");
+
+    return this.@view;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to