toolkit/components/passwordmgr/test/formsubmit.sjs

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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 function handleRequest(request, response)
     2 {
     3   try {
     4     reallyHandleRequest(request, response);
     5   } catch (e) {
     6     response.setStatusLine("1.0", 200, "AlmostOK");
     7     response.write("Error handling request: " + e);
     8   }
     9 }
    12 function reallyHandleRequest(request, response) {
    13   var match;
    14   var requestAuth = true;
    16   // XXX I bet this doesn't work for POST requests.
    17   var query = request.queryString;
    19   var user = null, pass = null;
    20   // user=xxx
    21   match = /user=([^&]*)/.exec(query);
    22   if (match)
    23     user = match[1];
    25   // pass=xxx
    26   match = /pass=([^&]*)/.exec(query);
    27   if (match)
    28     pass = match[1];
    30   response.setStatusLine("1.0", 200, "OK");
    32   response.setHeader("Content-Type", "application/xhtml+xml", false);
    33   response.write("<html xmlns='http://www.w3.org/1999/xhtml'>");
    34   response.write("<p>User: <span id='user'>" + user + "</span></p>\n");
    35   response.write("<p>Pass: <span id='pass'>" + pass + "</span></p>\n");
    36   response.write("</html>");
    37 }

mercurial