|
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; |
|
10 |
|
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 } |
|
22 |
|
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 } |
|
35 |
|
36 function testXhrGet(aCallback) { |
|
37 makeXhr('get', 'data.json', null, aCallback); |
|
38 } |
|
39 |
|
40 function testXhrPost(aCallback) { |
|
41 var body = "Hello world! " + (new Array(50)).join("foobaz barr"); |
|
42 makeXhr('post', 'data.json', body, aCallback); |
|
43 } |
|
44 |
|
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> |
|
55 |
|
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> |