blob: 0be334e230b4346cc7b0f19eb77ba76e76f35cca (
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
|
// Test uncatchable error when a stream source's pull() method is called.
let readerCreated = false;
let fnFinished = false;
let g;
add_task(async function test() {
// Make `debugger;` raise an uncatchable error.
g = newGlobal({ newCompartment: true });
g.parent = this;
g.hit = false;
g.eval(
` new Debugger(parent).onDebuggerStatement = _frame => (hit = true, null);`
);
// Create a stream whose pull() method raises an uncatchable error,
// and try reading from it.
async function fn() {
try {
let stream = new ReadableStream({
start() {},
pull() {
// eslint-disable-next-line no-debugger
debugger;
},
});
let reader = stream.getReader();
let p = reader.read();
readerCreated = true;
await p;
} finally {
fnFinished = true;
}
}
fn();
});
add_task(() => {
equal(readerCreated, true);
equal(g.hit, true);
equal(fnFinished, false);
});
|