summaryrefslogtreecommitdiffstats
path: root/dom/workers/test/fileSubWorker_worker.js
blob: 8a5c002865d08d44b973107d85acaae41ff5823c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
 * Expects a file. Returns an object containing the size, type, name and path
 * using another worker. Used to test posting of file from worker to worker.
 */
onmessage = function (event) {
  var worker = new Worker("file_worker.js");

  worker.postMessage(event.data);

  worker.onmessage = function (msg) {
    postMessage(msg.data);
  };

  worker.onerror = function (error) {
    postMessage(undefined);
  };
};