Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
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>