blob: 76d30b01bf1bfc04d30680206430c3b6f7b6d406 (
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
|
function testWorkerAbortedFetch() {
var ac = new AbortController();
ac.abort();
fetch("slow.sjs", { signal: ac.signal }).then(
() => {
postMessage(false);
},
e => {
postMessage(e.name == "AbortError");
}
);
}
function testWorkerFetchAndAbort() {
var ac = new AbortController();
var p = fetch("slow.sjs", { signal: ac.signal });
ac.abort();
p.then(
() => {
postMessage(false);
},
e => {
postMessage(e.name == "AbortError");
}
);
}
self.onmessage = function(e) {
self[e.data]();
};
|