2 <html xmlns=
"http://www.w3.org/1999/xhtml">
4 <meta charset=
"utf-8" />
5 <title>Test that alwaysontop windows do not pull focus when opened.
</title>
6 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel=
"stylesheet" href=
"chrome://mochikit/content/tests/SimpleTest/test.css"/>
9 add_task(async
function testAlwaysOnTop() {
10 let topWin
= window
.docShell
.rootTreeItem
.domWindow
;
11 await SimpleTest
.promiseFocus(topWin
);
12 is(Services
.focus
.activeWindow
, topWin
, "Top level window is focused");
14 let newWin
= Services
.ww
.openWindow(
18 "chrome,alwaysontop,width=300,height=300",
21 await
new Promise(resolve
=> {
22 newWin
.addEventListener("load", resolve
, { once
: true });
25 // Wait one tick of the event loop to give the window a chance to focus.
26 await
new Promise(resolve
=> { SimpleTest
.executeSoon(resolve
); });
28 is(Services
.focus
.activeWindow
, topWin
, "Top level window is still focused");
35 <div id=
"content" style=
"display: none"></div>