mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-21 11:53:07 +09:00
Also renames FetchSignal to AbortSignal. Includes renaming the various controlling prefs to enable.
27 lines
515 B
JavaScript
27 lines
515 B
JavaScript
function testWorkerAbortedFetch() {
|
|
var fc = new AbortController();
|
|
fc.abort();
|
|
|
|
fetch('slow.sjs', { signal: fc.signal }).then(() => {
|
|
postMessage(false);
|
|
}, e => {
|
|
postMessage(e.name == "AbortError");
|
|
});
|
|
}
|
|
|
|
function testWorkerFetchAndAbort() {
|
|
var fc = new AbortController();
|
|
|
|
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]();
|
|
}
|