10 var re
= new RegExp("policy=(.*)&redirect=(.*)&link=(.*)&target=(.*)");
11 var matches
= re
.exec(document
.location
.search
);
13 if (matches
== null) {
14 document
.body
.innerText
= "Could not parse parameters!";
18 if (matches
[kPolicy
] != "no-meta") {
19 var meta
= document
.createElement("meta");
20 meta
.name
= "referrer";
21 meta
.content
= matches
[kPolicy
];
22 document
.head
.appendChild(meta
);
28 if (matches
[kRedirect
] == "none") {
29 destination
= "http://mock.http/referrer_policy/referrer-policy-log.html";
30 } else if (redirectMatches
= /^(https?)2(https?)$/.exec(matches
[kRedirect
])) {
33 "://mock.http/referrer_policy/redirect-to-" +
34 redirectMatches
[2] + "-log";
36 destination
= matches
[kRedirect
];
39 if (matches
[kLink
] == "true") {
40 var link
= document
.createElement("a");
41 link
.innerText
= "link";
42 link
.target
= matches
[kTarget
];
43 link
.href
= destination
;
44 document
.body
.appendChild(link
);
46 document
.location
= destination
;