Removed 'anonymous' from namespace, added whitespace in thread_restrictions.cc
[chromium-blink-merge.git] / content / test / data / click-noreferrer-links.html
blob2a0f38ae799ecc87a74a87c9e5e884ba59ba410d
1 <html>
3 <head><title>Click noreferrer links</title>
4 <script>
5 function simulateClick(target) {
6 var evt = document.createEvent("MouseEvents");
7 evt.initMouseEvent("click", true, true, window,
8 0, 0, 0, 0, 0, false, false,
9 false, false, 0, null);
11 return target.dispatchEvent(evt);
14 function clickNoRefTargetBlankLink() {
15 return simulateClick(document.getElementById("noref_and_tblank_link"));
18 function clickSameSiteNoRefTargetedLink() {
19 return simulateClick(
20 document.getElementById("samesite_noref_and_targeted_link"));
23 function clickSameSiteTargetedLink() {
24 return simulateClick(document.getElementById("samesite_targeted_link"));
27 function clickSameSiteTargetBlankLink() {
28 return simulateClick(document.getElementById("samesite_tblank_link"));
31 function clickTargetBlankLink() {
32 return simulateClick(document.getElementById("tblank_link"));
35 function clickNoRefLink() {
36 return simulateClick(document.getElementById("noref_link"));
39 function clickBlankTargetedLink() {
40 return simulateClick(document.getElementById("blank_targeted_link"));
43 function testScriptAccessToWindow() {
44 // Grab a reference to the existing foo window and access its location.
45 try {
46 var w = window.open("", "foo");
47 var url = w.location.href;
48 return url != undefined;
49 } catch (e) {
50 return false;
54 function testCloseWindow() {
55 // Grab a reference to the existing foo window and close it.
56 var w = window.open("", "foo");
57 w.close();
58 return true;
61 // Listen to incoming messages and reply to them.
62 var receivedMessages = 0;
63 window.addEventListener("message", messageReceived, false);
64 function messageReceived(event) {
65 receivedMessages++;
66 event.source.postMessage(event.data, "*");
69 // Send a message which contains a message port.
70 var mc;
71 function postWithPortToFoo() {
72 mc = new MessageChannel();
73 mc.port1.onmessage = portMessageReceived;
74 mc.port1.start();
75 var w = window.open("", "foo");
76 w.postMessage({message: "msg-with-port", port: mc.port2}, "*", [mc.port2]);
77 return true;
80 var receivedMessagesViaPort = 0;
81 function portMessageReceived(event) {
82 receivedMessagesViaPort++;
83 // Change the title to generate a notification.
84 document.title = event.data;
86 </script>
87 </head>
89 <a href="http://REPLACE_WITH_HOST_AND_PORT/files/title2.html"
90 id="noref_and_tblank_link" rel="noreferrer" target="_blank">
91 rel=noreferrer and target=_blank</a><br>
92 <a href="title2.html" id="samesite_noref_and_targeted_link"
93 rel="noreferrer" target="foo">
94 same-site rel=noreferrer and target=foo</a><br>
95 <a href="navigate_opener.html" id="samesite_targeted_link" target="foo">
96 same-site target=foo</a><br>
97 <a href="title2.html" id="samesite_tblank_link" target="_blank">
98 same-site target=_blank</a><br>
99 <a href="http://REPLACE_WITH_HOST_AND_PORT/files/title2.html" id="tblank_link"
100 target="_blank">target=_blank</a><br>
101 <a href="http://REPLACE_WITH_HOST_AND_PORT/files/title2.html" id="noref_link"
102 rel="noreferrer">rel=noreferrer</a><br>
103 <a href="about:blank" id="blank_targeted_link" target="foo">
104 blank_targeted_link=foo</a><br>
106 <iframe id="frame1" src="frame_tree/1-1.html"></iframe>
108 </html>