5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css"/>
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()`;
18 function observer(_subject
, _topic
, data
) {
19 info(`got notification ${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
);