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 setOriginForLinks(baseUrl) { |
| 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" | |
100 id="noref_and_tblank_link" rel="noreferrer" target="_blank"> | |
101 rel=noreferrer and target=_blank</a><br> | |
102 <a href="title2.html" id="samesite_noref_and_targeted_link" | 106 <a href="title2.html" id="samesite_noref_and_targeted_link" |
103 rel="noreferrer" target="foo"> | 107 rel="noreferrer" target="foo"> |
104 same-site rel=noreferrer and target=foo</a><br> | 108 same-site rel=noreferrer and target=foo</a><br> |
105 <a href="navigate_opener.html" id="samesite_targeted_link" target="foo"> | 109 <a href="navigate_opener.html" id="samesite_targeted_link" target="foo"> |
106 same-site target=foo</a><br> | 110 same-site target=foo</a><br> |
107 <a href="title2.html" id="samesite_tblank_link" target="_blank"> | 111 <a href="title2.html" id="samesite_tblank_link" target="_blank"> |
108 same-site target=_blank</a><br> | 112 same-site target=_blank</a><br> |
109 <a href="http://REPLACE_WITH_HOST_AND_PORT/files/title2.html" id="tblank_link" | |
110 target="_blank">target=_blank</a><br> | |
111 <a href="http://REPLACE_WITH_HOST_AND_PORT/files/title2.html" id="noref_link" | |
112 rel="noreferrer">rel=noreferrer</a><br> | |
113 <a href="about:blank" id="blank_targeted_link" target="foo"> | 113 <a href="about:blank" id="blank_targeted_link" target="foo"> |
114 blank_targeted_link=foo</a><br> | 114 blank_targeted_link=foo</a><br> |
115 | 115 |
| 116 <!-- The following set of links have to be fixed at runtime with the proper |
| 117 scheme://host:port/ string, since the port is randomly generated. The |
| 118 setOriginForLinks method is provided for facilitating the replacement and |
| 119 should be called by each browser test utilizing these links. --> |
| 120 <a href="http://REPLACE/title2.html" |
| 121 id="noref_and_tblank_link" rel="noreferrer" target="_blank"> |
| 122 rel=noreferrer and target=_blank</a><br> |
| 123 <a href="http://REPLACE/title2.html" id="tblank_link" |
| 124 target="_blank">target=_blank</a><br> |
| 125 <a href="http://REPLACE/title2.html" id="noref_link" |
| 126 rel="noreferrer">rel=noreferrer</a><br> |
| 127 |
| 128 |
116 <iframe id="frame1" src="frame_tree/1-1.html"></iframe> | 129 <iframe id="frame1" src="frame_tree/1-1.html"></iframe> |
117 | 130 |
118 </html> | 131 </html> |
OLD | NEW |