1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/test/mochitest/post.sjs Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,17 @@ 1.4 +const CC = Components.Constructor; 1.5 +const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1", 1.6 + "nsIBinaryInputStream", 1.7 + "setInputStream"); 1.8 + 1.9 +function handleRequest(request, response) 1.10 +{ 1.11 + var body = ""; 1.12 + var bodyStream = new BinaryInputStream(request.bodyInputStream); 1.13 + var bytes = [], avail = 0; 1.14 + while ((avail = bodyStream.available()) > 0) 1.15 + body += String.fromCharCode.apply(String, bodyStream.readByteArray(avail)); 1.16 + 1.17 + response.setHeader("Content-Type", "text/html", false); 1.18 + response.write(body); 1.19 +} 1.20 +