Bug 1867190 - Initialise the PHC allocate delay later r=glandium
[gecko.git] / dom / ipc / tests / blob_verify.sjs
blobc979192bf059ee0ca5efb11104e26a4c6bd112de
1 const CC = Components.Constructor;
2 const BinaryInputStream = CC(
3   "@mozilla.org/binaryinputstream;1",
4   "nsIBinaryInputStream",
5   "setInputStream"
6 );
7 const BinaryOutputStream = CC(
8   "@mozilla.org/binaryoutputstream;1",
9   "nsIBinaryOutputStream",
10   "setOutputStream"
13 function handleRequest(request, response) {
14   var bodyStream = new BinaryInputStream(request.bodyInputStream);
15   var bodyBytes = [];
16   let bodyAvail;
17   while ((bodyAvail = bodyStream.available()) > 0) {
18     Array.prototype.push.apply(bodyBytes, bodyStream.readByteArray(bodyAvail));
19   }
21   var bos = new BinaryOutputStream(response.bodyOutputStream);
23   response.processAsync();
24   bos.writeByteArray(bodyBytes);
25   response.finish();