Skip to content

Commit e9355ce

Browse files
authored
Fix IDL validity by removing ReadableStreamBYOBReadResult
In #1214, ReadableStreamBYOBReadResult was changed to have a value property of type `(ArrayBufferView or undefined) value`, since it is possible for the value to be undefined. However, the Web IDL specification says that is invalid IDL: > undefined must not be used as the type of an argument in any circumstance (in > an operation, callback function, constructor operation, etc), or as the type > of a dictionary member, whether directly or in a union. Instead, use an > optional argument or a non-required dictionary member. > https://webidl.spec.whatwg.org/#idl-undefined So this instead removes ReadableStreamBYOBReadResult entirely, in favor of a renamed ReadableStreamDefaultReadResult, which has type any for its value.
1 parent 9538b77 commit e9355ce

File tree

6 files changed

+17
-26
lines changed

6 files changed

+17
-26
lines changed

index.bs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,12 +1159,12 @@ The Web IDL definition for the {{ReadableStreamDefaultReader}} class is given as
11591159
interface ReadableStreamDefaultReader {
11601160
constructor(ReadableStream stream);
11611161

1162-
Promise<ReadableStreamDefaultReadResult> read();
1162+
Promise<ReadableStreamReadResult> read();
11631163
undefined releaseLock();
11641164
};
11651165
ReadableStreamDefaultReader includes ReadableStreamGenericReader;
11661166

1167-
dictionary ReadableStreamDefaultReadResult {
1167+
dictionary ReadableStreamReadResult {
11681168
any value;
11691169
boolean done;
11701170
};
@@ -1267,12 +1267,12 @@ to filling the [=readable stream=]'s [=internal queue=] or changing its state. I
12671267
1. Let |readRequest| be a new [=read request=] with the following [=struct/items=]:
12681268
: [=read request/chunk steps=], given |chunk|
12691269
::
1270-
1. [=Resolve=] |promise| with «[ "{{ReadableStreamDefaultReadResult/value}}" → |chunk|,
1271-
"{{ReadableStreamDefaultReadResult/done}}" → false ]».
1270+
1. [=Resolve=] |promise| with «[ "{{ReadableStreamReadResult/value}}" → |chunk|,
1271+
"{{ReadableStreamReadResult/done}}" → false ]».
12721272
: [=read request/close steps=]
12731273
::
1274-
1. [=Resolve=] |promise| with «[ "{{ReadableStreamDefaultReadResult/value}}" → undefined,
1275-
"{{ReadableStreamDefaultReadResult/done}}" → true ]».
1274+
1. [=Resolve=] |promise| with «[ "{{ReadableStreamReadResult/value}}" → undefined,
1275+
"{{ReadableStreamReadResult/done}}" → true ]».
12761276
: [=read request/error steps=], given |e|
12771277
::
12781278
1. [=Reject=] |promise| with |e|.
@@ -1302,15 +1302,10 @@ The Web IDL definition for the {{ReadableStreamBYOBReader}} class is given as fo
13021302
interface ReadableStreamBYOBReader {
13031303
constructor(ReadableStream stream);
13041304

1305-
Promise<ReadableStreamBYOBReadResult> read(ArrayBufferView view);
1305+
Promise<ReadableStreamReadResult> read(ArrayBufferView view);
13061306
undefined releaseLock();
13071307
};
13081308
ReadableStreamBYOBReader includes ReadableStreamGenericReader;
1309-
1310-
dictionary ReadableStreamBYOBReadResult {
1311-
(ArrayBufferView or undefined) value;
1312-
boolean done;
1313-
};
13141309
</xmp>
13151310

13161311
<h4 id="byob-reader-internal-slots">Internal slots</h4>
@@ -1432,12 +1427,12 @@ value: newViewOnSameMemory, done: true }</code> for closed streams. If the strea
14321427
1. Let |readIntoRequest| be a new [=read-into request=] with the following [=struct/items=]:
14331428
: [=read-into request/chunk steps=], given |chunk|
14341429
::
1435-
1. [=Resolve=] |promise| with «[ "{{ReadableStreamBYOBReadResult/value}}" → |chunk|,
1436-
"{{ReadableStreamBYOBReadResult/done}}" → false ]».
1430+
1. [=Resolve=] |promise| with «[ "{{ReadableStreamReadResult/value}}" → |chunk|,
1431+
"{{ReadableStreamReadResult/done}}" → false ]».
14371432
: [=read-into request/close steps=], given |chunk|
14381433
::
1439-
1. [=Resolve=] |promise| with «[ "{{ReadableStreamBYOBReadResult/value}}" → |chunk|,
1440-
"{{ReadableStreamBYOBReadResult/done}}" → true ]».
1434+
1. [=Resolve=] |promise| with «[ "{{ReadableStreamReadResult/value}}" → |chunk|,
1435+
"{{ReadableStreamReadResult/done}}" → true ]».
14411436
: [=read-into request/error steps=], given |e|
14421437
::
14431438
1. [=Reject=] |promise| with |e|.

reference-implementation/lib/ReadableStreamBYOBReadResult.webidl

Lines changed: 0 additions & 4 deletions
This file was deleted.

reference-implementation/lib/ReadableStreamBYOBReader.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
interface ReadableStreamBYOBReader {
33
constructor(ReadableStream stream);
44

5-
Promise<ReadableStreamBYOBReadResult> read(ArrayBufferView view);
5+
Promise<ReadableStreamReadResult> read(ArrayBufferView view);
66
undefined releaseLock();
77
};
88
ReadableStreamBYOBReader includes ReadableStreamGenericReader;

reference-implementation/lib/ReadableStreamDefaultReadResult.webidl

Lines changed: 0 additions & 4 deletions
This file was deleted.

reference-implementation/lib/ReadableStreamDefaultReader.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
interface ReadableStreamDefaultReader {
33
constructor(ReadableStream stream);
44

5-
Promise<ReadableStreamDefaultReadResult> read();
5+
Promise<ReadableStreamReadResult> read();
66
undefined releaseLock();
77
};
88
ReadableStreamDefaultReader includes ReadableStreamGenericReader;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dictionary ReadableStreamReadResult {
2+
any value;
3+
boolean done;
4+
};

0 commit comments

Comments
 (0)