Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 | 2 |
| 3 <head><title>Click noreferrer links</title> | 3 <head><title>Click noreferrer links</title> |
| 4 <script> | 4 <script> |
| 5 function setBaseURL(baseUrl) { | |
|
Charlie Reis
2015/10/01 17:43:46
I'm torn on this name. It sounds like it's about
nasko
2015/10/01 18:10:18
Done.
| |
| 6 var links = ['noref_and_tblank_link', 'tblank_link', 'noref_link']; | |
| 7 links.forEach(function(linkId) { | |
| 8 link = document.getElementById(linkId); | |
| 9 link.href = baseUrl + link.pathname.substr(1); | |
| 10 }); | |
| 11 } | |
| 5 function simulateClick(target) { | 12 function simulateClick(target) { |
| 6 var evt = document.createEvent("MouseEvents"); | 13 var evt = document.createEvent("MouseEvents"); |
| 7 evt.initMouseEvent("click", true, true, window, | 14 evt.initMouseEvent("click", true, true, window, |
| 8 0, 0, 0, 0, 0, false, false, | 15 0, 0, 0, 0, 0, false, false, |
| 9 false, false, 0, null); | 16 false, false, 0, null); |
| 10 | 17 |
| 11 return target.dispatchEvent(evt); | 18 return target.dispatchEvent(evt); |
| 12 } | 19 } |
| 13 | 20 |
| 14 function clickNoRefTargetBlankLink() { | 21 function clickNoRefTargetBlankLink() { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 // Grab a reference to the existing foo window into a global variable | 96 // Grab a reference to the existing foo window into a global variable |
| 90 // for later testing. | 97 // for later testing. |
| 91 last_opened_window = window.open("", "foo"); | 98 last_opened_window = window.open("", "foo"); |
| 92 } | 99 } |
| 93 function getLastOpenedWindowLocation() { | 100 function getLastOpenedWindowLocation() { |
| 94 return last_opened_window.location.href; | 101 return last_opened_window.location.href; |
| 95 } | 102 } |
| 96 </script> | 103 </script> |
| 97 </head> | 104 </head> |
| 98 | 105 |
| 99 <a href="http://REPLACE_WITH_HOST_AND_PORT/files/title2.html" | 106 <a href="http://REPLACE_WITH_HOST_AND_PORT/title2.html" |
| 100 id="noref_and_tblank_link" rel="noreferrer" target="_blank"> | 107 id="noref_and_tblank_link" rel="noreferrer" target="_blank"> |
| 101 rel=noreferrer and target=_blank</a><br> | 108 rel=noreferrer and target=_blank</a><br> |
| 102 <a href="title2.html" id="samesite_noref_and_targeted_link" | 109 <a href="title2.html" id="samesite_noref_and_targeted_link" |
| 103 rel="noreferrer" target="foo"> | 110 rel="noreferrer" target="foo"> |
| 104 same-site rel=noreferrer and target=foo</a><br> | 111 same-site rel=noreferrer and target=foo</a><br> |
| 105 <a href="navigate_opener.html" id="samesite_targeted_link" target="foo"> | 112 <a href="navigate_opener.html" id="samesite_targeted_link" target="foo"> |
| 106 same-site target=foo</a><br> | 113 same-site target=foo</a><br> |
| 107 <a href="title2.html" id="samesite_tblank_link" target="_blank"> | 114 <a href="title2.html" id="samesite_tblank_link" target="_blank"> |
| 108 same-site target=_blank</a><br> | 115 same-site target=_blank</a><br> |
| 109 <a href="http://REPLACE_WITH_HOST_AND_PORT/files/title2.html" id="tblank_link" | 116 <a href="http://REPLACE_WITH_HOST_AND_PORT/title2.html" id="tblank_link" |
| 110 target="_blank">target=_blank</a><br> | 117 target="_blank">target=_blank</a><br> |
| 111 <a href="http://REPLACE_WITH_HOST_AND_PORT/files/title2.html" id="noref_link" | 118 <a href="http://REPLACE_WITH_HOST_AND_PORT/title2.html" id="noref_link" |
|
Charlie Reis
2015/10/01 17:43:46
Why keep the REPLACE_WITH_HOST_AND_PORT part if we
nasko
2015/10/01 18:10:18
It helps visually see which links are expected to
| |
| 112 rel="noreferrer">rel=noreferrer</a><br> | 119 rel="noreferrer">rel=noreferrer</a><br> |
| 113 <a href="about:blank" id="blank_targeted_link" target="foo"> | 120 <a href="about:blank" id="blank_targeted_link" target="foo"> |
| 114 blank_targeted_link=foo</a><br> | 121 blank_targeted_link=foo</a><br> |
| 115 | 122 |
| 116 <iframe id="frame1" src="frame_tree/1-1.html"></iframe> | 123 <iframe id="frame1" src="frame_tree/1-1.html"></iframe> |
| 117 | 124 |
| 118 </html> | 125 </html> |
| OLD | NEW |