summaryrefslogtreecommitdiffstats
path: root/dom/xhr/tests/file_XHRResponseURL.sjs
blob: 5ac0a346c72635eee3f7aca4704387e77731ecff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function handleRequest(aRequest, aResponse)
{
  var url = aRequest.queryString.match(/\burl=([^#&]*)/);
  if (!url) {
    aResponse.setStatusLine(aRequest.httpVersion, 404, "Not Found");
    return;
  }
  url = decodeURIComponent(url[1]);

  aResponse.setStatusLine(aRequest.httpVersion, 302, "Found");
  aResponse.setHeader("Access-Control-Allow-Origin", "*", false);
  aResponse.setHeader("Cache-Control", "no-cache", false);
  aResponse.setHeader("Location", url, false);
}