browser/components/preferences/in-content/tests/head.js

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function is_hidden(aElement) {
     5   var style = aElement.ownerDocument.defaultView.getComputedStyle(aElement, "");
     6   if (style.display == "none")
     7     return true;
     8   if (style.visibility != "visible")
     9     return true;
    11   // Hiding a parent element will hide all its children
    12   if (aElement.parentNode != aElement.ownerDocument)
    13     return is_hidden(aElement.parentNode);
    15   return false;
    16 }
    18 function is_element_visible(aElement, aMsg) {
    19   isnot(aElement, null, "Element should not be null, when checking visibility");
    20   ok(!is_hidden(aElement), aMsg);
    21 }
    23 function is_element_hidden(aElement, aMsg) {
    24   isnot(aElement, null, "Element should not be null, when checking visibility");
    25   ok(is_hidden(aElement), aMsg);
    26 }
    28 function open_preferences(aCallback) {
    29   gBrowser.selectedTab = gBrowser.addTab("about:preferences");
    30   let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
    31   newTabBrowser.addEventListener("Initialized", function () {
    32     newTabBrowser.removeEventListener("Initialized", arguments.callee, true);
    33     aCallback(gBrowser.contentWindow);
    34   }, true);
    35 }

mercurial