summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/fetch/file_fetch_controller.html
blob: 6efa2fe0acf035f1815a56f60e821073cb93859f (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
34
35
36
37
38
39
40
<script>
function ok(a, msg) {
  parent.postMessage({ type: "check", status: !!a, message: msg }, "*");
}

function is(a, b, msg) {
  ok(a === b, msg);
}

function testWebIDL() {
  ok("FetchController" in self, "We have a FetchController prototype");
  ok("FetchSignal" in self, "We have a FetchSignal prototype");

  var fc = new FetchController();
  ok(!!fc, "FetchController can be created");
  ok(fc instanceof FetchController, "FetchController is a FetchController");

  ok(!!fc.signal, "FetchController has a signal");
  ok(fc.signal instanceof FetchSignal, "fetchSignal is a FetchSignal");
  is(fc.signal.aborted, false, "By default FetchSignal.aborted is false");
  next();
}

var steps = [
  testWebIDL,
];

function next() {
  if (!steps.length) {
    parent.postMessage({ type: "finish" }, "*");
    return;
  }

  var step = steps.shift();
  step();
}

next();

</script>