mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 15:27:32 +09:00
Issue #1587 - Part 6: Move FetchController/Signal to its own dir
Since it is specced separately from fetch.
This commit is contained in:
parent
3d2ca85edd
commit
0c2404efa7
13 changed files with 41 additions and 7 deletions
27
dom/abort/tests/worker_fetch_controller.js
Normal file
27
dom/abort/tests/worker_fetch_controller.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
function testWorkerAbortedFetch() {
|
||||
var fc = new FetchController();
|
||||
fc.abort();
|
||||
|
||||
fetch('slow.sjs', { signal: fc.signal }).then(() => {
|
||||
postMessage(false);
|
||||
}, e => {
|
||||
postMessage(e.name == "AbortError");
|
||||
});
|
||||
}
|
||||
|
||||
function testWorkerFetchAndAbort() {
|
||||
var fc = new FetchController();
|
||||
|
||||
var p = fetch('slow.sjs', { signal: fc.signal });
|
||||
fc.abort();
|
||||
|
||||
p.then(() => {
|
||||
postMessage(false);
|
||||
}, e => {
|
||||
postMessage(e.name == "AbortError");
|
||||
});
|
||||
}
|
||||
|
||||
onmessage = function(e) {
|
||||
self[e.data]();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue