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.

     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 }
    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 }
    22 function test() {
    23     registerCleanupFunction(function() {
    24       window.restore();
    25     });
    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 }

mercurial