toolkit/devtools/webconsole/test/network_requests_iframe.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3   <head>
     4     <meta charset="utf-8">
     5     <title>Console HTTP test page</title>
     6     <!-- Any copyright is dedicated to the Public Domain.
     7        - http://creativecommons.org/publicdomain/zero/1.0/ -->
     8     <script type="text/javascript"><!--
     9       var setAllowAllCookies = false;
    11       function makeXhr(aMethod, aUrl, aRequestBody, aCallback) {
    12         // On the first call, allow all cookies and set cookies, then resume the actual test
    13         if(!setAllowAllCookies)
    14           SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 0]]}, function () {
    15             setAllowAllCookies = true;
    16             setCookies();
    17             makeXhrCallback(aMethod, aUrl, aRequestBody, aCallback);
    18           });
    19         else
    20           makeXhrCallback(aMethod, aUrl, aRequestBody, aCallback);
    21       }
    23       function makeXhrCallback(aMethod, aUrl, aRequestBody, aCallback) {
    24         var xmlhttp = new XMLHttpRequest();
    25         xmlhttp.open(aMethod, aUrl, true);
    26         if (aCallback) {
    27           xmlhttp.onreadystatechange = function() {
    28             if (xmlhttp.readyState == 4) {
    29               aCallback();
    30             }
    31           };
    32         }
    33         xmlhttp.send(aRequestBody);
    34       }
    36       function testXhrGet(aCallback) {
    37         makeXhr('get', 'data.json', null, aCallback);
    38       }
    40       function testXhrPost(aCallback) {
    41         var body = "Hello world! " + (new Array(50)).join("foobaz barr");
    42         makeXhr('post', 'data.json', body, aCallback);
    43       }
    45       function setCookies() {
    46         document.cookie = "foobar=fooval";
    47         document.cookie = "omgfoo=bug768096";
    48         document.cookie = "badcookie=bug826798=st3fan";
    49       }
    50     // --></script>
    51   </head>
    52   <body>
    53     <h1>Web Console HTTP Logging Testpage</h1>
    54     <h2>This page is used to test the HTTP logging.</h2>
    56     <form action="?" method="post">
    57       <input name="name" type="text" value="foo bar"><br>
    58       <input name="age" type="text" value="144"><br>
    59     </form>
    60   </body>
    61 </html>

mercurial