no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / docshell / test / navigation / test_open_javascript_noopener.html
blob81a6b70d618531fac019b2d0d74097c4f65e0cdf
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
7 </head>
8 <body>
9 <script>
11 add_task(async function test_open_javascript_noopener() {
12 const topic = "test-javascript-was-run";
13 function jsuri(version) {
14 return `javascript:SpecialPowers.notifyObservers(null, "${topic}", "${version}");window.close()`;
17 let seen = [];
18 function observer(_subject, _topic, data) {
19 info(`got notification ${data}`);
20 seen.push(data);
22 SpecialPowers.addObserver(observer, topic);
24 isDeeply(seen, [], "seen no test notifications");
25 window.open(jsuri("1"));
27 // Bounce off the parent process to make sure the JS will have run.
28 await SpecialPowers.spawnChrome([], () => {});
30 isDeeply(seen, ["1"], "seen the opener notification");
32 window.open(jsuri("2"), "", "noopener");
34 // Bounce off the parent process to make sure the JS will have run.
35 await SpecialPowers.spawnChrome([], () => {});
37 isDeeply(seen, ["1"], "didn't get a notification from the noopener popup");
39 SpecialPowers.removeObserver(observer, topic);
40 });
42 </script>
43 </body>
44 </html>