summaryrefslogtreecommitdiffstats
path: root/dom/file/ipc/tests/test_ipcBlob_mixedMultiplex.html
blob: c8e046fa8838db903dd9a2cd092cd82a6ae4f8a8 (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
41
<!DOCTYPE HTML>
<html>
<head>
  <title>Test an empty IPCBlob together with other parts</title>
  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script type="text/javascript">

let url = SimpleTest.getTestFileURL("script_file.js");
let data = new Array(1024*1024).join('A');

let script = SpecialPowers.loadChromeScript(url);
script.addMessageListener("file.opened", message => {
  let blob = new Blob([data]);

  let form = new FormData();
  form.append("blob1", blob);
  form.append("blob2", message.file);
  form.append("blob3", blob);

  fetch("ok.sjs", {
    method: "POST",
    body: form,
  })
  .then(r => r.text())
  .then(r => {
    ok(parseInt(r, 10) > (data.length * 2), "We have data");
  })
  . then(SimpleTest.finish);
});

script.sendAsyncMessage("file.open");
SimpleTest.waitForExplicitFinish();

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