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

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

Issue 438283002: Sanitize referrer in context menus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change SerializedNavigationEntry::Sanitize and add extra check. Created 6 years, 4 months 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 | Annotate | Revision Log
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 var meta = document.createElement("meta");
22 meta.name = "referrer"; 22 meta.name = "referrer";
23 meta.content = matches[kPolicy]; 23 meta.content = matches[kPolicy];
24 document.head.appendChild(meta); 24 document.head.appendChild(meta);
25 25
26 var destination; 26 var destination;
27 27
28 if (matches[kRedirect] == "false") { 28 if (matches[kRedirect] == "false") {
29 destination = "http://127.0.0.1:" + matches[kPort] + 29 destination = "http://127.0.0.1:" + matches[kPort] +
30 "/files/referrer-policy-log.html"; 30 "/files/referrer-policy-log.html";
31 } else if (matches[kRedirect] == "http") { 31 } else if (matches[kRedirect] == "http") {
32 destination = "http://127.0.0.1:" + matches[kPort] + 32 destination = "http://127.0.0.1:" + matches[kPort] +
33 "/server-redirect?http://127.0.0.1:" + matches[kPort] + 33 "/server-redirect?http://127.0.0.1:" + matches[kPort] +
34 "/files/referrer-policy-log.html"; 34 "/files/referrer-policy-log.html";
35 } else if (matches[kRedirect] == "echoheader") {
36 destination = "http://127.0.0.1:" + matches[kPort] + "/echoheader?Referer";
35 } else { 37 } else {
36 destination = "https://127.0.0.1:" + matches[kSslPort] + 38 destination = "https://127.0.0.1:" + matches[kSslPort] +
37 "/server-redirect?http://127.0.0.1:" + matches[kPort] + 39 "/server-redirect?http://127.0.0.1:" + matches[kPort] +
38 "/files/referrer-policy-log.html"; 40 "/files/referrer-policy-log.html";
39 } 41 }
40 42
41 if (matches[kLink] == "true") { 43 if (matches[kLink] == "true") {
42 var link = document.createElement("a"); 44 var link = document.createElement("a");
43 link.innerText = "link"; 45 link.innerText = "link";
44 link.target = matches[kTarget]; 46 link.target = matches[kTarget];
45 link.href = destination; 47 link.href = destination;
46 document.body.appendChild(link); 48 document.body.appendChild(link);
47 } else { 49 } else {
48 document.location = destination; 50 document.location = destination;
49 } 51 }
50 } 52 }
51 </script> 53 </script>
52 </head> 54 </head>
53 <body onload="run()"> 55 <body onload="run()">
54 </body> 56 </body>
55 </html> 57 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698