browser/base/content/test/general/browser_minimize.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial