Bug 1929170 - Make mail/* pass commlint. r=john.bieling
Differential Revision: https://phabricator.services.mozilla.com/D227913 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
15a402b410
Коммит
0995879421
|
@ -347,7 +347,7 @@ var DOMLinkHandler = {
|
|||
var contentTabBaseType = {
|
||||
// List of URLs that will receive special treatment when opened in a tab.
|
||||
// Note that about:preferences is loaded via a different mechanism.
|
||||
inContentWhitelist: [
|
||||
inContentAllowList: [
|
||||
"about:addons",
|
||||
"about:addressbook",
|
||||
"about:blank",
|
||||
|
@ -357,7 +357,7 @@ var contentTabBaseType = {
|
|||
|
||||
// Code to run if a particular document is loaded in a tab.
|
||||
// The array members (functions) are for the respective document URLs
|
||||
// as specified in inContentWhitelist.
|
||||
// as specified in inContentAllowList.
|
||||
inContentOverlays: [
|
||||
// about:addons
|
||||
function (aDocument) {
|
||||
|
@ -480,10 +480,10 @@ var contentTabBaseType = {
|
|||
const url = doc.defaultView.location.href;
|
||||
|
||||
// If this document has an overlay defined, run it now.
|
||||
let ind = self.inContentWhitelist.indexOf(url);
|
||||
let ind = self.inContentAllowList.indexOf(url);
|
||||
if (ind < 0) {
|
||||
// Try a wildcard.
|
||||
ind = self.inContentWhitelist.indexOf(url.replace(/:.*/, ":*"));
|
||||
ind = self.inContentAllowList.indexOf(url.replace(/:.*/, ":*"));
|
||||
}
|
||||
if (ind >= 0) {
|
||||
const overlayFunction = self.inContentOverlays[ind];
|
||||
|
|
|
@ -236,7 +236,7 @@ junk=Junk
|
|||
# for junk score origin picker in search and mail views
|
||||
junkScoreOriginPlugin=Plugin
|
||||
junkScoreOriginFilter=Filter
|
||||
junkScoreOriginWhitelist=Whitelist
|
||||
junkScoreOriginAllowlist=Allowlist
|
||||
junkScoreOriginUser=User
|
||||
junkScoreOriginImapFlag=IMAP Flag
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ add_setup(function () {
|
|||
"pop3"
|
||||
);
|
||||
gAccount = MailServices.accounts.findAccountForServer(server);
|
||||
|
||||
gKeyString = "mail.server." + server.key + ".whiteListAbURI";
|
||||
registerCleanupFunction(function () {
|
||||
Services.prefs.clearUserPref(gKeyString);
|
||||
|
@ -34,12 +35,12 @@ add_setup(function () {
|
|||
|
||||
/**
|
||||
* First, test that when we initially load the account manager, that
|
||||
* we're not whitelisting any address books. Then, we'll check all
|
||||
* we're not allowing any address books. Then, we'll check all
|
||||
* address books and save.
|
||||
*
|
||||
* @param {object} tab - The account manager tab.
|
||||
*/
|
||||
async function subtest_check_whitelist_init_and_save(tab) {
|
||||
async function subtest_check_allowlist_init_and_save(tab) {
|
||||
// Ok, the advanced settings window is open. Let's choose
|
||||
// the junkmail settings.
|
||||
const accountRow = get_account_tree_row(gAccount.key, "am-junk.xhtml", tab);
|
||||
|
@ -73,12 +74,12 @@ async function subtest_check_whitelist_init_and_save(tab) {
|
|||
|
||||
/**
|
||||
* Next, we'll make sure that the address books we checked in
|
||||
* subtest_check_whitelist_init_and_save were properly saved.
|
||||
* subtest_check_allowlist_init_and_save were properly saved.
|
||||
* Then, we'll clear the address books and save.
|
||||
*
|
||||
* @param {object} tab - The account manager tab.
|
||||
*/
|
||||
async function subtest_check_whitelist_load_and_clear(tab) {
|
||||
async function subtest_check_allowlist_load_and_clear(tab) {
|
||||
const accountRow = get_account_tree_row(gAccount.key, "am-junk.xhtml", tab);
|
||||
await click_account_tree_row(tab, accountRow);
|
||||
|
||||
|
@ -86,14 +87,15 @@ async function subtest_check_whitelist_load_and_clear(tab) {
|
|||
tab.browser.contentWindow.document.getElementById(
|
||||
"contentFrame"
|
||||
).contentDocument;
|
||||
|
||||
const list = doc.getElementById("whiteListAbURI");
|
||||
const whiteListURIs = Services.prefs
|
||||
const allowListURIs = Services.prefs
|
||||
.getCharPref(gKeyString, "")
|
||||
.split(" ")
|
||||
.filter(Boolean);
|
||||
|
||||
Assert.greater(
|
||||
whiteListURIs.length,
|
||||
allowListURIs.length,
|
||||
0,
|
||||
`${gKeyString} pref should have uris`
|
||||
);
|
||||
|
@ -107,7 +109,7 @@ async function subtest_check_whitelist_load_and_clear(tab) {
|
|||
);
|
||||
// Also ensure that the address book URI was properly saved in the
|
||||
// prefs
|
||||
Assert.ok(whiteListURIs.includes(abNode.getAttribute("value")));
|
||||
Assert.ok(allowListURIs.includes(abNode.getAttribute("value")));
|
||||
// Now un-check that address book
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
abNode.firstElementChild,
|
||||
|
@ -124,7 +126,7 @@ async function subtest_check_whitelist_load_and_clear(tab) {
|
|||
*
|
||||
* @param {object} tab - The account manager tab.
|
||||
*/
|
||||
async function subtest_check_whitelist_load_cleared(tab) {
|
||||
async function subtest_check_allowlist_load_cleared(tab) {
|
||||
const accountRow = get_account_tree_row(gAccount.key, "am-junk.xhtml", tab);
|
||||
await click_account_tree_row(tab, accountRow);
|
||||
|
||||
|
@ -132,15 +134,16 @@ async function subtest_check_whitelist_load_cleared(tab) {
|
|||
tab.browser.contentWindow.document.getElementById(
|
||||
"contentFrame"
|
||||
).contentDocument;
|
||||
|
||||
const list = doc.getElementById("whiteListAbURI");
|
||||
let whiteListURIs = "";
|
||||
let allowListURIs = "";
|
||||
|
||||
try {
|
||||
whiteListURIs = Services.prefs.getCharPref(gKeyString);
|
||||
allowListURIs = Services.prefs.getCharPref(gKeyString);
|
||||
// We should have failed here, because the pref should have been cleared
|
||||
// out.
|
||||
throw Error(
|
||||
"The whitelist preference for this server wasn't properly cleared."
|
||||
"The allowlist preference for this server wasn't properly cleared."
|
||||
);
|
||||
} catch (e) {}
|
||||
|
||||
|
@ -153,12 +156,12 @@ async function subtest_check_whitelist_load_cleared(tab) {
|
|||
);
|
||||
// Also ensure that the address book URI was properly cleared in the
|
||||
// prefs
|
||||
Assert.ok(!whiteListURIs.includes(abNode.getAttribute("value")));
|
||||
Assert.ok(!allowListURIs.includes(abNode.getAttribute("value")));
|
||||
}
|
||||
}
|
||||
|
||||
add_task(async function test_address_book_whitelist() {
|
||||
await open_advanced_settings(subtest_check_whitelist_init_and_save);
|
||||
await open_advanced_settings(subtest_check_whitelist_load_and_clear);
|
||||
await open_advanced_settings(subtest_check_whitelist_load_cleared);
|
||||
add_task(async function test_address_book_allowlist() {
|
||||
await open_advanced_settings(subtest_check_allowlist_init_and_save);
|
||||
await open_advanced_settings(subtest_check_allowlist_load_and_clear);
|
||||
await open_advanced_settings(subtest_check_allowlist_load_cleared);
|
||||
});
|
||||
|
|
|
@ -641,10 +641,10 @@ add_task(async function test_generalContentPolicy() {
|
|||
await checkComposeWindow(TESTS[i], false, false);
|
||||
|
||||
if (TESTS[i].checkRemoteImg) {
|
||||
// Now check that image is visible after site is whitelisted.
|
||||
// Now check that image is visible after site is allowed.
|
||||
// Only want to do this for the test case which has the remote image.
|
||||
|
||||
// Add the site to the whitelist.
|
||||
// Add the site to the allow list.
|
||||
const messageDocument =
|
||||
get_about_message().getMessagePaneBrowser().contentDocument;
|
||||
const src = messageDocument.getElementById("testelement").src;
|
||||
|
|
|
@ -257,10 +257,10 @@ add_task(async function test_accounts_in_order() {
|
|||
var UNIQUE_ID = "3a9e1694-7115-4237-8b1e-1cabe6e35073";
|
||||
|
||||
/**
|
||||
* Test that a modified preference on the whitelist but not on the blacklist
|
||||
* Test that a modified preference on the allowlist but not on the disallowlist
|
||||
* shows up.
|
||||
*/
|
||||
add_task(async function test_modified_pref_on_whitelist() {
|
||||
add_task(async function test_modified_pref_on_allowlist() {
|
||||
const PREFIX = "accessibility.";
|
||||
const prefName = PREFIX + UNIQUE_ID;
|
||||
Services.prefs.setBoolPref(prefName, true);
|
||||
|
@ -272,9 +272,9 @@ add_task(async function test_modified_pref_on_whitelist() {
|
|||
});
|
||||
|
||||
/**
|
||||
* Test that a modified preference not on the whitelist doesn't show up.
|
||||
* Test that a modified preference not on the allowlist doesn't show up.
|
||||
*/
|
||||
add_task(async function test_modified_pref_not_on_whitelist() {
|
||||
add_task(async function test_modified_pref_not_on_allowlist() {
|
||||
Services.prefs.setBoolPref(UNIQUE_ID, true);
|
||||
const tab = await open_about_support();
|
||||
assert_content_tab_text_absent(tab, UNIQUE_ID);
|
||||
|
@ -283,9 +283,9 @@ add_task(async function test_modified_pref_not_on_whitelist() {
|
|||
});
|
||||
|
||||
/**
|
||||
* Test that a modified preference on the blacklist doesn't show up.
|
||||
* Test that a modified preference on the disallowlist doesn't show up.
|
||||
*/
|
||||
add_task(async function test_modified_pref_on_blacklist() {
|
||||
add_task(async function test_modified_pref_on_disallowlist() {
|
||||
const PREFIX = "network.proxy.";
|
||||
const prefName = PREFIX + UNIQUE_ID;
|
||||
Services.prefs.setBoolPref(prefName, true);
|
||||
|
|
|
@ -836,7 +836,7 @@
|
|||
{ stringId: "junkScoreOriginPlugin", value: "plugin" },
|
||||
{ stringId: "junkScoreOriginUser", value: "user" },
|
||||
{ stringId: "junkScoreOriginFilter", value: "filter" },
|
||||
{ stringId: "junkScoreOriginWhitelist", value: "whitelist" },
|
||||
{ stringId: "junkScoreOriginAllowlist", value: "allowlist" },
|
||||
{ stringId: "junkScoreOriginImapFlag", value: "imapflag" },
|
||||
]);
|
||||
break;
|
||||
|
|
|
@ -243,7 +243,7 @@ junk=Junk
|
|||
# for junk score origin picker in search and mail views
|
||||
junkScoreOriginPlugin=Plugin
|
||||
junkScoreOriginFilter=Filter
|
||||
junkScoreOriginWhitelist=Whitelist
|
||||
junkScoreOriginAllowlist=Allowlist
|
||||
junkScoreOriginUser=User
|
||||
junkScoreOriginImapFlag=IMAP Flag
|
||||
|
||||
|
|
|
@ -1207,7 +1207,7 @@
|
|||
class="search-value-menuitem"/>
|
||||
<xul:menuitem value="filter" stringTag="junkScoreOriginFilter"
|
||||
class="search-value-menuitem"/>
|
||||
<xul:menuitem value="whitelist" stringTag="junkScoreOriginWhitelist"
|
||||
<xul:menuitem value="allowlist" stringTag="junkScoreOriginAllowlist"
|
||||
class="search-value-menuitem"/>
|
||||
<xul:menuitem value="imapflag" stringTag="junkScoreOriginImapFlag"
|
||||
class="search-value-menuitem"/>
|
||||
|
|
|
@ -5,6 +5,7 @@ avoid-blacklist-and-whitelist:
|
|||
include: ['comm/']
|
||||
exclude:
|
||||
- comm/tools/lint/rejected-words.yml
|
||||
- comm/mail/test/browser/account/browser_abWhitelist.js
|
||||
type: external
|
||||
wrappedType: regex
|
||||
payload: commlint:lint_wrapper
|
||||
|
|
Загрузка…
Ссылка в новой задаче