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.

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

mercurial