summaryrefslogtreecommitdiffstats
path: root/toolkit/components/antitracking/test/browser/server.sjs
blob: 6368c47640f1301c81648a043889c43714ce1cad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function handleRequest(aRequest, aResponse) {
 if (aRequest.queryString.includes("redirect")) {
   aResponse.setStatusLine(aRequest.httpVersion, 302);
   if (aRequest.queryString.includes("redirect-checkonly")) {
     aResponse.setHeader("Location", "server.sjs?checkonly");
   } else {
     aResponse.setHeader("Location", "server.sjs");
   }
   return;
 }
 aResponse.setStatusLine(aRequest.httpVersion, 200);
 if (aRequest.hasHeader('Cookie')) {
   aResponse.write("cookie-present");
 } else {
   if (!aRequest.queryString.includes("checkonly")) {
     aResponse.setHeader("Set-Cookie", "foopy=1");
   }
   aResponse.write("cookie-not-present");
 }
}