Bug 1428847 - Move is_hidden and is_visible helper functions into BrowserTestUtils.jsm. r=johannh
authorkanika <kanika16047@iiitd.ac.in>
Thu, 22 Mar 2018 21:14:23 +0530
changeset 479259 684094d78fb48f4847db152fcbc83e6196448a72
parent 479258 f13d1acd73da207fdd38f6e113bfca8742b6d933
child 479284 e51f8dbf0397a7f7055dc792c3ee5ad2409e1e2c
child 479285 bd095fd7a7fa12cc6a10e15bc735796e496306aa
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1428847
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1428847 - Move is_hidden and is_visible helper functions into BrowserTestUtils.jsm. r=johannh MozReview-Commit-ID: 2xshA0CAPgY
browser/base/content/test/general/head.js
browser/base/content/test/permissions/browser_permissions.js
browser/base/content/test/permissions/head.js
browser/base/content/test/siteIdentity/browser_identity_UI.js
browser/base/content/test/siteIdentity/browser_insecureLoginForms.js
browser/base/content/test/siteIdentity/head.js
browser/base/content/test/urlbar/browser_urlbar_search_no_speculative_connect_with_client_cert.js
browser/base/content/test/urlbar/browser_urlbar_search_speculative_connect_mousedown.js
browser/base/content/test/urlbar/head.js
browser/base/content/test/webextensions/browser_extension_sideloading.js
browser/base/content/test/webextensions/head.js
browser/components/preferences/in-content/tests/head.js
browser/components/preferences/in-content/tests/siteData/head.js
browser/components/uitour/test/browser_trackingProtection.js
browser/components/uitour/test/browser_trackingProtection_tour.js
testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
toolkit/components/reader/test/head.js
toolkit/mozapps/extensions/test/browser/browser_details.js
toolkit/mozapps/extensions/test/browser/browser_discovery.js
toolkit/mozapps/extensions/test/browser/browser_list.js
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/general/head.js
@@ -425,35 +425,19 @@ function is_hidden(element) {
 
   // Hiding a parent element will hide all its children
   if (element.parentNode != element.ownerDocument)
     return is_hidden(element.parentNode);
 
   return false;
 }
 
-function is_visible(element) {
-  var style = element.ownerGlobal.getComputedStyle(element);
-  if (style.display == "none")
-    return false;
-  if (style.visibility != "visible")
-    return false;
-  if (style.display == "-moz-popup" && element.state != "open")
-    return false;
-
-  // Hiding a parent element will hide all its children
-  if (element.parentNode != element.ownerDocument)
-    return is_visible(element.parentNode);
-
-  return true;
-}
-
 function is_element_visible(element, msg) {
   isnot(element, null, "Element should not be null, when checking visibility");
-  ok(is_visible(element), msg || "Element should be visible");
+  ok(BrowserTestUtils.is_visible(element), msg || "Element should be visible");
 }
 
 function is_element_hidden(element, msg) {
   isnot(element, null, "Element should not be null, when checking visibility");
   ok(is_hidden(element), msg || "Element should be hidden");
 }
 
 function promisePopupEvent(popup, eventSuffix) {
--- a/browser/base/content/test/permissions/browser_permissions.js
+++ b/browser/base/content/test/permissions/browser_permissions.js
@@ -20,42 +20,42 @@ function closeIdentityPopup() {
 
 add_task(async function testMainViewVisible() {
   await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, async function() {
     let permissionsList = document.getElementById("identity-popup-permission-list");
     let emptyLabel = permissionsList.nextSibling.nextSibling;
 
     await openIdentityPopup();
 
-    ok(!is_hidden(emptyLabel), "List of permissions is empty");
+    ok(!BrowserTestUtils.is_hidden(emptyLabel), "List of permissions is empty");
 
     await closeIdentityPopup();
 
     SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.ALLOW);
 
     await openIdentityPopup();
 
-    ok(is_hidden(emptyLabel), "List of permissions is not empty");
+    ok(BrowserTestUtils.is_hidden(emptyLabel), "List of permissions is not empty");
 
     let labelText = SitePermissions.getPermissionLabel("camera");
     let labels = permissionsList.querySelectorAll(".identity-popup-permission-label");
     is(labels.length, 1, "One permission visible in main view");
     is(labels[0].textContent, labelText, "Correct value");
 
     let img = permissionsList.querySelector("image.identity-popup-permission-icon");
     ok(img, "There is an image for the permissions");
     ok(img.classList.contains("camera-icon"), "proper class is in image class");
 
     await closeIdentityPopup();
 
     SitePermissions.remove(gBrowser.currentURI, "camera");
 
     await openIdentityPopup();
 
-    ok(!is_hidden(emptyLabel), "List of permissions is empty");
+    ok(!BrowserTestUtils.is_hidden(emptyLabel), "List of permissions is empty");
 
     await closeIdentityPopup();
   });
 });
 
 add_task(async function testIdentityIcon() {
   await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, function() {
     SitePermissions.set(gBrowser.currentURI, "geo", SitePermissions.ALLOW);
@@ -89,17 +89,17 @@ add_task(async function testCancelPermis
     let permissionsList = document.getElementById("identity-popup-permission-list");
     let emptyLabel = permissionsList.nextSibling.nextSibling;
 
     SitePermissions.set(gBrowser.currentURI, "geo", SitePermissions.ALLOW);
     SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.BLOCK);
 
     await openIdentityPopup();
 
-    ok(is_hidden(emptyLabel), "List of permissions is not empty");
+    ok(BrowserTestUtils.is_hidden(emptyLabel), "List of permissions is not empty");
 
     let cancelButtons = permissionsList
       .querySelectorAll(".identity-popup-permission-remove-button");
 
     cancelButtons[0].click();
     let labels = permissionsList.querySelectorAll(".identity-popup-permission-label");
     is(labels.length, 1, "One permission should be removed");
     cancelButtons[1].click();
@@ -113,49 +113,49 @@ add_task(async function testCancelPermis
 add_task(async function testPermissionHints() {
   await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, async function(browser) {
     let permissionsList = document.getElementById("identity-popup-permission-list");
     let emptyHint = document.getElementById("identity-popup-permission-empty-hint");
     let reloadHint = document.getElementById("identity-popup-permission-reload-hint");
 
     await openIdentityPopup();
 
-    ok(!is_hidden(emptyHint), "Empty hint is visible");
-    ok(is_hidden(reloadHint), "Reload hint is hidden");
+    ok(!BrowserTestUtils.is_hidden(emptyHint), "Empty hint is visible");
+    ok(BrowserTestUtils.is_hidden(reloadHint), "Reload hint is hidden");
 
     await closeIdentityPopup();
 
     SitePermissions.set(gBrowser.currentURI, "geo", SitePermissions.ALLOW);
     SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.BLOCK);
 
     await openIdentityPopup();
 
-    ok(is_hidden(emptyHint), "Empty hint is hidden");
-    ok(is_hidden(reloadHint), "Reload hint is hidden");
+    ok(BrowserTestUtils.is_hidden(emptyHint), "Empty hint is hidden");
+    ok(BrowserTestUtils.is_hidden(reloadHint), "Reload hint is hidden");
 
     let cancelButtons = permissionsList
       .querySelectorAll(".identity-popup-permission-remove-button");
     SitePermissions.remove(gBrowser.currentURI, "camera");
 
     cancelButtons[0].click();
-    ok(is_hidden(emptyHint), "Empty hint is hidden");
-    ok(!is_hidden(reloadHint), "Reload hint is visible");
+    ok(BrowserTestUtils.is_hidden(emptyHint), "Empty hint is hidden");
+    ok(!BrowserTestUtils.is_hidden(reloadHint), "Reload hint is visible");
 
     cancelButtons[1].click();
-    ok(is_hidden(emptyHint), "Empty hint is hidden");
-    ok(!is_hidden(reloadHint), "Reload hint is visible");
+    ok(BrowserTestUtils.is_hidden(emptyHint), "Empty hint is hidden");
+    ok(!BrowserTestUtils.is_hidden(reloadHint), "Reload hint is visible");
 
     await closeIdentityPopup();
     let loaded = BrowserTestUtils.browserLoaded(browser);
     BrowserTestUtils.loadURI(browser, PERMISSIONS_PAGE);
     await loaded;
     await openIdentityPopup();
 
-    ok(!is_hidden(emptyHint), "Empty hint is visible after reloading");
-    ok(is_hidden(reloadHint), "Reload hint is hidden after reloading");
+    ok(!BrowserTestUtils.is_hidden(emptyHint), "Empty hint is visible after reloading");
+    ok(BrowserTestUtils.is_hidden(reloadHint), "Reload hint is hidden after reloading");
 
     await closeIdentityPopup();
   });
 });
 
 add_task(async function testPermissionIcons() {
   await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, function() {
     SitePermissions.set(gBrowser.currentURI, "camera", SitePermissions.ALLOW);
--- a/browser/base/content/test/permissions/head.js
+++ b/browser/base/content/test/permissions/head.js
@@ -1,18 +1,1 @@
 ChromeUtils.import("resource:///modules/SitePermissions.jsm", this);
-
-function is_hidden(element) {
-  var style = element.ownerGlobal.getComputedStyle(element);
-  if (style.display == "none")
-    return true;
-  if (style.visibility != "visible")
-    return true;
-  if (style.display == "-moz-popup")
-    return ["hiding", "closed"].includes(element.state);
-
-  // Hiding a parent element will hide all its children
-  if (element.parentNode != element.ownerDocument)
-    return is_hidden(element.parentNode);
-
-  return false;
-}
-
--- a/browser/base/content/test/siteIdentity/browser_identity_UI.js
+++ b/browser/base/content/test/siteIdentity/browser_identity_UI.js
@@ -98,17 +98,17 @@ function nextTest() {
       BrowserTestUtils.loadURI(gBrowser.selectedBrowser, gCurrentTest.location);
     } else {
       // Open the Control Center and make sure it closes after nav (Bug 1207542).
       let popupShown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
       gPopupHidden = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popuphidden");
       gIdentityHandler._identityBox.click();
       info("Waiting for the Control Center to be shown");
       popupShown.then(async () => {
-        ok(!is_hidden(gIdentityHandler._identityPopup), "Control Center is visible");
+        ok(!BrowserTestUtils.is_hidden(gIdentityHandler._identityPopup), "Control Center is visible");
         // Show the subview, which is an easy way in automation to reproduce
         // Bug 1207542, where the CC wouldn't close on navigation.
         let promiseViewShown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "ViewShown");
         gBrowser.ownerDocument.querySelector("#identity-popup-security-expander").click();
         await promiseViewShown;
         BrowserTestUtils.loadURI(gBrowser.selectedBrowser, gCurrentTest.location);
       });
     }
@@ -136,15 +136,15 @@ function checkResult() {
   } else {
     is(gIdentityHandler.getEffectiveHost(), gCurrentTest.effectiveHost, "effectiveHost matches for test " + gTestDesc);
   }
 
   if (gPopupHidden) {
     info("Waiting for the Control Center to hide");
     gPopupHidden.then(() => {
       gPopupHidden = null;
-      ok(is_hidden(gIdentityHandler._identityPopup), "Control Center is hidden");
+      ok(BrowserTestUtils.is_hidden(gIdentityHandler._identityPopup), "Control Center is hidden");
       executeSoon(nextTest);
     });
   } else {
     executeSoon(nextTest);
   }
 }
--- a/browser/base/content/test/siteIdentity/browser_insecureLoginForms.js
+++ b/browser/base/content/test/siteIdentity/browser_insecureLoginForms.js
@@ -40,26 +40,26 @@ add_task(async function test_simple() {
     let promisePanelOpen = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
     gIdentityHandler._identityBox.click();
     await promisePanelOpen;
 
     // Messages should be visible when the scheme is HTTP, and invisible when
     // the scheme is HTTPS.
     is(Array.every(document.getElementById("identity-popup-mainView")
                            .querySelectorAll("[when-loginforms=insecure]"),
-                   element => !is_hidden(element)),
+                   element => !BrowserTestUtils.is_hidden(element)),
        expectWarning,
        "The relevant messages should be visible or hidden in the main view.");
 
     let promiseViewShown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "ViewShown");
     document.getElementById("identity-popup-security-expander").click();
     await promiseViewShown;
 
     if (expectWarning) {
-      ok(is_visible(document.getElementById("connection-icon")), "Connection icon should be visible");
+      ok(BrowserTestUtils.is_visible(document.getElementById("connection-icon")), "Connection icon should be visible");
       let connectionIconImage = gBrowser.ownerGlobal
             .getComputedStyle(document.getElementById("connection-icon"))
             .getPropertyValue("list-style-image");
       let securityViewBG = gBrowser.ownerGlobal
             .getComputedStyle(document.getElementById("identity-popup-securityView")
                                       .getElementsByClassName("identity-popup-security-content")[0])
             .getPropertyValue("background-image");
       let securityContentBG = gBrowser.ownerGlobal
@@ -72,25 +72,25 @@ add_task(async function test_simple() {
       is(securityViewBG,
          "url(\"chrome://browser/skin/controlcenter/mcb-disabled.svg\")",
          "Using expected icon image in the Control Center main view");
       is(securityContentBG,
          "url(\"chrome://browser/skin/controlcenter/mcb-disabled.svg\")",
          "Using expected icon image in the Control Center subview");
       is(Array.filter(document.getElementById("identity-popup-securityView")
                               .querySelectorAll("[observes=identity-popup-insecure-login-forms-learn-more]"),
-                      element => !is_hidden(element)).length, 1,
+                      element => !BrowserTestUtils.is_hidden(element)).length, 1,
          "The 'Learn more' link should be visible once.");
     }
 
     // Messages should be visible when the scheme is HTTP, and invisible when
     // the scheme is HTTPS.
     is(Array.every(document.getElementById("identity-popup-securityView")
                            .querySelectorAll("[when-loginforms=insecure]"),
-                   element => !is_hidden(element)),
+                   element => !BrowserTestUtils.is_hidden(element)),
        expectWarning,
        "The relevant messages should be visible or hidden in the security view.");
 
     if (gIdentityHandler._identityPopup.state != "closed") {
       let hideEvent = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popuphidden");
       info("hiding popup");
       gIdentityHandler._identityPopup.hidePopup();
       await hideEvent;
@@ -156,24 +156,24 @@ add_task(async function test_ignoring_wi
     // Open the identity popup.
     let { gIdentityHandler } = gBrowser.ownerGlobal;
     let promisePanelOpen = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
     gIdentityHandler._identityBox.click();
     await promisePanelOpen;
 
     ok(Array.every(document.getElementById("identity-popup-mainView")
                            .querySelectorAll("[when-loginforms=insecure]"),
-                   element => is_hidden(element)),
+                   element => BrowserTestUtils.is_hidden(element)),
        "All messages should be hidden in the main view.");
 
     let promiseViewShown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "ViewShown");
     document.getElementById("identity-popup-security-expander").click();
     await promiseViewShown;
 
-    ok(is_visible(document.getElementById("connection-icon")),
+    ok(BrowserTestUtils.is_visible(document.getElementById("connection-icon")),
        "Connection icon is visible");
 
     // Assert that the identity indicators are still "secure".
     let connectionIconImage = gBrowser.ownerGlobal
           .getComputedStyle(document.getElementById("connection-icon"))
           .getPropertyValue("list-style-image");
     let securityViewBG = gBrowser.ownerGlobal
           .getComputedStyle(document.getElementById("identity-popup-securityView")
@@ -190,17 +190,17 @@ add_task(async function test_ignoring_wi
        "url(\"chrome://browser/skin/controlcenter/connection.svg\")",
        "Using expected icon image in the Control Center main view");
     is(securityContentBG,
        "url(\"chrome://browser/skin/controlcenter/connection.svg\")",
        "Using expected icon image in the Control Center subview");
 
     ok(Array.every(document.getElementById("identity-popup-securityView")
                            .querySelectorAll("[when-loginforms=insecure]"),
-                   element => is_hidden(element)),
+                   element => BrowserTestUtils.is_hidden(element)),
        "All messages should be hidden in the security view.");
 
     if (gIdentityHandler._identityPopup.state != "closed") {
       info("hiding popup");
       let hideEvent = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popuphidden");
       gIdentityHandler._identityPopup.hidePopup();
       await hideEvent;
     }
--- a/browser/base/content/test/siteIdentity/head.js
+++ b/browser/base/content/test/siteIdentity/head.js
@@ -1,43 +1,10 @@
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
-
-function is_hidden(element) {
-  var style = element.ownerGlobal.getComputedStyle(element);
-  if (style.display == "none")
-    return true;
-  if (style.visibility != "visible")
-    return true;
-  if (style.display == "-moz-popup")
-    return ["hiding", "closed"].includes(element.state);
-
-  // Hiding a parent element will hide all its children
-  if (element.parentNode != element.ownerDocument)
-    return is_hidden(element.parentNode);
-
-  return false;
-}
-
-function is_visible(element) {
-  var style = element.ownerGlobal.getComputedStyle(element);
-  if (style.display == "none")
-    return false;
-  if (style.visibility != "visible")
-    return false;
-  if (style.display == "-moz-popup" && element.state != "open")
-    return false;
-
-  // Hiding a parent element will hide all its children
-  if (element.parentNode != element.ownerDocument)
-    return is_visible(element.parentNode);
-
-  return true;
-}
-
 /**
  * Returns a Promise that resolves once a new tab has been opened in
  * a xul:tabbrowser.
  *
  * @param aTabBrowser
  *        The xul:tabbrowser to monitor for a new tab.
  * @return {Promise}
  *        Resolved when the new tab has been opened.
@@ -157,21 +124,21 @@ async function assertMixedContentBlockin
   is(passiveLoaded, !!statePassiveLoaded, "Expected state for passiveLoaded matches UI state");
 
   if (stateInsecure) {
     const insecureConnectionIcon = Services.prefs.getBoolPref("security.insecure_connection_icon.enabled");
     if (!insecureConnectionIcon) {
       // HTTP request, there should be no MCB classes for the identity box and the non secure icon
       // should always be visible regardless of MCB state.
       ok(classList.contains("unknownIdentity"), "unknownIdentity on HTTP page");
-      ok(is_hidden(connectionIcon), "connection icon should be hidden");
+      ok(BrowserTestUtils.is_hidden(connectionIcon), "connection icon should be hidden");
     } else {
       // HTTP request, there should be a broken padlock shown always.
       ok(classList.contains("notSecure"), "notSecure on HTTP page");
-      ok(!is_hidden(connectionIcon), "connection icon should be visible");
+      ok(!BrowserTestUtils.is_hidden(connectionIcon), "connection icon should be visible");
     }
 
     ok(!classList.contains("mixedActiveContent"), "No MCB icon on HTTP page");
     ok(!classList.contains("mixedActiveBlocked"), "No MCB icon on HTTP page");
     ok(!classList.contains("mixedDisplayContent"), "No MCB icon on HTTP page");
     ok(!classList.contains("mixedDisplayContentLoadedActiveBlocked"), "No MCB icon on HTTP page");
   } else {
     // Make sure the identity box UI has the correct mixedcontent states and icons
@@ -179,17 +146,17 @@ async function assertMixedContentBlockin
         "identityBox has expected class for activeLoaded");
     is(classList.contains("mixedActiveBlocked"), activeBlocked && !passiveLoaded,
         "identityBox has expected class for activeBlocked && !passiveLoaded");
     is(classList.contains("mixedDisplayContent"), passiveLoaded && !(activeLoaded || activeBlocked),
        "identityBox has expected class for passiveLoaded && !(activeLoaded || activeBlocked)");
     is(classList.contains("mixedDisplayContentLoadedActiveBlocked"), passiveLoaded && activeBlocked,
        "identityBox has expected class for passiveLoaded && activeBlocked");
 
-    ok(!is_hidden(connectionIcon), "connection icon should be visible");
+    ok(!BrowserTestUtils.is_hidden(connectionIcon), "connection icon should be visible");
     if (activeLoaded) {
       is(connectionIconImage, "url(\"chrome://browser/skin/connection-mixed-active-loaded.svg\")",
         "Using active loaded icon");
     }
     if (activeBlocked && !passiveLoaded) {
       is(connectionIconImage, "url(\"chrome://browser/skin/connection-secure.svg\")",
         "Using active blocked icon");
     }
@@ -271,17 +238,17 @@ async function assertMixedContentBlockin
   }
 
   if (activeLoaded || activeBlocked || passiveLoaded) {
     let promiseViewShown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "ViewShown");
     doc.getElementById("identity-popup-security-expander").click();
     await promiseViewShown;
     is(Array.filter(doc.getElementById("identity-popup-securityView")
                        .querySelectorAll("[observes=identity-popup-mcb-learn-more]"),
-                    element => !is_hidden(element)).length, 1,
+                    element => !BrowserTestUtils.is_hidden(element)).length, 1,
        "The 'Learn more' link should be visible once.");
   }
 
   if (gIdentityHandler._identityPopup.state != "closed") {
     let hideEvent = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popuphidden");
     info("Hiding identity popup");
     gIdentityHandler._identityPopup.hidePopup();
     await hideEvent;
--- a/browser/base/content/test/urlbar/browser_urlbar_search_no_speculative_connect_with_client_cert.js
+++ b/browser/base/content/test/urlbar/browser_urlbar_search_no_speculative_connect_with_client_cert.js
@@ -153,17 +153,17 @@ add_task(async function popup_mousedown_
   await waitForAutocompleteResultAt(1);
   let controller = gURLBar.popup.input.controller;
   // The first item should be 'Search with ...' thus we want the second.
   let value = controller.getFinalCompleteValueAt(1);
   info(`The value of the second item is ${value}`);
   is(value, test.completeValue, "The second item has the url we visited.");
 
   let listitem = await waitForAutocompleteResultAt(1);
-  Assert.ok(is_visible(listitem), "The node is there.");
+  Assert.ok(BrowserTestUtils.is_visible(listitem), "The node is there.");
 
   expectingChooseCertificate = false;
   EventUtils.synthesizeMouseAtCenter(listitem, {type: "mousedown"}, window);
   is(gURLBar.popup.richlistbox.selectedIndex, 1, "The second item is selected");
 
   // We shouldn't have triggered a speculative connection, because a client
   // certificate is installed.
   SimpleTest.requestFlakyTimeout("Wait for UI");
--- a/browser/base/content/test/urlbar/browser_urlbar_search_speculative_connect_mousedown.js
+++ b/browser/base/content/test/urlbar/browser_urlbar_search_speculative_connect_mousedown.js
@@ -57,17 +57,17 @@ add_task(async function popup_mousedown_
   let controller = gURLBar.popup.input.controller;
   // The first item should be 'Search with ...' thus we wan the second.
   let value = controller.getFinalCompleteValueAt(1);
   info(`The value of the second item is ${value}`);
   is(value, test.completeValue, "The second item has the url we visited.");
 
   await BrowserTestUtils.waitForCondition(() => {
     return !!gURLBar.popup.richlistbox.childNodes[1] &&
-           is_visible(gURLBar.popup.richlistbox.childNodes[1]);
+           BrowserTestUtils.is_visible(gURLBar.popup.richlistbox.childNodes[1]);
   }, "the node is there.");
 
   let listitem = gURLBar.popup.richlistbox.childNodes[1];
   EventUtils.synthesizeMouse(listitem, 10, 10, {type: "mousedown"}, window);
   is(gURLBar.popup.richlistbox.selectedIndex, 1, "The second item is selected");
   await promiseSpeculativeConnection(gHttpServer);
   is(gHttpServer.connectionNumber, 1, `${gHttpServer.connectionNumber} speculative connection has been setup.`);
 });
--- a/browser/base/content/test/urlbar/head.js
+++ b/browser/base/content/test/urlbar/head.js
@@ -87,56 +87,24 @@ function waitForDocLoadAndStopIt(aExpect
 
     let mm = aBrowser.messageManager;
     mm.loadFrameScript("data:,(" + content_script.toString() + ")(" + aStopFromProgressListener + ");", true);
     mm.addMessageListener("Test:WaitForDocLoadAndStopIt", complete);
     info("waitForDocLoadAndStopIt: Waiting for URL: " + aExpectedURL);
   });
 }
 
-function is_hidden(element) {
-  var style = element.ownerGlobal.getComputedStyle(element);
-  if (style.display == "none")
-    return true;
-  if (style.visibility != "visible")
-    return true;
-  if (style.display == "-moz-popup")
-    return ["hiding", "closed"].includes(element.state);
-
-  // Hiding a parent element will hide all its children
-  if (element.parentNode != element.ownerDocument)
-    return is_hidden(element.parentNode);
-
-  return false;
-}
-
-function is_visible(element) {
-  var style = element.ownerGlobal.getComputedStyle(element);
-  if (style.display == "none")
-    return false;
-  if (style.visibility != "visible")
-    return false;
-  if (style.display == "-moz-popup" && element.state != "open")
-    return false;
-
-  // Hiding a parent element will hide all its children
-  if (element.parentNode != element.ownerDocument)
-    return is_visible(element.parentNode);
-
-  return true;
-}
-
 function is_element_visible(element, msg) {
   isnot(element, null, "Element should not be null, when checking visibility");
-  ok(is_visible(element), msg || "Element should be visible");
+  ok(BrowserTestUtils.is_visible(element), msg || "Element should be visible");
 }
 
 function is_element_hidden(element, msg) {
   isnot(element, null, "Element should not be null, when checking visibility");
-  ok(is_hidden(element), msg || "Element should be hidden");
+  ok(BrowserTestUtils.is_hidden(element), msg || "Element should be hidden");
 }
 
 function runHttpServer(scheme, host, port = -1) {
   let httpserver = new HttpServer();
   try {
     httpserver.start(port);
     port = httpserver.identity.primaryPort;
     httpserver.identity.setPrimary(scheme, host, port);
--- a/browser/base/content/test/webextensions/browser_extension_sideloading.js
+++ b/browser/base/content/test/webextensions/browser_extension_sideloading.js
@@ -210,18 +210,18 @@ add_task(async function() {
 
   // Make sure XBL bindings are applied
   list.clientHeight;
 
   let item = list.children.find(_item => _item.value == ID3);
   ok(item, "Found entry for sideloaded extension in about:addons");
   item.scrollIntoView({behavior: "instant"});
 
-  ok(is_visible(item._enableBtn), "Enable button is visible for sideloaded extension");
-  ok(is_hidden(item._disableBtn), "Disable button is not visible for sideloaded extension");
+  ok(BrowserTestUtils.is_visible(item._enableBtn), "Enable button is visible for sideloaded extension");
+  ok(BrowserTestUtils.is_hidden(item._disableBtn), "Disable button is not visible for sideloaded extension");
 
   // When clicking enable we should see the permissions notification
   popupPromise = promisePopupNotificationShown("addon-webext-permissions");
   BrowserTestUtils.synthesizeMouseAtCenter(item._enableBtn, {},
                                            gBrowser.selectedBrowser);
   panel = await popupPromise;
   checkNotification(panel, DEFAULT_ICON_URL, [["webextPerms.hostDescription.allUrls"]]);
 
--- a/browser/base/content/test/webextensions/head.js
+++ b/browser/base/content/test/webextensions/head.js
@@ -130,48 +130,16 @@ async function waitForUpdate(addon) {
 function isDefaultIcon(icon) {
   // These are basically the same icon, but code within webextensions
   // generates references to the former and generic add-ons manager code
   // generates referces to the latter.
   return (icon == "chrome://browser/content/extension.svg" ||
           icon == "chrome://mozapps/skin/extensions/extensionGeneric.svg");
 }
 
-function is_hidden(element) {
-  var style = element.ownerGlobal.getComputedStyle(element);
-  if (style.display == "none")
-    return true;
-  if (style.visibility != "visible")
-    return true;
-  if (style.display == "-moz-popup")
-    return ["hiding", "closed"].includes(element.state);
-
-  // Hiding a parent element will hide all its children
-  if (element.parentNode != element.ownerDocument)
-    return is_hidden(element.parentNode);
-
-  return false;
-}
-
-function is_visible(element) {
-  var style = element.ownerGlobal.getComputedStyle(element);
-  if (style.display == "none")
-    return false;
-  if (style.visibility != "visible")
-    return false;
-  if (style.display == "-moz-popup" && element.state != "open")
-    return false;
-
-  // Hiding a parent element will hide all its children
-  if (element.parentNode != element.ownerDocument)
-    return is_visible(element.parentNode);
-
-  return true;
-}
-
 /**
  * Check the contents of an individual permission string.
  * This function is fairly specific to the use here and probably not
  * suitable for re-use elsewhere...
  *
  * @param {string} string
  *        The string value to check (i.e., pulled from the DOM)
  * @param {string} key
--- a/browser/components/preferences/in-content/tests/head.js
+++ b/browser/components/preferences/in-content/tests/head.js
@@ -1,37 +1,23 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 ChromeUtils.import("resource://gre/modules/Promise.jsm", this);
 
 const kDefaultWait = 2000;
 
-function is_hidden(aElement) {
-  var style = aElement.ownerGlobal.getComputedStyle(aElement);
-  if (style.display == "none")
-    return true;
-  if (style.visibility != "visible")
-    return true;
-
-  // Hiding a parent element will hide all its children
-  if (aElement.parentNode != aElement.ownerDocument)
-    return is_hidden(aElement.parentNode);
-
-  return false;
-}
-
 function is_element_visible(aElement, aMsg) {
   isnot(aElement, null, "Element should not be null, when checking visibility");
-  ok(!is_hidden(aElement), aMsg);
+  ok(!BrowserTestUtils.is_hidden(aElement), aMsg);
 }
 
 function is_element_hidden(aElement, aMsg) {
   isnot(aElement, null, "Element should not be null, when checking visibility");
-  ok(is_hidden(aElement), aMsg);
+  ok(BrowserTestUtils.is_hidden(aElement), aMsg);
 }
 
 function open_preferences(aCallback) {
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:preferences");
   let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
   newTabBrowser.addEventListener("Initialized", function() {
     aCallback(gBrowser.contentWindow);
   }, { capture: true, once: true });
--- a/browser/components/preferences/in-content/tests/siteData/head.js
+++ b/browser/components/preferences/in-content/tests/siteData/head.js
@@ -21,38 +21,24 @@ ChromeUtils.defineModuleGetter(this, "Si
                                "resource://testing-common/SiteDataTestUtils.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "serviceWorkerManager", "@mozilla.org/serviceworkers/manager;1", "nsIServiceWorkerManager");
 
 function promiseSiteDataManagerSitesUpdated() {
   return TestUtils.topicObserved("sitedatamanager:sites-updated", () => true);
 }
 
-function is_hidden(aElement) {
-  var style = aElement.ownerGlobal.getComputedStyle(aElement);
-  if (style.display == "none")
-    return true;
-  if (style.visibility != "visible")
-    return true;
-
-  // Hiding a parent element will hide all its children
-  if (aElement.parentNode != aElement.ownerDocument)
-    return is_hidden(aElement.parentNode);
-
-  return false;
-}
-
 function is_element_visible(aElement, aMsg) {
   isnot(aElement, null, "Element should not be null, when checking visibility");
-  ok(!is_hidden(aElement), aMsg);
+  ok(!BrowserTestUtils.is_hidden(aElement), aMsg);
 }
 
 function is_element_hidden(aElement, aMsg) {
   isnot(aElement, null, "Element should not be null, when checking visibility");
-  ok(is_hidden(aElement), aMsg);
+  ok(BrowserTestUtils.is_hidden(aElement), aMsg);
 }
 
 function promiseLoadSubDialog(aURL) {
   return new Promise((resolve, reject) => {
     content.gSubDialog._dialogStack.addEventListener("dialogopen", function dialogopen(aEvent) {
       if (aEvent.detail.dialog._frame.contentWindow.location == "about:blank")
         return;
       content.gSubDialog._dialogStack.removeEventListener("dialogopen", dialogopen);
--- a/browser/components/uitour/test/browser_trackingProtection.js
+++ b/browser/components/uitour/test/browser_trackingProtection.js
@@ -24,17 +24,17 @@ add_task(async function setup_test() {
   await UrlClassifierTestUtils.addTestTrackers();
 });
 
 add_task(async function test_benignPage() {
   info("Load a test page not containing tracking elements");
   allowOneIntro();
   await BrowserTestUtils.withNewTab({gBrowser, url: BENIGN_PAGE}, async function() {
     await waitForConditionPromise(() => {
-      return is_visible(TOOLTIP_PANEL);
+      return BrowserTestUtils.is_visible(TOOLTIP_PANEL);
     }, "Info panel shouldn't appear on a benign page").
       then(() => ok(false, "Info panel shouldn't appear"),
            () => {
              ok(true, "Info panel didn't appear on a benign page");
            });
 
   });
 });
@@ -73,17 +73,17 @@ add_task(async function test_trackingPag
     await panelHiddenPromise;
     ok(true, "Panel hid when the button was clicked");
     BrowserTestUtils.removeTab(tab);
   });
 
   info("Open another tracking page and make sure we don't show the panel again");
   await BrowserTestUtils.withNewTab({gBrowser, url: TRACKING_PAGE}, async function() {
     await waitForConditionPromise(() => {
-      return is_visible(TOOLTIP_PANEL);
+      return BrowserTestUtils.is_visible(TOOLTIP_PANEL);
     }, "Info panel shouldn't appear more than MAX_INTROS").
       then(() => ok(false, "Info panel shouldn't appear again"),
            () => {
              ok(true, "Info panel didn't appear more than MAX_INTROS on tracking pages");
            });
 
   });
 });
--- a/browser/components/uitour/test/browser_trackingProtection_tour.js
+++ b/browser/components/uitour/test/browser_trackingProtection_tour.js
@@ -75,15 +75,15 @@ async function checkToggleTarget(targetI
   is(popup.alignmentPosition, "end_before",
      "Check " + targetID + " position");
 
   let hideMenuPromise =
         promisePanelElementHidden(window, gIdentityHandler._identityPopup);
   await gContentAPI.hideMenu("controlCenter");
   await hideMenuPromise;
 
-  ok(!is_visible(popup), "The tooltip should now be hidden.");
+  ok(!BrowserTestUtils.is_visible(popup), "The tooltip should now be hidden.");
   await testTargetAvailability(false);
 
   await ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
     content.document.getElementById("tracking-element").remove();
   });
 }
--- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
+++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
@@ -213,16 +213,64 @@ var BrowserTestUtils = {
         registrar.registerFactory(DEFAULT_PROCESSSELECTOR_CID, "",
                                   PROCESSSELECTOR_CONTRACTID, null);
       }
     }
     return Promise.all(promises).then(() => tab);
   },
 
   /**
+   * Checks if a DOM element is hidden.
+   *
+   * @param {Element} element
+   *        The element which is to be checked.
+   *
+   * @return {boolean}
+   */
+  is_hidden(element) {
+    var style = element.ownerGlobal.getComputedStyle(element);
+    if (style.display == "none")
+      return true;
+    if (style.visibility != "visible")
+      return true;
+    if (style.display == "-moz-popup")
+      return ["hiding", "closed"].includes(element.state);
+
+    // Hiding a parent element will hide all its children
+    if (element.parentNode != element.ownerDocument)
+      return BrowserTestUtils.is_hidden(element.parentNode);
+
+    return false;
+  },
+
+  /**
+   * Checks if a DOM element is visible.
+   *
+   * @param {Element} element
+   *        The element which is to be checked.
+   *
+   * @return {boolean}
+   */
+  is_visible(element) {
+    var style = element.ownerGlobal.getComputedStyle(element);
+    if (style.display == "none")
+      return false;
+    if (style.visibility != "visible")
+      return false;
+    if (style.display == "-moz-popup" && element.state != "open")
+      return false;
+
+    // Hiding a parent element will hide all its children
+    if (element.parentNode != element.ownerDocument)
+      return BrowserTestUtils.is_visible(element.parentNode);
+
+    return true;
+  },
+
+  /**
    * Switches to a tab and resolves when it is ready.
    *
    * @param {tabbrowser} tabbrowser
    *        The tabbrowser.
    * @param {tab} tab
    *        Either a tab element to switch to or a function to perform the switch.
    *
    * @return {Promise}
--- a/toolkit/components/reader/test/head.js
+++ b/toolkit/components/reader/test/head.js
@@ -80,47 +80,16 @@ function waitForCondition(condition, nex
 function promiseWaitForCondition(aConditionFn) {
   return new Promise(resolve => {
     waitForCondition(aConditionFn, resolve, "Condition didn't pass.");
   });
 }
 
 function is_element_visible(element, msg) {
   isnot(element, null, "Element should not be null, when checking visibility");
-  ok(is_visible(element), msg || "Element should be visible");
+  ok(BrowserTestUtils.is_visible(element), msg || "Element should be visible");
 
 }
 function is_element_hidden(element, msg) {
   isnot(element, null, "Element should not be null, when checking visibility");
-  ok(is_hidden(element), msg || "Element should be hidden");
+  ok(BrowserTestUtils.is_hidden(element), msg || "Element should be hidden");
 }
 
-function is_visible(element) {
-  var style = element.ownerGlobal.getComputedStyle(element);
-  if (style.display == "none")
-    return false;
-  if (style.visibility != "visible")
-    return false;
-  if (style.display == "-moz-popup" && element.state != "open")
-    return false;
-
-  // Hiding a parent element will hide all its children
-  if (element.parentNode != element.ownerDocument)
-    return is_visible(element.parentNode);
-
-  return true;
-}
-
-function is_hidden(element) {
-  var style = element.ownerGlobal.getComputedStyle(element);
-  if (style.display == "none")
-    return true;
-  if (style.visibility != "visible")
-    return true;
-  if (style.display == "-moz-popup")
-    return ["hiding", "closed"].includes(element.state);
-
-  // Hiding a parent element will hide all its children
-  if (element.parentNode != element.ownerDocument)
-    return is_hidden(element.parentNode);
-
-  return false;
-}
--- a/toolkit/mozapps/extensions/test/browser/browser_details.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_details.js
@@ -283,17 +283,17 @@ add_test(function() {
       run_next_test();
     }, {once: true});
   });
 });
 
 // Opens and tests the details view for add-on 5
 add_test(function() {
   open_details("addon5@tests.mozilla.org", "extension", async function() {
-    await TestUtils.waitForCondition(() => !is_hidden(get("detail-error-link")));
+    await TestUtils.waitForCondition(() => !BrowserTestUtils.is_hidden(get("detail-error-link")));
     is(get("detail-name").textContent, "Test add-on 5", "Name should be correct");
 
     is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
     is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
     is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
     is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
 
     is_element_hidden(get("detail-warning"), "Warning message should be hidden");
@@ -339,17 +339,17 @@ if (!AppConstants.MOZ_REQUIRE_SIGNING) {
 add_test(async function() {
   await close_manager(gManagerWindow);
   Services.prefs.setBoolPref("xpinstall.signatures.required", true);
   let aWindow = await open_manager(null);
   gManagerWindow = aWindow;
   gCategoryUtilities = new CategoryUtilities(gManagerWindow);
 
   open_details("addon9@tests.mozilla.org", "extension", async function() {
-    await TestUtils.waitForCondition(() => !is_hidden(get("detail-error-link")));
+    await TestUtils.waitForCondition(() => !BrowserTestUtils.is_hidden(get("detail-error-link")));
     is(get("detail-name").textContent, "Test add-on 9", "Name should be correct");
 
     is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
     is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
     is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
     is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
 
     is_element_hidden(get("detail-warning"), "Warning message should be hidden");
@@ -398,17 +398,17 @@ if (!AppConstants.REQUIRE_SIGNING) {
 add_test(async function() {
   await close_manager(gManagerWindow);
   Services.prefs.setBoolPref("xpinstall.signatures.required", true);
   let aWindow = await open_manager(null);
   gManagerWindow = aWindow;
   gCategoryUtilities = new CategoryUtilities(gManagerWindow);
 
   open_details("addon10@tests.mozilla.org", "extension", async function() {
-    await TestUtils.waitForCondition(() => !is_hidden(get("detail-error-link")));
+    await TestUtils.waitForCondition(() => !BrowserTestUtils.is_hidden(get("detail-error-link")));
     is(get("detail-name").textContent, "Test add-on 10", "Name should be correct");
 
     is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
     is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
     is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
     is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
 
     is_element_hidden(get("detail-warning"), "Warning message should be hidden");
--- a/toolkit/mozapps/extensions/test/browser/browser_discovery.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_discovery.js
@@ -539,19 +539,19 @@ async function bug_601442_test_elements(
     ok(gCategoryUtilities.isTypeVisible("discover"), "Discover category should be visible");
   else
     ok(!gCategoryUtilities.isTypeVisible("discover"), "Discover category should not be visible");
 
   gManagerWindow.loadView("addons://list/dictionary");
   let aManager = await wait_for_view_load(gManagerWindow);
   var button = aManager.document.getElementById("discover-button-install");
   if (visible)
-    ok(!is_hidden(button), "Discover button should be visible!");
+    ok(!BrowserTestUtils.is_hidden(button), "Discover button should be visible!");
   else
-    ok(is_hidden(button), "Discover button should not be visible!");
+    ok(BrowserTestUtils.is_hidden(button), "Discover button should not be visible!");
 
   close_manager(gManagerWindow, run_next_test);
 }
 
 add_test(function() {
   Services.prefs.setBoolPref(PREF_DISCOVER_ENABLED, false);
   Services.prefs.setBoolPref(PREF_XPI_ENABLED, true);
   bug_601442_test_elements(false);
--- a/toolkit/mozapps/extensions/test/browser/browser_list.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_list.js
@@ -115,17 +115,17 @@ add_task(async function() {
 function get_test_items() {
   var tests = "@tests.mozilla.org";
 
   var items = {};
   var item = gManagerWindow.document.getElementById("addon-list").firstChild;
 
   while (item) {
     if (item.mAddon.id.substring(item.mAddon.id.length - tests.length) == tests &&
-        !is_hidden(item))
+        !BrowserTestUtils.is_hidden(item))
       items[item.mAddon.name] = item;
     item = item.nextSibling;
   }
 
   return items;
 }
 
 function get_node(parent, anonid) {
@@ -161,17 +161,17 @@ add_task(async function() {
   is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
   is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
   is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
   is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
 
   info("Addon 5");
   addon = items["Test add-on 5"];
   addon.parentNode.ensureElementIsVisible(addon);
-  await TestUtils.waitForCondition(() => !is_hidden(get_node(addon, "error-link")));
+  await TestUtils.waitForCondition(() => !BrowserTestUtils.is_hidden(get_node(addon, "error-link")));
   ({ name, version } = await get_tooltip_info(addon));
   is(get_node(addon, "name").value, "Test add-on 5", "Name should be correct");
   is(name, "Test add-on 5", "Tooltip name should be correct");
 
   is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
   is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
   is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
   is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
@@ -218,17 +218,17 @@ add_task(async function() {
   is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
   is_element_hidden(get_node(addon, "error"), "Error message should be visible");
   is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
   is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
 
   info("Addon 8");
   addon = items["Test add-on 8"];
   addon.parentNode.ensureElementIsVisible(addon);
-  await TestUtils.waitForCondition(() => !is_hidden(get_node(addon, "error-link")));
+  await TestUtils.waitForCondition(() => !BrowserTestUtils.is_hidden(get_node(addon, "error-link")));
   ({ name, version } = await get_tooltip_info(addon));
   is(get_node(addon, "name").value, "Test add-on 8", "Name should be correct");
   is(name, "Test add-on 8", "Tooltip name should be correct");
 
   is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
   is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
   is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
   is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
@@ -240,17 +240,17 @@ add_task(async function() {
   is_element_visible(get_node(addon, "error-link"), "Error link should be visible");
   is(get_node(addon, "error-link").value, "Update Now", "Error link text should be correct");
   is(get_node(addon, "error-link").href, "http://example.com/addon8@tests.mozilla.org", "Error link should be correct");
   is_element_hidden(get_node(addon, "pending"), "Pending message should be hidden");
 
   info("Addon 9");
   addon = items["Test add-on 9"];
   addon.parentNode.ensureElementIsVisible(addon);
-  await TestUtils.waitForCondition(() => !is_hidden(get_node(addon, "error-link")));
+  await TestUtils.waitForCondition(() => !BrowserTestUtils.is_hidden(get_node(addon, "error-link")));
   ({ name, version } = await get_tooltip_info(addon));
   is(get_node(addon, "name").value, "Test add-on 9", "Name should be correct");
   is(name, "Test add-on 9", "Tooltip name should be correct");
 
   is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
   is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
   is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
   is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
@@ -518,17 +518,17 @@ add_task(async function() {
 
   await gCategoryUtilities.openType("extension");
   let items = get_test_items();
   is(Object.keys(items).length, EXPECTED_ADDONS, "Should be the right number of add-ons installed");
 
   info("Addon 10");
   let addon = items["Test add-on 10"];
   addon.parentNode.ensureElementIsVisible(addon);
-  await TestUtils.waitForCondition(() => !is_hidden(get_node(addon, "error-link")));
+  await TestUtils.waitForCondition(() => !BrowserTestUtils.is_hidden(get_node(addon, "error-link")));
   let { name } = await get_tooltip_info(addon);
   is(get_node(addon, "name").value, "Test add-on 10", "Name should be correct");
   is(name, "Test add-on 10", "Tooltip name should be correct");
 
   is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
   is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
   is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
   is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
@@ -539,17 +539,17 @@ add_task(async function() {
   is(get_node(addon, "error").textContent, "Test add-on 10 could not be verified for use in " + gApp + " and has been disabled.", "Error message should be correct");
   is_element_visible(get_node(addon, "error-link"), "Error link should be visible");
   is(get_node(addon, "error-link").value, "More Information", "Error link text should be correct");
   is(get_node(addon, "error-link").href, infoURL, "Error link should be correct");
 
   info("Addon 11");
   addon = items["Test add-on 11"];
   addon.parentNode.ensureElementIsVisible(addon);
-  await TestUtils.waitForCondition(() => !is_hidden(get_node(addon, "error-link")));
+  await TestUtils.waitForCondition(() => !BrowserTestUtils.is_hidden(get_node(addon, "error-link")));
   ({ name } = await get_tooltip_info(addon));
   is(get_node(addon, "name").value, "Test add-on 11", "Name should be correct");
   is(name, "Test add-on 11", "Tooltip name should be correct");
 
   is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
   is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
   is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
   is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");