summaryrefslogtreecommitdiffstats
path: root/browser/components/preferences/tests/browser_permissions_urlFieldHidden.js
blob: dea976286172744895e5db7b40bf230eac2d4931 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"use strict";

const PERMISSIONS_URL =
  "chrome://browser/content/preferences/dialogs/permissions.xhtml";

add_task(async function urlFieldVisibleForPopupPermissions() {
  await openPreferencesViaOpenPreferencesAPI("panePrivacy", {
    leaveOpen: true,
  });
  let win = gBrowser.selectedBrowser.contentWindow;
  let doc = win.document;
  let popupPolicyCheckbox = doc.getElementById("popupPolicy");
  ok(
    !popupPolicyCheckbox.checked,
    "popupPolicyCheckbox should be unchecked by default"
  );
  popupPolicyCheckbox.click();
  let popupPolicyButton = doc.getElementById("popupPolicyButton");
  ok(popupPolicyButton, "popupPolicyButton found");
  let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL);
  popupPolicyButton.click();
  let dialog = await dialogPromise;
  ok(dialog, "dialog loaded");

  let urlLabel = dialog.document.getElementById("urlLabel");
  ok(
    !urlLabel.hidden,
    "urlLabel should be visible when one of block/session/allow visible"
  );
  let url = dialog.document.getElementById("url");
  ok(
    !url.hidden,
    "url should be visible when one of block/session/allow visible"
  );

  popupPolicyCheckbox.click();
  gBrowser.removeCurrentTab();
});