summaryrefslogtreecommitdiffstats
path: root/dom/security/test/csp/file_CSP.sjs
blob: 85c2df3ba474186522e465d6fdf24dc94f5a0adb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SJS file for CSP mochitests

function handleRequest(request, response)
{
  var query = {};
  request.queryString.split('&').forEach(function (val) {
    var [name, value] = val.split('=');
    query[name] = unescape(value);
  });

  var isPreflight = request.method == "OPTIONS";


  //avoid confusing cache behaviors
  response.setHeader("Cache-Control", "no-cache", false);

  if ("type" in query) {
    response.setHeader("Content-Type", unescape(query['type']), false);
  } else {
    response.setHeader("Content-Type", "text/html", false);
  }

  if ("content" in query) {
    response.write(unescape(query['content']));
  }
}