Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(456)

Side by Side Diff: chrome/test/data/referrer_policy/referrer-policy-start.html

Issue 714813003: Referrer Policy: Add new policies to URLRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script> 4 <script>
5 function run() { 5 function run() {
6 var kPolicy = 1; 6 var kPolicy = 1;
7 var kPort = 2; 7 var kPort = 2;
8 var kSslPort = 3; 8 var kSslPort = 3;
9 var kRedirect = 4; 9 var kRedirect = 4;
10 var kLink = 5; 10 var kLink = 5;
11 var kTarget = 6; 11 var kTarget = 6;
12 var re = new RegExp("policy=(.*)&port=(.*)&ssl_port=(.*)&redirect=(.*)&" + 12 var re = new RegExp("policy=(.*)&port=(.*)&ssl_port=(.*)&redirect=(.*)&" +
13 "link=(.*)&target=(.*)"); 13 "link=(.*)&target=(.*)");
14 var matches = re.exec(document.location.search); 14 var matches = re.exec(document.location.search);
15 15
16 if (matches == null) { 16 if (matches == null) {
17 document.body.innerText = "Could not parse parameters!"; 17 document.body.innerText = "Could not parse parameters!";
18 return; 18 return;
19 } 19 }
20 20
21 var meta = document.createElement("meta"); 21 if (matches[kPolicy] != "no-meta") {
22 meta.name = "referrer"; 22 var meta = document.createElement("meta");
23 meta.content = matches[kPolicy]; 23 meta.name = "referrer";
24 document.head.appendChild(meta); 24 meta.content = matches[kPolicy];
25 document.head.appendChild(meta);
26 }
25 27
26 var destination; 28 var destination;
27 29
28 if (matches[kRedirect] == "false") { 30 if (matches[kRedirect] == "none") {
29 destination = "http://127.0.0.1:" + matches[kPort] + 31 destination = "http://127.0.0.1:" + matches[kPort] +
30 "/files/referrer-policy-log.html"; 32 "/files/referrer-policy-log.html";
31 } else if (matches[kRedirect] == "http") { 33 } else if (matches[kRedirect] == "http2http") {
32 destination = "http://127.0.0.1:" + matches[kPort] + 34 destination = "http://127.0.0.1:" + matches[kPort] +
33 "/server-redirect?http://127.0.0.1:" + matches[kPort] + 35 "/server-redirect?http://127.0.0.1:" + matches[kPort] +
34 "/files/referrer-policy-log.html"; 36 "/files/referrer-policy-log.html";
37 } else if (matches[kRedirect] == "http2https") {
38 destination = "http://127.0.0.1:" + matches[kPort] +
39 "/server-redirect?https://127.0.0.1:" + matches[kSslPort] +
40 "/files/referrer-policy-log.html";
41 } else if (matches[kRedirect] == "https2http") {
42 destination = "https://127.0.0.1:" + matches[kSslPort] +
43 "/server-redirect?http://127.0.0.1:" + matches[kPort] +
44 "/files/referrer-policy-log.html";
35 } else if (matches[kRedirect] == "echoheader") { 45 } else if (matches[kRedirect] == "echoheader") {
36 destination = "http://127.0.0.1:" + matches[kPort] + "/echoheader?Referer"; 46 destination = "http://127.0.0.1:" + matches[kPort] + "/echoheader?Referer";
37 } else {
38 destination = "https://127.0.0.1:" + matches[kSslPort] +
39 "/server-redirect?http://127.0.0.1:" + matches[kPort] +
40 "/files/referrer-policy-log.html";
41 } 47 }
42 48
43 if (matches[kLink] == "true") { 49 if (matches[kLink] == "true") {
44 var link = document.createElement("a"); 50 var link = document.createElement("a");
45 link.innerText = "link"; 51 link.innerText = "link";
46 link.target = matches[kTarget]; 52 link.target = matches[kTarget];
47 link.href = destination; 53 link.href = destination;
48 document.body.appendChild(link); 54 document.body.appendChild(link);
49 } else { 55 } else {
50 document.location = destination; 56 document.location = destination;
51 } 57 }
52 } 58 }
53 </script> 59 </script>
54 </head> 60 </head>
55 <body onload="run()"> 61 <body onload="run()">
56 </body> 62 </body>
57 </html> 63 </html>
OLDNEW
« no previous file with comments | « chrome/browser/referrer_policy_browsertest.cc ('k') | content/browser/loader/resource_dispatcher_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698