1/* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5const CC = Components.Constructor; 6const BinaryInputStream = CC( 7 "@mozilla.org/binaryinputstream;1", 8 "nsIBinaryInputStream", 9 "setInputStream" 10); 11 12function handleRequest(request, response) { 13 var body = "<html>\ 14 <body>\ 15 Outer POST data: "; 16 17 var bodyStream = new BinaryInputStream(request.bodyInputStream); 18 var bytes = [], 19 avail = 0; 20 while ((avail = bodyStream.available()) > 0) { 21 body += String.fromCharCode.apply(String, bodyStream.readByteArray(avail)); 22 } 23 24 body += 25 '<form id="postForm" action="post_form_outer.sjs" method="post">\ 26 <input type="text" name="inputfield" value="outer">\ 27 <input type="submit">\ 28 </form>\ 29 \ 30 <iframe id="innerFrame" src="post_form_inner.sjs" width="400" height="200">\ 31 \ 32 </body>\ 33 </html>'; 34 35 response.bodyOutputStream.write(body, body.length); 36} 37