summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/fetch/file_fetch_controller.html
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-06-11 08:51:07 +0000
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-06-13 11:52:04 +0200
commitbb7060582934f087b71702d1e83f762d5fd6f0af (patch)
treef61da2175542328c6a5e7a69280874dd1298f9b6 /dom/tests/mochitest/fetch/file_fetch_controller.html
parent3f3d626434b2533182ca0ee90adc92a1e7db373c (diff)
downloadUXP-bb7060582934f087b71702d1e83f762d5fd6f0af.tar
UXP-bb7060582934f087b71702d1e83f762d5fd6f0af.tar.gz
UXP-bb7060582934f087b71702d1e83f762d5fd6f0af.tar.lz
UXP-bb7060582934f087b71702d1e83f762d5fd6f0af.tar.xz
UXP-bb7060582934f087b71702d1e83f762d5fd6f0af.zip
Issue #1587 - Part 5: Hook FetchObserver up to the Fetch API
Diffstat (limited to 'dom/tests/mochitest/fetch/file_fetch_controller.html')
-rw-r--r--dom/tests/mochitest/fetch/file_fetch_controller.html40
1 files changed, 6 insertions, 34 deletions
diff --git a/dom/tests/mochitest/fetch/file_fetch_controller.html b/dom/tests/mochitest/fetch/file_fetch_controller.html
index 026ff16a8..e4137aac9 100644
--- a/dom/tests/mochitest/fetch/file_fetch_controller.html
+++ b/dom/tests/mochitest/fetch/file_fetch_controller.html
@@ -88,7 +88,7 @@ function testAbortedFetch() {
var fc = new FetchController();
fc.abort();
- fetch('data:,foo', { signal: fc.signal }).then(() => {
+ fetch('slow.sjs', { signal: fc.signal }).then(() => {
ok(false, "Fetch should not return a resolved promise");
}, e => {
is(e.name, "AbortError", "We have an abort error");
@@ -98,7 +98,7 @@ function testAbortedFetch() {
function testFetchAndAbort() {
var fc = new FetchController();
- var p = fetch('data:,foo', { signal: fc.signal });
+ var p = fetch('slow.sjs', { signal: fc.signal });
fc.abort();
p.then(() => {
@@ -109,49 +109,21 @@ function testFetchAndAbort() {
}
function testWorkerAbortedFetch() {
- function worker() {
- var fc = new FetchController();
- fc.abort();
-
- fetch('data:,foo', { signal: fc.signal }).then(() => {
- postMessage(false);
- }, e => {
- postMessage(e.name == "AbortError");
- });
- }
-
- var str = worker.toString();
- var content = str.substring(0, str.length - 1).split('\n').splice(1).join(' ');
- var url = URL.createObjectURL(new Blob([content], { type: "application/javascript" }));
- var w = new Worker(url);
+ var w = new Worker('worker_fetch_controller.js');
w.onmessage = function(e) {
ok(e.data, "Abort + Fetch works in workers");
next();
}
+ w.postMessage('testWorkerAbortedFetch');
}
function testWorkerFetchAndAbort() {
- function worker() {
- var fc = new FetchController();
-
- var p = fetch('data:,foo', { signal: fc.signal });
- fc.abort();
-
- p.then(() => {
- postMessage(false);
- }, e => {
- postMessage(e.name == "AbortError");
- });
- }
-
- var str = worker.toString();
- var content = str.substring(0, str.length - 1).split('\n').splice(1).join(' ');
- var url = URL.createObjectURL(new Blob([content], { type: "application/javascript" }));
- var w = new Worker(url);
+ var w = new Worker('worker_fetch_controller.js');
w.onmessage = function(e) {
ok(e.data, "Abort + Fetch works in workers");
next();
}
+ w.postMessage('testWorkerFetchAndAbort');
}
var steps = [