blob: e079656759b54cc4f1fd5db4787b3e180b667974 (
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
27
28
29
30
31
32
33
34
35
36
37
|
/**
* Renders a link with the provided referrer policy.
* Used in browser_referrer_*.js, bug 1113431.
* Arguments: ?scheme=http://&policy=origin&rel=noreferrer
*/
function handleRequest(request, response)
{
Components.utils.importGlobalProperties(["URLSearchParams"]);
let query = new URLSearchParams(request.queryString);
let scheme = query.get("scheme");
let policy = query.get("policy");
let rel = query.get("rel");
let linkUrl = scheme +
"test1.example.com/browser/browser/base/content/test/referrer/" +
"file_referrer_testserver.sjs";
let metaReferrerTag =
policy ? `<meta name='referrer' content='${policy}'>` : "";
let html = `<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'>
${metaReferrerTag}
<title>Test referrer</title>
</head>
<body>
<a id='testlink' href='${linkUrl}' ${rel ? ` rel='${rel}'` : ""}>
referrer test link</a>
</body>
</html>`;
response.setHeader("Cache-Control", "no-cache", false);
response.setHeader("Content-Type", "text/html", false);
response.write(html);
}
|