| 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) { | 5 function setOriginForLinks(baseUrl) { |
| 6 var links = ['noref_and_tblank_link', 'tblank_link', 'noref_link']; | 6 var links = ['noref_and_tblank_link', 'tblank_link', 'noref_link']; |
| 7 links.forEach(function(linkId) { | 7 links.forEach(function(linkId) { |
| 8 link = document.getElementById(linkId); | 8 link = document.getElementById(linkId); |
| 9 link.href = baseUrl + link.pathname.substr(1); | 9 link.href = baseUrl + link.pathname.substr(1); |
| 10 }); | 10 }); |
| 11 } | 11 } |
| 12 function simulateClick(target) { | 12 function simulateClick(target) { |
| 13 var evt = document.createEvent("MouseEvents"); | 13 var evt = document.createEvent("MouseEvents"); |
| 14 evt.initMouseEvent("click", true, true, window, | 14 evt.initMouseEvent("click", true, true, window, |
| 15 0, 0, 0, 0, 0, false, false, | 15 0, 0, 0, 0, 0, false, false, |
| 16 false, false, 0, null); | 16 false, false, 0, null); |
| 17 | 17 |
| 18 return target.dispatchEvent(evt); | 18 return target.dispatchEvent(evt); |
| 19 } | 19 } |
| 20 | 20 |
| 21 function clickNoRefTargetBlankLink() { | 21 function clickNoRefTargetBlankLink() { |
| 22 return simulateClick(document.getElementById("noref_and_tblank_link")); | 22 return simulateClick(document.getElementById("noref_and_tblank_link")); |
| 23 } | 23 } |
| 24 | 24 |
| 25 function clickNoOpenerTargetBlankLink() { |
| 26 return simulateClick(document.getElementById("noopener_and_tblank_link")); |
| 27 } |
| 28 |
| 25 function clickSameSiteNoRefTargetedLink() { | 29 function clickSameSiteNoRefTargetedLink() { |
| 26 return simulateClick( | 30 return simulateClick( |
| 27 document.getElementById("samesite_noref_and_targeted_link")); | 31 document.getElementById("samesite_noref_and_targeted_link")); |
| 28 } | 32 } |
| 29 | 33 |
| 34 function clickSameSiteNoOpenerTargetedLink() { |
| 35 return simulateClick( |
| 36 document.getElementById("samesite_noopener_and_targeted_link")); |
| 37 } |
| 38 |
| 30 function clickSameSiteTargetedLink() { | 39 function clickSameSiteTargetedLink() { |
| 31 return simulateClick(document.getElementById("samesite_targeted_link")); | 40 return simulateClick(document.getElementById("samesite_targeted_link")); |
| 32 } | 41 } |
| 33 | 42 |
| 34 function clickSameSiteTargetBlankLink() { | 43 function clickSameSiteTargetBlankLink() { |
| 35 return simulateClick(document.getElementById("samesite_tblank_link")); | 44 return simulateClick(document.getElementById("samesite_tblank_link")); |
| 36 } | 45 } |
| 37 | 46 |
| 38 function clickTargetBlankLink() { | 47 function clickTargetBlankLink() { |
| 39 return simulateClick(document.getElementById("tblank_link")); | 48 return simulateClick(document.getElementById("tblank_link")); |
| 40 } | 49 } |
| 41 | 50 |
| 42 function clickNoRefLink() { | 51 function clickNoRefLink() { |
| 43 return simulateClick(document.getElementById("noref_link")); | 52 return simulateClick(document.getElementById("noref_link")); |
| 44 } | 53 } |
| 45 | 54 |
| 55 function clickNoOpenerLink() { |
| 56 return simulateClick(document.getElementById("noopener_link")); |
| 57 } |
| 58 |
| 46 function clickBlankTargetedLink() { | 59 function clickBlankTargetedLink() { |
| 47 return simulateClick(document.getElementById("blank_targeted_link")); | 60 return simulateClick(document.getElementById("blank_targeted_link")); |
| 48 } | 61 } |
| 49 | 62 |
| 50 function testScriptAccessToWindow() { | 63 function testScriptAccessToWindow() { |
| 51 // Grab a reference to the existing foo window and access its location. | 64 // Grab a reference to the existing foo window and access its location. |
| 52 try { | 65 try { |
| 53 var w = window.open("", "foo"); | 66 var w = window.open("", "foo"); |
| 54 var url = w.location.href; | 67 var url = w.location.href; |
| 55 return url != undefined; | 68 return url != undefined; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 112 } |
| 100 function getLastOpenedWindowLocation() { | 113 function getLastOpenedWindowLocation() { |
| 101 return last_opened_window.location.href; | 114 return last_opened_window.location.href; |
| 102 } | 115 } |
| 103 </script> | 116 </script> |
| 104 </head> | 117 </head> |
| 105 | 118 |
| 106 <a href="title2.html" id="samesite_noref_and_targeted_link" | 119 <a href="title2.html" id="samesite_noref_and_targeted_link" |
| 107 rel="noreferrer" target="foo"> | 120 rel="noreferrer" target="foo"> |
| 108 same-site rel=noreferrer and target=foo</a><br> | 121 same-site rel=noreferrer and target=foo</a><br> |
| 122 <a href="title2.html" id="samesite_noopener_and_targeted_link" |
| 123 rel="noopener" target="foo"> |
| 124 same-site rel=noopener and target=foo</a><br> |
| 109 <a href="navigate_opener.html" id="samesite_targeted_link" target="foo"> | 125 <a href="navigate_opener.html" id="samesite_targeted_link" target="foo"> |
| 110 same-site target=foo</a><br> | 126 same-site target=foo</a><br> |
| 111 <a href="title2.html" id="samesite_tblank_link" target="_blank"> | 127 <a href="title2.html" id="samesite_tblank_link" target="_blank"> |
| 112 same-site target=_blank</a><br> | 128 same-site target=_blank</a><br> |
| 113 <a href="about:blank" id="blank_targeted_link" target="foo"> | 129 <a href="about:blank" id="blank_targeted_link" target="foo"> |
| 114 blank_targeted_link=foo</a><br> | 130 blank_targeted_link=foo</a><br> |
| 115 | 131 |
| 116 <!-- The following set of links have to be fixed at runtime with the proper | 132 <!-- 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 | 133 scheme://host:port/ string, since the port is randomly generated. The |
| 118 setOriginForLinks method is provided for facilitating the replacement and | 134 setOriginForLinks method is provided for facilitating the replacement and |
| 119 should be called by each browser test utilizing these links. --> | 135 should be called by each browser test utilizing these links. --> |
| 120 <a href="http://REPLACE/title2.html" | 136 <a href="http://REPLACE/title2.html" |
| 121 id="noref_and_tblank_link" rel="noreferrer" target="_blank"> | 137 id="noref_and_tblank_link" rel="noreferrer" target="_blank"> |
| 122 rel=noreferrer and target=_blank</a><br> | 138 rel=noreferrer and target=_blank</a><br> |
| 139 <a href="http://REPLACE/title2.html" |
| 140 id="noopener_and_tblank_link" rel="noopener" target="_blank"> |
| 141 rel=noopener and target=_blank</a><br> |
| 123 <a href="http://REPLACE/title2.html" id="tblank_link" | 142 <a href="http://REPLACE/title2.html" id="tblank_link" |
| 124 target="_blank">target=_blank</a><br> | 143 target="_blank">target=_blank</a><br> |
| 125 <a href="http://REPLACE/title2.html" id="noref_link" | 144 <a href="http://REPLACE/title2.html" id="noref_link" |
| 126 rel="noreferrer">rel=noreferrer</a><br> | 145 rel="noreferrer">rel=noreferrer</a><br> |
| 146 <a href="http://REPLACE/title2.html" id="noopener_link" |
| 147 rel="noopener">rel=opener</a><br> |
| 127 | 148 |
| 128 | 149 |
| 129 <iframe id="frame1" src="frame_tree/1-1.html"></iframe> | 150 <iframe id="frame1" src="frame_tree/1-1.html"></iframe> |
| 130 | 151 |
| 131 </html> | 152 </html> |
| OLD | NEW |