Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
提交
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
8 changes: 3 additions & 5 deletions test/fixtures/wpt/streams/WEB_FEATURES.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
features:
- name: streams
files:
# Top-level only. Subdirectories have their own mapping.
- "*"
rules:
# Top-level only. Subdirectories have their own mapping.
- "*": [streams]
2 changes: 1 addition & 1 deletion test/fixtures/wpt/streams/idlharness.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm-in-window
// META: global=window,worker
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// META: timeout=long
Expand Down
5 changes: 2 additions & 3 deletions test/fixtures/wpt/streams/piping/WEB_FEATURES.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
features:
- name: streams
files: "**"
rules:
- "**": [streams]
2 changes: 1 addition & 1 deletion test/fixtures/wpt/streams/piping/abort.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/recording-streams.js
// META: script=../resources/test-utils.js
'use strict';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/recording-streams.js
'use strict';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
// META: script=../resources/recording-streams.js
'use strict';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
// META: script=../resources/recording-streams.js
'use strict';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
// META: script=../resources/recording-streams.js
'use strict';
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/streams/piping/flow-control.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
// META: script=../resources/rs-utils.js
// META: script=../resources/recording-streams.js
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/streams/piping/general-addition.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
'use strict';

promise_test(async t => {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/streams/piping/general.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/recording-streams.js
'use strict';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
// META: script=../resources/recording-streams.js
'use strict';
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/streams/piping/pipe-through.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/rs-utils.js
// META: script=../resources/test-utils.js
// META: script=../resources/recording-streams.js
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/streams/piping/then-interception.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
// META: script=../resources/recording-streams.js
'use strict';
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/streams/piping/throwing-options.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
'use strict';

class ThrowingOptions {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/streams/piping/transform-streams.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
'use strict';

promise_test(() => {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/streams/queuing-strategies.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
'use strict';

const highWaterMarkConversions = new Map([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
features:
- name: readable-byte-streams
files: "**"
rules:
- "**": [readable-byte-streams]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
'use strict';

promise_test(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/rs-utils.js
'use strict';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker

promise_test(async t => {
const error = new Error('cannot proceed');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/rs-utils.js
// META: script=../resources/test-utils.js
'use strict';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
'use strict';

promise_test(async t => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
'use strict';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/rs-utils.js
// META: script=../resources/test-utils.js
'use strict';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker

'use strict';

Expand Down
35 changes: 34 additions & 1 deletion test/fixtures/wpt/streams/readable-byte-streams/tee.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/rs-utils.js
// META: script=../resources/test-utils.js
// META: script=../resources/recording-streams.js
Expand Down Expand Up @@ -351,6 +351,39 @@ promise_test(async () => {

}, 'ReadableStream teeing with byte source: canceling branch1 should finish when branch2 reads until end of stream');

promise_test(async () => {

let controller;
const rs = new ReadableStream({
type: 'bytes',
start(c) {
controller = c;
}
});

const [branch1, branch2] = rs.tee();
const reader1 = branch1.getReader({ mode: 'byob' });
const reader2 = branch2.getReader({ mode: 'byob' });
const cancelPromise = reader1.cancel();

controller.enqueue(new Uint8Array([0x01]));

const read2 = await reader2.read(new Uint8Array(1));
assert_equals(read2.done, false, 'first read() from branch2 should not be done');
assert_typed_array_equals(read2.value, new Uint8Array([0x01]), 'first read() from branch2');

controller.close();

const read2b = await reader2.read(new Uint8Array(1));
assert_equals(read2b.done, true, 'second read() from branch2 should be done');

await Promise.all([
reader2.closed,
cancelPromise
]);

}, 'ReadableStream teeing with byte source: canceling branch1 should finish when branch2 reads with a BYOB reader until end of stream');

promise_test(async t => {

let controller;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
// META: script=../resources/rs-test-templates.js
'use strict';
Expand Down
20 changes: 6 additions & 14 deletions test/fixtures/wpt/streams/readable-streams/WEB_FEATURES.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
features:
- name: streams
files:
- "*"
- "!async-iterator.any.js"
- "!from.any.js"
# 'owning' type is not yet standardized
- "!owning-type*"
- name: async-iterable-streams
files:
- async-iterator.any.js
- name: readablestream-from
files:
- from.any.js
rules:
- async-iterator.any.js: [async-iterable-streams]
- from.any.js: [readablestream-from]
# 'owning' type is not yet standardized
- owning-type*: []
- "*": [streams]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/rs-utils.js
// META: script=../resources/test-utils.js
// META: script=../resources/recording-streams.js
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
'use strict';

test(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
'use strict';


Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/streams/readable-streams/cancel.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
// META: script=../resources/rs-utils.js
'use strict';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
'use strict';

const error1 = new Error('error1');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
'use strict';

test(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
features:
- name: streams
files:
- strategy-worker-terminate.html
- name: readablestream-from
files:
- from-cross-realm.https.html
rules:
- strategy-worker-terminate.html: [streams]
- from-cross-realm.https.html: [readablestream-from]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/rs-utils.js
'use strict';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
'use strict';

// Due to the limitations of floating-point precision, the calculation of desiredSize sometimes gives different answers
Expand Down
34 changes: 28 additions & 6 deletions test/fixtures/wpt/streams/readable-streams/from.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
'use strict';

Expand All @@ -18,11 +18,6 @@ const iterableFactories = [
return ['a', 'b'][Symbol.iterator]();
}],

['a string', () => {
// This iterates over the code points of the string.
return 'ab';
}],

['a Set', () => {
return new Set(['a', 'b']);
}],
Expand Down Expand Up @@ -81,6 +76,19 @@ const iterableFactories = [
return iterable;
}],

['a sync iterable with a function iterator', () => {
const chunks = ['a', 'b'];
function functionIterator() {}
functionIterator.next = () => ({
done: chunks.length === 0,
value: chunks.shift()
});
const iterable = {
[Symbol.iterator]: () => functionIterator
};
return iterable;
}],

['an async iterable', () => {
const chunks = ['a', 'b'];
const asyncIterator = {
Expand All @@ -97,6 +105,19 @@ const iterableFactories = [
return asyncIterable;
}],

['an async iterable with a function iterator', () => {
const chunks = ['a', 'b'];
function functionAsyncIterator() {}
functionAsyncIterator.next = () => Promise.resolve({
done: chunks.length === 0,
value: chunks.shift()
});
const asyncIterable = {
[Symbol.asyncIterator]: () => functionAsyncIterator
};
return asyncIterable;
}],

['a ReadableStream', () => {
return new ReadableStream({
start(c) {
Expand Down Expand Up @@ -144,6 +165,7 @@ const badIterables = [
['Object.create(null)', Object.create(null)],
['a function', () => 42],
['a symbol', Symbol()],
['a string', 'ab'],
['an object with a non-callable @@iterator method', {
[Symbol.iterator]: 42
}],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
// META: script=/common/gc.js
'use strict';
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/streams/readable-streams/general.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
// META: script=../resources/rs-utils.js
'use strict';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
// META: script=../resources/rs-utils.js
'use strict';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/test-utils.js
// META: script=../resources/rs-utils.js
'use strict';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
'use strict';

// Tests which patch the global environment are kept separate to avoid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/recording-streams.js
// META: script=../resources/rs-utils.js
// META: script=../resources/test-utils.js
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/streams/readable-streams/tee.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,shadowrealm
// META: global=window,worker
// META: script=../resources/rs-utils.js
// META: script=../resources/test-utils.js
// META: script=../resources/recording-streams.js
Expand Down
Loading
Loading