Skip to content
Permalink
Browse files
Update WPT streams test to ToT
https://bugs.webkit.org/show_bug.cgi?id=224284

Reviewed by Alex Christensen.

* web-platform-tests/streams/README.md:
* web-platform-tests/streams/piping/general.any-expected.txt:
* web-platform-tests/streams/piping/general.any.js:
(promise_test.t.const.rs.new.ReadableStream.start):
* web-platform-tests/streams/piping/general.any.worker-expected.txt:
* web-platform-tests/streams/readable-byte-streams/bad-buffers-and-views.any-expected.txt:
* web-platform-tests/streams/readable-byte-streams/bad-buffers-and-views.any.js:
* web-platform-tests/streams/readable-byte-streams/bad-buffers-and-views.any.worker-expected.txt:
* web-platform-tests/streams/readable-byte-streams/general.any-expected.txt:
* web-platform-tests/streams/readable-byte-streams/general.any.js:
(test):
* web-platform-tests/streams/readable-byte-streams/general.any.worker-expected.txt:
* web-platform-tests/streams/readable-streams/async-iterator.any-expected.txt:
* web-platform-tests/streams/readable-streams/async-iterator.any.js:
(promise_test.async const):
(promise_test):
* web-platform-tests/streams/readable-streams/async-iterator.any.worker-expected.txt:
* web-platform-tests/streams/readable-streams/default-reader.any-expected.txt:
* web-platform-tests/streams/readable-streams/default-reader.any.js:
(promise_test.t.const.rs.new.ReadableStream.start):
* web-platform-tests/streams/readable-streams/default-reader.any.worker-expected.txt:
* web-platform-tests/streams/readable-streams/general.any-expected.txt:
* web-platform-tests/streams/readable-streams/general.any.js:
(promise_test):
* web-platform-tests/streams/readable-streams/general.any.worker-expected.txt:
* web-platform-tests/streams/transform-streams/patched-global.any-expected.txt:
* web-platform-tests/streams/transform-streams/patched-global.any.js:
* web-platform-tests/streams/transform-streams/patched-global.any.worker-expected.txt:


Canonical link: https://commits.webkit.org/236394@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275824 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf committed Apr 12, 2021
1 parent 0d38737 commit dad91b2cb86ac7ce21647f22ad111a03950610d7
Show file tree
Hide file tree
Showing 23 changed files with 164 additions and 24 deletions.
@@ -1,3 +1,39 @@
2021-04-12 Youenn Fablet <youenn@apple.com>

Update WPT streams test to ToT
https://bugs.webkit.org/show_bug.cgi?id=224284

Reviewed by Alex Christensen.

* web-platform-tests/streams/README.md:
* web-platform-tests/streams/piping/general.any-expected.txt:
* web-platform-tests/streams/piping/general.any.js:
(promise_test.t.const.rs.new.ReadableStream.start):
* web-platform-tests/streams/piping/general.any.worker-expected.txt:
* web-platform-tests/streams/readable-byte-streams/bad-buffers-and-views.any-expected.txt:
* web-platform-tests/streams/readable-byte-streams/bad-buffers-and-views.any.js:
* web-platform-tests/streams/readable-byte-streams/bad-buffers-and-views.any.worker-expected.txt:
* web-platform-tests/streams/readable-byte-streams/general.any-expected.txt:
* web-platform-tests/streams/readable-byte-streams/general.any.js:
(test):
* web-platform-tests/streams/readable-byte-streams/general.any.worker-expected.txt:
* web-platform-tests/streams/readable-streams/async-iterator.any-expected.txt:
* web-platform-tests/streams/readable-streams/async-iterator.any.js:
(promise_test.async const):
(promise_test):
* web-platform-tests/streams/readable-streams/async-iterator.any.worker-expected.txt:
* web-platform-tests/streams/readable-streams/default-reader.any-expected.txt:
* web-platform-tests/streams/readable-streams/default-reader.any.js:
(promise_test.t.const.rs.new.ReadableStream.start):
* web-platform-tests/streams/readable-streams/default-reader.any.worker-expected.txt:
* web-platform-tests/streams/readable-streams/general.any-expected.txt:
* web-platform-tests/streams/readable-streams/general.any.js:
(promise_test):
* web-platform-tests/streams/readable-streams/general.any.worker-expected.txt:
* web-platform-tests/streams/transform-streams/patched-global.any-expected.txt:
* web-platform-tests/streams/transform-streams/patched-global.any.js:
* web-platform-tests/streams/transform-streams/patched-global.any.worker-expected.txt:

2021-04-11 Sam Weinig <weinig@apple.com>

Reduce compile time and binary size cost of enabling proper CSSStyleDeclaration property access behavior
@@ -1,3 +1,3 @@
# Streams Tests

The work on the streams tests is closely tracked by the specification authors, who maintain a reference implementation intended to match the spec line-by-line while passing all of these tests. See [the whatwg/streams repository for details](https://github.com/whatwg/streams/tree/master/reference-implementation). Some tests may be in that repository while the spec sections they test are still undergoing heavy churn.
The work on the streams tests is closely tracked by the specification authors, who maintain a reference implementation intended to match the spec line-by-line while passing all of these tests. See [the whatwg/streams repository for details](https://github.com/whatwg/streams/tree/main/reference-implementation). Some tests may be in that repository while the spec sections they test are still undergoing heavy churn.
@@ -12,4 +12,5 @@ PASS an undefined rejection from pull should cause pipeTo() to reject when preve
PASS an undefined rejection from write should cause pipeTo() to reject when preventCancel is true
PASS an undefined rejection from write should cause pipeTo() to reject when preventCancel is false
PASS pipeTo() should reject if an option getter grabs a writer
FAIL pipeTo() promise should resolve if null is passed null is not an Object.

@@ -198,3 +198,14 @@ promise_test(t => {
}
}), 'pipeTo should reject');
}, 'pipeTo() should reject if an option getter grabs a writer');

promise_test(t => {
const rs = new ReadableStream({
start(controller) {
controller.close();
}
});
const ws = new WritableStream();

return rs.pipeTo(ws, null);
}, 'pipeTo() promise should resolve if null is passed');
@@ -12,4 +12,5 @@ PASS an undefined rejection from pull should cause pipeTo() to reject when preve
PASS an undefined rejection from write should cause pipeTo() to reject when preventCancel is true
PASS an undefined rejection from write should cause pipeTo() to reject when preventCancel is false
PASS pipeTo() should reject if an option getter grabs a writer
FAIL pipeTo() promise should resolve if null is passed null is not an Object.

@@ -18,9 +18,7 @@ FAIL ReadableStream with byte source: respondWithNewView() throws if the supplie
FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view is zero-length on a non-zero-length buffer (in the readable state) assert_throws_js: function "() => c.byobRequest.respondWithNewView(view)" threw object "RangeError: Invalid value for view.byteLength" ("RangeError") expected instance of function "function TypeError() {
[native code]
}" ("TypeError")
FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) assert_throws_js: function "() => c.byobRequest.respondWithNewView(zeroLengthView)" threw object "RangeError: Invalid value for view.byteLength" ("RangeError") expected instance of function "function TypeError() {
[native code]
}" ("TypeError")
PASS ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state)
FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer is zero-length (in the closed state) assert_throws_js: function "() => c.byobRequest.respondWithNewView(view)" threw object "RangeError: Invalid value for view.byteLength" ("RangeError") expected instance of function "function TypeError() {
[native code]
}" ("TypeError")
@@ -212,8 +212,7 @@ async_test(t => {

c.close();

const zeroLengthView = new Uint8Array(view.buffer, 0, 0);
assert_throws_js(TypeError, () => c.byobRequest.respondWithNewView(zeroLengthView));
assert_throws_js(TypeError, () => c.byobRequest.respondWithNewView(view));
}),
type: 'bytes'
});
@@ -18,9 +18,7 @@ FAIL ReadableStream with byte source: respondWithNewView() throws if the supplie
FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view is zero-length on a non-zero-length buffer (in the readable state) assert_throws_js: function "() => c.byobRequest.respondWithNewView(view)" threw object "RangeError: Invalid value for view.byteLength" ("RangeError") expected instance of function "function TypeError() {
[native code]
}" ("TypeError")
FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state) assert_throws_js: function "() => c.byobRequest.respondWithNewView(zeroLengthView)" threw object "RangeError: Invalid value for view.byteLength" ("RangeError") expected instance of function "function TypeError() {
[native code]
}" ("TypeError")
PASS ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the closed state)
FAIL ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer is zero-length (in the closed state) assert_throws_js: function "() => c.byobRequest.respondWithNewView(view)" threw object "RangeError: Invalid value for view.byteLength" ("RangeError") expected instance of function "function TypeError() {
[native code]
}" ("TypeError")
@@ -6,6 +6,7 @@ PASS ReadableStream with byte source can be constructed with no errors
PASS getReader({mode}) must perform ToString()
PASS ReadableStream with byte source: Construct and expect start and pull being called
PASS ReadableStream with byte source: No automatic pull call if start doesn't finish
PASS ReadableStream with byte source: start() throws an exception
PASS ReadableStream with byte source: Construct with highWaterMark of 0
PASS ReadableStream with byte source: desiredSize when closed
PASS ReadableStream with byte source: desiredSize when errored
@@ -15,7 +16,7 @@ PASS ReadableStream with byte source: Test that closing a stream does not releas
PASS ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically
PASS ReadableStream with byte source: Test that erroring a stream does not release a reader automatically
PASS ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically
PASS ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw
PASS ReadableStream with byte source: releaseLock() on ReadableStreamDefaultReader with pending read() must throw
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 twice expected 2 but got 1
@@ -75,6 +76,9 @@ NOTRUN calling respondWithNewView() twice on the same byobRequest should throw
NOTRUN calling respond(0) twice on the same byobRequest should throw even when closed
NOTRUN pull() resolving should not make releaseLock() possible
NOTRUN ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction
FAIL ReadableStream with byte source: autoAllocateChunkSize cannot be 0 assert_throws_js: controller cannot be setup with autoAllocateChunkSize = 0 function "() => new ReadableStream({ autoAllocateChunkSize: 0, type: 'bytes' })" threw object "RangeError: autoAllocateChunkSize value is negative or equal to positive or negative infinity" ("RangeError") expected instance of function "function TypeError() {
[native code]
}" ("TypeError")
PASS ReadableStreamBYOBReader can be constructed directly
PASS ReadableStreamBYOBReader constructor requires a ReadableStream argument
PASS ReadableStreamBYOBReader constructor requires an unlocked ReadableStream
@@ -108,6 +108,11 @@ promise_test(() => {

}, 'ReadableStream with byte source: No automatic pull call if start doesn\'t finish');

test(() => {
assert_throws_js(Error, () => new ReadableStream({ start() { throw new Error(); }, type:'bytes' }),
'start() can throw an exception with type: bytes');
}, 'ReadableStream with byte source: start() throws an exception');

promise_test(t => {
new ReadableStream({
pull: t.unreached_func('pull() should not be called'),
@@ -239,7 +244,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;
@@ -2055,6 +2060,11 @@ promise_test(() => {
return readPromise;
}, 'ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction');

test(() => {
assert_throws_js(TypeError, () => new ReadableStream({ autoAllocateChunkSize: 0, type: 'bytes' }),
'controller cannot be setup with autoAllocateChunkSize = 0');
}, 'ReadableStream with byte source: autoAllocateChunkSize cannot be 0');

test(() => {
const ReadableStreamBYOBReader = new ReadableStream({ type: 'bytes' }).getReader({ mode: 'byob' }).constructor;
const stream = new ReadableStream({ type: 'bytes' });
@@ -6,6 +6,7 @@ PASS ReadableStream with byte source can be constructed with no errors
PASS getReader({mode}) must perform ToString()
PASS ReadableStream with byte source: Construct and expect start and pull being called
PASS ReadableStream with byte source: No automatic pull call if start doesn't finish
PASS ReadableStream with byte source: start() throws an exception
PASS ReadableStream with byte source: Construct with highWaterMark of 0
PASS ReadableStream with byte source: desiredSize when closed
PASS ReadableStream with byte source: desiredSize when errored
@@ -15,7 +16,7 @@ PASS ReadableStream with byte source: Test that closing a stream does not releas
PASS ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically
PASS ReadableStream with byte source: Test that erroring a stream does not release a reader automatically
PASS ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically
PASS ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw
PASS ReadableStream with byte source: releaseLock() on ReadableStreamDefaultReader with pending read() must throw
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 twice expected 2 but got 1
@@ -75,6 +76,9 @@ NOTRUN calling respondWithNewView() twice on the same byobRequest should throw
NOTRUN calling respond(0) twice on the same byobRequest should throw even when closed
NOTRUN pull() resolving should not make releaseLock() possible
NOTRUN ReadableStream with byte source: default reader + autoAllocateChunkSize + byobRequest interaction
FAIL ReadableStream with byte source: autoAllocateChunkSize cannot be 0 assert_throws_js: controller cannot be setup with autoAllocateChunkSize = 0 function "() => new ReadableStream({ autoAllocateChunkSize: 0, type: 'bytes' })" threw object "RangeError: autoAllocateChunkSize value is negative or equal to positive or negative infinity" ("RangeError") expected instance of function "function TypeError() {
[native code]
}" ("TypeError")
PASS ReadableStreamBYOBReader can be constructed directly
PASS ReadableStreamBYOBReader constructor requires a ReadableStream argument
PASS ReadableStreamBYOBReader constructor requires an unlocked ReadableStream
@@ -37,4 +37,5 @@ FAIL Acquiring a reader after partially async-iterating a stream promise_test: U
FAIL Acquiring a reader and reading the remaining chunks after partially async-iterating a stream with preventCancel = true promise_test: Unhandled rejection with value: object "TypeError: s.values is not a function. (In 's.values({preventCancel: true})', 's.values' is undefined)"
FAIL return() should unlock the stream synchronously when preventCancel = false rs.values is not a function. (In 'rs.values({ preventCancel })', 'rs.values' is undefined)
FAIL return() should unlock the stream synchronously when preventCancel = true rs.values is not a function. (In 'rs.values({ preventCancel })', 'rs.values' is undefined)
FAIL close() while next() is pending promise_test: Unhandled rejection with value: object "TypeError: undefined is not a function (near '...chunk of rs...')"

@@ -625,3 +625,26 @@ for (const preventCancel of [false, true]) {
rs.getReader();
}, `return() should unlock the stream synchronously when preventCancel = ${preventCancel}`);
}

promise_test(async () => {
const rs = new ReadableStream({
async start(c) {
c.enqueue('a');
c.enqueue('b');
c.enqueue('c');
await flushAsyncEvents();
// At this point, the async iterator has a read request in the stream's queue for its pending next() promise.
// Closing the stream now causes two things to happen *synchronously*:
// 1. ReadableStreamClose resolves reader.[[closedPromise]] with undefined.
// 2. ReadableStreamClose calls the read request's close steps, which calls ReadableStreamReaderGenericRelease,
// which replaces reader.[[closedPromise]] with a rejected promise.
c.close();
}
});

const chunks = [];
for await (const chunk of rs) {
chunks.push(chunk);
}
assert_array_equals(chunks, ['a', 'b', 'c']);
}, 'close() while next() is pending');
@@ -37,4 +37,5 @@ FAIL Acquiring a reader after partially async-iterating a stream promise_test: U
FAIL Acquiring a reader and reading the remaining chunks after partially async-iterating a stream with preventCancel = true promise_test: Unhandled rejection with value: object "TypeError: s.values is not a function. (In 's.values({preventCancel: true})', 's.values' is undefined)"
FAIL return() should unlock the stream synchronously when preventCancel = false rs.values is not a function. (In 'rs.values({ preventCancel })', 'rs.values' is undefined)
FAIL return() should unlock the stream synchronously when preventCancel = true rs.values is not a function. (In 'rs.values({ preventCancel })', 'rs.values' is undefined)
FAIL close() while next() is pending promise_test: Unhandled rejection with value: object "TypeError: undefined is not a function (near '...chunk of rs...')"

@@ -15,6 +15,8 @@ PASS Reading from a reader for an empty stream will wait until a chunk is availa
PASS cancel() on a reader does not release the reader
PASS closed should be fulfilled after stream is closed (.closed access before acquiring)
PASS closed should be rejected after reader releases its lock (multiple stream locks)
PASS closed is replaced when stream closes and reader releases its lock
PASS closed is replaced when stream errors and reader releases its lock
PASS Multiple readers can access the stream in sequence
PASS Cannot use an already-released reader to unlock a stream again
PASS cancel() on a released reader is a no-op and does not pass through
@@ -154,6 +154,57 @@ promise_test(t => {

}, 'closed should be rejected after reader releases its lock (multiple stream locks)');

promise_test(t => {

let controller;
const rs = new ReadableStream({
start(c) {
controller = c;
}
});

const reader = rs.getReader();
const promise1 = reader.closed;

controller.close();

reader.releaseLock();
const promise2 = reader.closed;

assert_not_equals(promise1, promise2, '.closed should be replaced');
return Promise.all([
promise1,
promise_rejects_js(t, TypeError, promise2, '.closed after releasing lock'),
]);

}, 'closed is replaced when stream closes and reader releases its lock');

promise_test(t => {

const theError = { name: 'unique error' };
let controller;
const rs = new ReadableStream({
start(c) {
controller = c;
}
});

const reader = rs.getReader();
const promise1 = reader.closed;

controller.error(theError);

reader.releaseLock();
const promise2 = reader.closed;

assert_not_equals(promise1, promise2, '.closed should be replaced');
return Promise.all([
promise_rejects_exactly(t, theError, promise1, '.closed before releasing lock'),
promise_rejects_js(t, TypeError, promise2, '.closed after releasing lock')
]);

}, 'closed is replaced when stream errors and reader releases its lock');

promise_test(() => {

const rs = new ReadableStream({
@@ -15,6 +15,8 @@ PASS Reading from a reader for an empty stream will wait until a chunk is availa
PASS cancel() on a reader does not release the reader
PASS closed should be fulfilled after stream is closed (.closed access before acquiring)
PASS closed should be rejected after reader releases its lock (multiple stream locks)
PASS closed is replaced when stream closes and reader releases its lock
PASS closed is replaced when stream errors and reader releases its lock
PASS Multiple readers can access the stream in sequence
PASS Cannot use an already-released reader to unlock a stream again
PASS cancel() on a released reader is a no-op and does not pass through

0 comments on commit dad91b2

Please sign in to comment.