mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1206102 - Make the TP list names more flexible from a l10n standpoint. r=paolo f=flod
This commit is contained in:
parent
82e16df980
commit
343faa19a9
@ -5,8 +5,8 @@
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
const TEST_LIST = "test-track-simple";
|
||||
const TRACK_SUFFIX = "-track-digest256";
|
||||
const NAME_SUFFIX = ".name";
|
||||
const TRACKING_TABLE_PREF = "urlclassifier.trackingTable";
|
||||
const LISTS_PREF_BRANCH = "browser.safebrowsing.provider.mozilla.lists.";
|
||||
|
||||
let gBlocklistManager = {
|
||||
_type: "",
|
||||
@ -22,7 +22,11 @@ let gBlocklistManager = {
|
||||
},
|
||||
getCellText: function (row, column) {
|
||||
if (column.id == "listCol") {
|
||||
return gBlocklistManager._blockLists[row].name;
|
||||
let list = gBlocklistManager._blockLists[row];
|
||||
let desc = list.description ? list.description : "";
|
||||
let text = gBlocklistManager._bundle.getFormattedString("mozNameTemplate",
|
||||
[list.name, desc]);
|
||||
return text;
|
||||
}
|
||||
return "";
|
||||
},
|
||||
@ -144,22 +148,12 @@ let gBlocklistManager = {
|
||||
_loadBlockLists: function () {
|
||||
this._blockLists = [];
|
||||
|
||||
// Get the active block list.
|
||||
let activeList = this._getActiveList();
|
||||
|
||||
// Load blocklists into a table.
|
||||
let branch = Services.prefs.getBranch("browser.safebrowsing.provider.mozilla.lists.");
|
||||
let branch = Services.prefs.getBranch(LISTS_PREF_BRANCH);
|
||||
let itemArray = branch.getChildList("");
|
||||
for (let itemName of itemArray) {
|
||||
if (!itemName.endsWith(NAME_SUFFIX)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
let nameKey = branch.getCharPref(itemName);
|
||||
let name = this._bundle.getString(nameKey);
|
||||
let id = itemName.replace(NAME_SUFFIX, "");
|
||||
let selected = activeList === id;
|
||||
this._blockLists.push({ name, id, selected });
|
||||
this._createOrUpdateBlockList(itemName);
|
||||
} catch (e) {
|
||||
// Ignore bogus or missing list name.
|
||||
continue;
|
||||
@ -169,6 +163,27 @@ let gBlocklistManager = {
|
||||
this._updateTree();
|
||||
},
|
||||
|
||||
_createOrUpdateBlockList: function (itemName) {
|
||||
let branch = Services.prefs.getBranch(LISTS_PREF_BRANCH);
|
||||
let key = branch.getCharPref(itemName);
|
||||
let value = this._bundle.getString(key);
|
||||
|
||||
let suffix = itemName.slice(itemName.lastIndexOf("."));
|
||||
let id = itemName.replace(suffix, "");
|
||||
let list = this._blockLists.find(el => el.id === id);
|
||||
if (!list) {
|
||||
list = { id };
|
||||
this._blockLists.push(list);
|
||||
}
|
||||
list.selected = this._getActiveList() === id;
|
||||
|
||||
// Get the property name from the suffix (e.g. ".name" -> "name").
|
||||
let prop = suffix.slice(1);
|
||||
list[prop] = value;
|
||||
|
||||
return list;
|
||||
},
|
||||
|
||||
_updateTree: function () {
|
||||
this._tree = document.getElementById("blocklistsTree");
|
||||
this._view._rowCount = this._blockLists.length;
|
||||
|
@ -32,10 +32,20 @@ invalidURITitle=Invalid Hostname Entered
|
||||
|
||||
blockliststext=You can choose which list Firefox will use to block Web elements that may track your browsing activity.
|
||||
blockliststitle=Block Lists
|
||||
# LOCALIZATION NOTE (mozNameTemplate): This template constructs the name of the
|
||||
# block list in the block lists dialog. It combines the list name and
|
||||
# description.
|
||||
# e.g. mozNameTemplate : "Standard (Recommended). This list does a pretty good job."
|
||||
# %1$S = list name (fooName), %2$S = list descriptive text (fooDesc)
|
||||
mozNameTemplate=%1$S %2$S
|
||||
# LOCALIZATION NOTE (mozstdName, etc.): These labels appear in the tracking
|
||||
# protection block lists dialog. They are the names of the block lists.
|
||||
mozstdName=Disconnect.me basic protection (Recommended). Allows some trackers so websites function properly.
|
||||
mozfullName=Disconnect.me strict protection. Blocks known trackers. Some sites may not function properly.
|
||||
# protection block lists dialog, mozNameTemplate is used to create the final
|
||||
# string. Note that in the future these two strings (name, desc) could be
|
||||
# displayed on two different lines.
|
||||
mozstdName=Disconnect.me basic protection (Recommended).
|
||||
mozstdDesc=Allows some trackers so websites function properly.
|
||||
mozfullName=Disconnect.me strict protection.
|
||||
mozfullDesc=Blocks known trackers. Some sites may not function properly.
|
||||
# LOCALIZATION NOTE (blocklistChangeRequiresRestart, restartTitle): %S = brandShortName
|
||||
blocklistChangeRequiresRestart=%S must restart to change block lists.
|
||||
shouldRestartTitle=Restart %S
|
||||
|
@ -4780,7 +4780,9 @@ pref("browser.safebrowsing.provider.mozilla.gethashURL", "https://shavar.service
|
||||
// Block lists for tracking protection. The name values will be used as the keys
|
||||
// to lookup the localized name in preferences.properties.
|
||||
pref("browser.safebrowsing.provider.mozilla.lists.mozstd.name", "mozstdName");
|
||||
pref("browser.safebrowsing.provider.mozilla.lists.mozstd.description", "mozstdDesc");
|
||||
pref("browser.safebrowsing.provider.mozilla.lists.mozfull.name", "mozfullName");
|
||||
pref("browser.safebrowsing.provider.mozilla.lists.mozfull.description", "mozfullDesc");
|
||||
|
||||
// Turn off Spatial navigation by default.
|
||||
pref("snav.enabled", false);
|
||||
|
Loading…
Reference in New Issue
Block a user