|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 function waitForActive() { |
|
4 if (!gBrowser.docShell.isActive) { |
|
5 executeSoon(waitForActive); |
|
6 return; |
|
7 } |
|
8 is(gBrowser.docShell.isActive, true, "Docshell should be active again"); |
|
9 finish(); |
|
10 } |
|
11 |
|
12 function waitForInactive() { |
|
13 if (gBrowser.docShell.isActive) { |
|
14 executeSoon(waitForInactive); |
|
15 return; |
|
16 } |
|
17 is(gBrowser.docShell.isActive, false, "Docshell should be inactive"); |
|
18 window.restore(); |
|
19 waitForActive(); |
|
20 } |
|
21 |
|
22 function test() { |
|
23 registerCleanupFunction(function() { |
|
24 window.restore(); |
|
25 }); |
|
26 |
|
27 waitForExplicitFinish(); |
|
28 is(gBrowser.docShell.isActive, true, "Docshell should be active"); |
|
29 window.minimize(); |
|
30 // XXX On Linux minimize/restore seem to be very very async, but |
|
31 // our window.windowState changes sync.... so we can't rely on the |
|
32 // latter correctly reflecting the state of the former. In |
|
33 // particular, a restore() call before minimizing is done will not |
|
34 // actually restore the window, but change the window state. As a |
|
35 // result, just poll waiting for our expected isActive values. |
|
36 waitForInactive(); |
|
37 } |