Sync web-platform-tests up to revision a5b95cb31914507088a4eda16f7674bbc6f3313f
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / browsers / windows / noreferrer-window-name.html
1 <!doctype html>
2 <title>rel=noreferrer and reuse of names</title>
3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script>
5 <div id="log"></div>
6 <script>
7   async_test(function(t) {
8     localStorage.clear()
9
10     function makeHyperlink(n) {
11       var hyperlink = document.body.appendChild(document.createElement("a"))
12       hyperlink.rel = "noreferrer"
13       hyperlink.target = "sufficientlyrandomwindownameamiright"
14       hyperlink.href = "resources/noreferrer-window-name.html#" + n
15       return hyperlink
16     }
17
18     var hyperlink1 = makeHyperlink(1),
19         hyperlink2 = makeHyperlink(2)
20
21     t.add_cleanup(function() {
22       localStorage.setItem("x", "close")
23       localStorage.clear()
24       document.body.removeChild(hyperlink1)
25       document.body.removeChild(hyperlink2)
26     })
27
28     addEventListener("storage", function(e) {
29       t.step(function() {
30         if(localStorage.getItem("window1") && localStorage.getItem("window2")) {
31           localStorage.setItem("x", "close")
32           t.done()
33         }
34       })
35     })
36
37     hyperlink1.click()
38     hyperlink2.click()
39   })
40 </script>