activation-behavior.window.js (1625B)
1 ["a", 2 "area"].forEach(type => { 3 4 const followed = type === "a" ? true : false; 5 async_test(t => { 6 const target = document.createElement("iframe"), 7 link = document.createElement(type); 8 t.add_cleanup(() => target.remove()); 9 target.name = "certifiedrandom" + type; 10 link.target = "certifiedrandom" + type; 11 link.href = "/"; 12 document.body.appendChild(target); 13 target.onload = t.step_func(() => { 14 if(target.contentWindow.location.href === "about:blank") 15 return; 16 if(followed) { 17 assert_equals(target.contentWindow.location.pathname, "/"); 18 t.done(); 19 } else { 20 assert_unreached(); 21 } 22 }); 23 link.click(); 24 t.step_timeout(() => { 25 if(followed) { 26 assert_unreached(); 27 } else { 28 t.done(); 29 } 30 }, 500); 31 }, "<" + type + "> that is not connected should " + (followed ? "" : "not ") + "be followed"); 32 33 async_test(t => { 34 const target = document.createElement("iframe"), 35 doc = document.implementation.createDocument("", ""), 36 link = doc.createElementNS("http://www.w3.org/1999/xhtml", type); 37 t.add_cleanup(() => target.remove()); 38 target.name = "certifiedrandom2" + type; 39 link.target = "certifiedrandom2" + type; 40 link.href = "/"; 41 document.body.appendChild(target); 42 target.onload = t.step_func(() => { 43 if(target.contentWindow.location.href === "about:blank") 44 return; 45 assert_unreached(); 46 }); 47 link.click(); 48 t.step_timeout(() => t.done(), 500); 49 }, "<" + type + "> that is from an inactive document should not be followed"); 50 });