summaryrefslogtreecommitdiffstats
path: root/dom/file/tests/test_fileapi_basic_worker.html
blob: 03db1b4cb6ed08ab6c6809c9e599f14055750962 (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
<!DOCTYPE HTML>
<html>
<head>
  <title>Test for FileReader API in workers</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  <script type="text/javascript" src="common_fileReader.js"></script>
</head>

<body>
<script class="testbody" type="text/javascript">

SimpleTest.waitForExplicitFinish();
SimpleTest.requestLongerTimeout(3);

test_setup()
.then(data => {
  let worker = new Worker('worker_fileReader.js');
  worker.postMessage({ tests: 'basic', data });

  worker.onmessage = event => {
    if (event.data.type == 'finish') {
      SimpleTest.finish();
      return;
    }

    if (event.data.type == 'check') {
      ok(event.data.status, event.data.msg);
      return;
    }

    ok(false, "Unknown message.");
  }
});

</script>
</body>
</html>