Issue #1587 - Part 5: Hook FetchObserver up to the Fetch API

This commit is contained in:
Moonchild 2020-06-11 08:51:07 +00:00 committed by Roy Tam
commit 3d2ca85edd
11 changed files with 399 additions and 75 deletions

View 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]();
}