Skip to content

Editorial: add cross-links to internal slots #1050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 77 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
d485c12
Add definitions for ReadableStream internal slots
MattiasBuelens Aug 5, 2020
b3f8ed4
Link ReadableStream.[[disturbed]]
MattiasBuelens Aug 5, 2020
cefdca2
Link ReadableStream.[[reader]]
MattiasBuelens Aug 5, 2020
ec49278
Link ReadableStream.[[controller]]
MattiasBuelens Aug 5, 2020
93a3b97
Link ReadableStream.[[state]]
MattiasBuelens Aug 5, 2020
eb74994
Link ReadableStream.[[storedError]]
MattiasBuelens Aug 5, 2020
b35905b
Add definitions for reader internal slots
MattiasBuelens Aug 6, 2020
67a08f9
Link reader slots
MattiasBuelens Aug 6, 2020
e0ae0bc
Add ReadableStreamGenericReader interface mixin
MattiasBuelens Aug 7, 2020
401146f
Address review comments
MattiasBuelens Aug 11, 2020
d885b60
Use closed and cancel() definitions from generic reader
MattiasBuelens Aug 11, 2020
c4cba1a
Replace "interface mixin" with "mixin" in prose
MattiasBuelens Aug 11, 2020
2eb10dc
Add definitions for readable stream controller internal slots
MattiasBuelens Aug 11, 2020
74c8073
Link controller.[[cancelAlgorithm]]
MattiasBuelens Aug 11, 2020
aaea5fc
Link controller.[[closeRequested]]
MattiasBuelens Aug 11, 2020
ac340de
Link controller.[[pullAgain]]
MattiasBuelens Aug 11, 2020
e129a13
Link controller.[[pullAlgorithm]]
MattiasBuelens Aug 11, 2020
99f9ff2
Link controller.[[pulling]]
MattiasBuelens Aug 11, 2020
2d1354b
Link controller.[[queue]]
MattiasBuelens Aug 11, 2020
72e1bdb
Link controller.[[queueTotalSize]]
MattiasBuelens Aug 11, 2020
160c4ed
Link controller.[[started]]
MattiasBuelens Aug 11, 2020
4bddc7e
Link controller.[[strategyHWM]]
MattiasBuelens Aug 11, 2020
d8c1a2e
Link controller.[[strategySizeAlgorithm]]
MattiasBuelens Aug 11, 2020
d695958
Link controller.[[stream]]
MattiasBuelens Aug 11, 2020
12bd4c5
Link controller.[[autoAllocateChunkSize]]
MattiasBuelens Aug 11, 2020
7ba7477
Link controller.[[byobRequest]]
MattiasBuelens Aug 11, 2020
66d7424
Link controller.[[pendingPullIntos]]
MattiasBuelens Aug 11, 2020
9514168
Add definitions for ReadableStreamBYOBRequest internal slots
MattiasBuelens Aug 11, 2020
fa80fdf
Link ReadableStreamBYOBRequest.[[controller]]
MattiasBuelens Aug 11, 2020
8394ae5
Link ReadableStreamBYOBRequest.[[view]]
MattiasBuelens Aug 11, 2020
34c6738
Fix incorrect reference in note below ReadableStreamClose
MattiasBuelens Aug 11, 2020
1c96cd2
Add some more links
MattiasBuelens Aug 11, 2020
1fe69a7
Add ReadableStreamGenericReader IDL to reference implementation
MattiasBuelens Aug 12, 2020
77cde48
Remove redundant note below ReadableStreamClose
MattiasBuelens Aug 12, 2020
0ea00c0
Add definitions for WritableStream internal slots
MattiasBuelens Aug 12, 2020
6647d40
Link WritableStream.[[backpressure]]
MattiasBuelens Aug 12, 2020
24c0af1
Link WritableStream.[[closeRequest]]
MattiasBuelens Aug 12, 2020
ddd127c
Link WritableStream.[[controller]]
MattiasBuelens Aug 12, 2020
b6734d4
Link WritableStream.[[inFlightWriteRequest]]
MattiasBuelens Aug 12, 2020
a73040f
Link WritableStream.[[inFlightCloseRequest]]
MattiasBuelens Aug 12, 2020
6f7ddd7
Link WritableStream.[[pendingAbortRequest]]
MattiasBuelens Aug 12, 2020
adb4fb3
Link WritableStream.[[state]]
MattiasBuelens Aug 12, 2020
66d8ee2
Link WritableStream.[[storedError]]
MattiasBuelens Aug 12, 2020
fb11636
Link WritableStream.[[writer]]
MattiasBuelens Aug 12, 2020
0263702
Link WritableStream.[[writeRequests]]
MattiasBuelens Aug 12, 2020
71f2c76
Add definitions for WritableStreamDefaultWriter internal slots
MattiasBuelens Aug 12, 2020
c22418f
Link WritableStreamDefaultWriter.[[closedPromise]]
MattiasBuelens Aug 12, 2020
81909a7
Link WritableStreamDefaultWriter.[[readyPromise]]
MattiasBuelens Aug 12, 2020
144024c
Link WritableStreamDefaultWriter.[[stream]]
MattiasBuelens Aug 12, 2020
5e1d8a9
Add definitions for WritableStreamDefaultController internal slots
MattiasBuelens Aug 12, 2020
eac52c9
Link WritableStreamDefaultController.[[abortAlgorithm]]
MattiasBuelens Aug 12, 2020
cc46a1a
Link WritableStreamDefaultController.[[closeAlgorithm]]
MattiasBuelens Aug 12, 2020
5c3d979
Link WritableStreamDefaultController.[[queue]]
MattiasBuelens Aug 12, 2020
e96e3d1
Link WritableStreamDefaultController.[[queueTotalSize]]
MattiasBuelens Aug 12, 2020
8780273
Link WritableStreamDefaultController.[[started]]
MattiasBuelens Aug 12, 2020
09a86ca
Link WritableStreamDefaultController.[[strategyHWM]]
MattiasBuelens Aug 12, 2020
2cb3415
Link WritableStreamDefaultController.[[strategySizeAlgorithm]]
MattiasBuelens Aug 12, 2020
67098f0
Link WritableStreamDefaultController.[[stream]]
MattiasBuelens Aug 12, 2020
1fb428e
Link WritableStreamDefaultController.[[writeAlgorithm]]
MattiasBuelens Aug 12, 2020
b752d84
Add definitions for TransformStream internal slots
MattiasBuelens Aug 12, 2020
6652357
Link TransformStream.[[backpressure]]
MattiasBuelens Aug 12, 2020
db89c7f
Link TransformStream.[[backpressureChangePromise]]
MattiasBuelens Aug 12, 2020
16d45ba
Link TransformStream.[[controller]]
MattiasBuelens Aug 12, 2020
21c4cb9
Link TransformStream.[[readable]]
MattiasBuelens Aug 12, 2020
cfaaab1
Link TransformStream.[[writable]]
MattiasBuelens Aug 12, 2020
ca8dcd5
Add definitions for TransformStreamDefaultController internal slots
MattiasBuelens Aug 12, 2020
01e48e9
Link TransformStreamDefaultController.[[flushAlgorithm]]
MattiasBuelens Aug 12, 2020
abc59fd
Link TransformStreamDefaultController.[[stream]]
MattiasBuelens Aug 12, 2020
4a9986f
Link TransformStreamDefaultController.[[transformAlgorithm]]
MattiasBuelens Aug 12, 2020
30ce26b
Add definition for ByteLengthQueuingStrategy internal slot
MattiasBuelens Aug 12, 2020
984921e
Link ByteLengthQueuingStrategy.[[highWaterMark]]
MattiasBuelens Aug 12, 2020
dc7a247
Add definition for CountQueuingStrategy internal slot
MattiasBuelens Aug 12, 2020
df15f5f
Link CountQueuingStrategy.[[highWaterMark]]
MattiasBuelens Aug 12, 2020
0959a09
Implement ReadableStreamGenericReader mixin
MattiasBuelens Aug 12, 2020
861215a
Wrap long lines
MattiasBuelens Aug 12, 2020
5abced8
More line-wrapping (including some preexisting issues)
domenic Aug 13, 2020
2ace378
Apply suggestions from code review
MattiasBuelens Aug 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,548 changes: 842 additions & 706 deletions index.bs

Large diffs are not rendered by default.

22 changes: 8 additions & 14 deletions reference-implementation/lib/ReadableStreamBYOBReader-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,14 @@

const { newPromise, resolvePromise, rejectPromise, promiseRejectedWith } = require('./helpers/webidl.js');
const aos = require('./abstract-ops/readable-streams.js');
const { mixin } = require('./helpers/miscellaneous.js');
const ReadableStreamGenericReaderImpl = require('./ReadableStreamGenericReader-impl.js').implementation;

exports.implementation = class ReadableStreamBYOBReaderImpl {
class ReadableStreamBYOBReaderImpl {
constructor(globalObject, [stream]) {
aos.SetUpReadableStreamBYOBReader(this, stream);
}

get closed() {
return this._closedPromise;
}

cancel(reason) {
if (this._stream === undefined) {
return promiseRejectedWith(readerLockException('cancel'));
}

return aos.ReadableStreamReaderGenericCancel(this, reason);
}

read(view) {
if (view.byteLength === 0) {
return promiseRejectedWith(new TypeError('view must have non-zero byteLength'));
Expand Down Expand Up @@ -53,7 +43,11 @@ exports.implementation = class ReadableStreamBYOBReaderImpl {

aos.ReadableStreamReaderGenericRelease(this);
}
};
}

mixin(ReadableStreamBYOBReaderImpl.prototype, ReadableStreamGenericReaderImpl.prototype);

exports.implementation = ReadableStreamBYOBReaderImpl;

function readerLockException(name) {
return new TypeError('Cannot ' + name + ' a stream using a released reader');
Expand Down
4 changes: 1 addition & 3 deletions reference-implementation/lib/ReadableStreamBYOBReader.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
interface ReadableStreamBYOBReader {
constructor(ReadableStream stream);

readonly attribute Promise<void> closed;

Promise<void> cancel(optional any reason);
Promise<ReadableStreamBYOBReadResult> read(ArrayBufferView view);
void releaseLock();
};
ReadableStreamBYOBReader includes ReadableStreamGenericReader;
22 changes: 8 additions & 14 deletions reference-implementation/lib/ReadableStreamDefaultReader-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,14 @@

const { newPromise, resolvePromise, rejectPromise, promiseRejectedWith } = require('./helpers/webidl.js');
const aos = require('./abstract-ops/readable-streams.js');
const { mixin } = require('./helpers/miscellaneous.js');
const ReadableStreamGenericReaderImpl = require('./ReadableStreamGenericReader-impl.js').implementation;

exports.implementation = class ReadableStreamDefaultReaderImpl {
class ReadableStreamDefaultReaderImpl {
constructor(globalObject, [stream]) {
aos.SetUpReadableStreamDefaultReader(this, stream);
}

get closed() {
return this._closedPromise;
}

cancel(reason) {
if (this._stream === undefined) {
return promiseRejectedWith(readerLockException('cancel'));
}

return aos.ReadableStreamReaderGenericCancel(this, reason);
}

read() {
if (this._stream === undefined) {
return promiseRejectedWith(readerLockException('read from'));
Expand Down Expand Up @@ -47,7 +37,11 @@ exports.implementation = class ReadableStreamDefaultReaderImpl {

aos.ReadableStreamReaderGenericRelease(this);
}
};
}

mixin(ReadableStreamDefaultReaderImpl.prototype, ReadableStreamGenericReaderImpl.prototype);

exports.implementation = ReadableStreamDefaultReaderImpl;

function readerLockException(name) {
return new TypeError('Cannot ' + name + ' a stream using a released reader');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
interface ReadableStreamDefaultReader {
constructor(ReadableStream stream);

readonly attribute Promise<void> closed;

Promise<void> cancel(optional any reason);
Promise<ReadableStreamDefaultReadResult> read();
void releaseLock();
};
ReadableStreamDefaultReader includes ReadableStreamGenericReader;
22 changes: 22 additions & 0 deletions reference-implementation/lib/ReadableStreamGenericReader-impl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

const { promiseRejectedWith } = require('./helpers/webidl.js');
const aos = require('./abstract-ops/readable-streams.js');

exports.implementation = class ReadableStreamGenericReaderImpl {
get closed() {
return this._closedPromise;
}

cancel(reason) {
if (this._stream === undefined) {
return promiseRejectedWith(readerLockException('cancel'));
}

return aos.ReadableStreamReaderGenericCancel(this, reason);
}
};

function readerLockException(name) {
return new TypeError('Cannot ' + name + ' a stream using a released reader');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
interface mixin ReadableStreamGenericReader {
readonly attribute Promise<void> closed;

Promise<void> cancel(optional any reason);
};
11 changes: 11 additions & 0 deletions reference-implementation/lib/helpers/miscellaneous.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,14 @@ exports.rethrowAssertionErrorRejection = e => {
}, 0);
}
};

exports.mixin = (target, source) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shamelessly stolen from jsdom. 😁

const keys = Reflect.ownKeys(source);
for (let i = 0; i < keys.length; ++i) {
if (keys[i] in target) {
continue;
}

Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i]));
}
};