blob: faf3fdd95214304e3bc108057111a8a660117025 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// META: global=window,worker
'use strict';
const error1 = new Error('error1');
error1.name = 'error1';
const error2 = new Error('error2');
error2.name = 'error2';
promise_test(t => {
const ws = new WritableStream({
start(controller) {
controller.error(error1);
}
});
return promise_rejects_exactly(t, error1, ws.getWriter().closed, 'stream should be errored');
}, 'controller.error() should error the stream');
test(() => {
let controller;
const ws = new WritableStream({
start(c) {
controller = c;
}
});
ws.abort();
controller.error(error1);
}, 'controller.error() on erroring stream should not throw');
promise_test(t => {
let controller;
const ws = new WritableStream({
start(c) {
controller = c;
}
});
controller.error(error1);
controller.error(error2);
return promise_rejects_exactly(t, error1, ws.getWriter().closed, 'first controller.error() should win');
}, 'surplus calls to controller.error() should be a no-op');
promise_test(() => {
let controller;
const ws = new WritableStream({
start(c) {
controller = c;
}
});
return ws.abort().then(() => {
controller.error(error1);
});
}, 'controller.error() on errored stream should not throw');
promise_test(() => {
let controller;
const ws = new WritableStream({
start(c) {
controller = c;
}
});
return ws.getWriter().close().then(() => {
controller.error(error1);
});
}, 'controller.error() on closed stream should not throw');
|