toolkit/content/tests/browser/data/post_form_outer.sjs

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/content/tests/browser/data/post_form_outer.sjs	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +const CC = Components.Constructor;
     1.9 +const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
    1.10 +                             "nsIBinaryInputStream",
    1.11 +                             "setInputStream");
    1.12 +
    1.13 +function handleRequest(request, response)
    1.14 +{
    1.15 +  var body =
    1.16 +   '<html>\
    1.17 +    <body>\
    1.18 +    Outer POST data: ';
    1.19 +
    1.20 +  var bodyStream = new BinaryInputStream(request.bodyInputStream);
    1.21 +  var bytes = [], avail = 0;
    1.22 +  while ((avail = bodyStream.available()) > 0)
    1.23 +   body += String.fromCharCode.apply(String, bodyStream.readByteArray(avail));
    1.24 +
    1.25 +  body +=
    1.26 +    '<form id="postForm" action="post_form_outer.sjs" method="post">\
    1.27 +     <input type="text" name="inputfield" value="outer">\
    1.28 +     <input type="submit">\
    1.29 +     </form>\
    1.30 +     \
    1.31 +     <iframe id="innerFrame" src="post_form_inner.sjs" width="400" height="200">\
    1.32 +     \
    1.33 +     </body>\
    1.34 +     </html>';
    1.35 +
    1.36 +  response.bodyOutputStream.write(body, body.length);
    1.37 +}

mercurial