fune/browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js
Timothy Guan-tin Chien de00d490e0 Bug 1363850 - Part II, Move old about:preferences from in-content-old/ to in-content/, r=jaws,mconley
MozReview-Commit-ID: DPLJT1adO1c

--HG--
rename : browser/components/preferences/in-content-old/content.js => browser/components/preferences/in-content/content.js
rename : browser/components/preferences/in-content-old/content.xul => browser/components/preferences/in-content/content.xul
rename : browser/components/preferences/in-content-old/search.js => browser/components/preferences/in-content/search.js
rename : browser/components/preferences/in-content-old/search.xul => browser/components/preferences/in-content/search.xul
rename : browser/components/preferences/in-content-old/security.js => browser/components/preferences/in-content/security.js
rename : browser/components/preferences/in-content-old/security.xul => browser/components/preferences/in-content/security.xul
rename : browser/components/preferences/in-content-old/tests/browser_advanced_siteData.js => browser/components/preferences/in-content/tests/browser_advanced_siteData.js
extra : rebase_source : 57611e32dba47a2238a5e0573c25478a96cfb8fd
2017-05-31 08:20:26 +08:00

45 lines
1.9 KiB
JavaScript

"use strict";
const PERMISSIONS_URL = "chrome://browser/content/preferences/permissions.xul";
add_task(async function urlFieldVisibleForPopupPermissions(finish) {
await openPreferencesViaOpenPreferencesAPI("paneContent", null, {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();
});
add_task(async function urlFieldHiddenForNotificationPermissions() {
await openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true});
let win = gBrowser.selectedBrowser.contentWindow;
let doc = win.document;
let notificationsPolicyButton = doc.getElementById("notificationsPolicyButton");
ok(notificationsPolicyButton, "notificationsPolicyButton found");
let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL);
notificationsPolicyButton.click();
let dialog = await dialogPromise;
ok(dialog, "dialog loaded");
let urlLabel = dialog.document.getElementById("urlLabel");
ok(urlLabel.hidden, "urlLabel should be hidden as requested");
let url = dialog.document.getElementById("url");
ok(url.hidden, "url should be hidden as requested");
gBrowser.removeCurrentTab();
});