Skip to content

Commit

Permalink
Add typedef ReadableStreamReader to readable_stream.idl
Browse files Browse the repository at this point in the history
In this CL, the typedef for ReadableStreamReader is added to
the Readable Stream WebIDL file based on the Streams API
Standard[1]. In order to avoid confusion, the ReadableStreamReader
class is also renamed to ReadableStreamGenericReader. This also
makes more sense as the base class for the Default and BYOB Readers.
Furthermore, the return value of getReader() is also changed to
use the ReadableStreamReader typedef.

Due to how the bindings code works, this meant that the return
type of getReader in the C++ implementation also had to be changed
to void and pass the ReadableStreamReader as a parameter, which is
set as the returned reader.

Lastly, a new function called GetDefaultReaderForTesting() is added
to support calls to getReader() and read() in the various test files
without having to change the return type everywhere.

[1] https://streams.spec.whatwg.org/#typedefdef-readablestreamreader

Bug: 1093862
Change-Id: Icbb34470f52ddcef53e9b1fa34f3dd8f27c48198
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2524628
Commit-Queue: Nidhi Jaju <nidhijaju@google.com>
Reviewed-by: Adam Rice <ricea@chromium.org>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826119}
  • Loading branch information
nidhijaju authored and chromium-wpt-export-bot committed Nov 11, 2020
1 parent 45b8d33 commit 005f922
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion streams/readable-byte-streams/general.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ test(() => {
const reader = stream.getReader();
reader.read();
assert_throws_js(TypeError, () => reader.releaseLock(), 'reader.releaseLock() must throw');
}, 'ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw');
}, 'ReadableStream with byte source: releaseLock() on ReadableStreamDefaultReader with pending read() must throw');

promise_test(() => {
let pullCount = 0;
Expand Down

0 comments on commit 005f922

Please sign in to comment.