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

branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
equal deleted inserted replaced
-1:000000000000 0:097fede66e6f
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
3
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;
10
11 // Hiding a parent element will hide all its children
12 if (aElement.parentNode != aElement.ownerDocument)
13 return is_hidden(aElement.parentNode);
14
15 return false;
16 }
17
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 }
22
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 }
27
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