toolkit/webapps/tests/app.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 getQuery(request) {
     2   let query = {};
     4   request.queryString.split('&').forEach(function(val) {
     5     let [name, value] = val.split('=');
     6     query[name] = unescape(value);
     7   });
     9   return query;
    10 }
    12 function handleRequest(request, response) {
    13   response.setHeader("Cache-Control", "no-cache", false);
    15   let query = getQuery(request);
    17   if ("appreq" in query) {
    18     response.setHeader("Content-Type", "text/plain", false);
    19     response.write("Hello world!");
    21     setState("appreq", "done");
    23     return;
    24   }
    26   if ("testreq" in query) {
    27     response.setHeader("Content-Type", "text/plain", false);
    29     response.write(getState("appreq"));
    31     return;
    32   }
    33 }

mercurial