From 0a045ed95c1d0bc8bf032e239a2bd365a3ea284a Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 6 Jan 2017 08:20:16 +0100 Subject: [PATCH] Permissions: Notifications (+ follow up) - a comparison of differences --- browser/base/content/pageinfo/permissions.js | 6 ++-- .../preferences/aboutPermissions.js | 30 ++++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/browser/base/content/pageinfo/permissions.js b/browser/base/content/pageinfo/permissions.js index e37954df4b..99660275c6 100644 --- a/browser/base/content/pageinfo/permissions.js +++ b/browser/base/content/pageinfo/permissions.js @@ -154,9 +154,9 @@ function initRow(aPartId) var checkbox = document.getElementById(aPartId + "Def"); var command = document.getElementById("cmd_" + aPartId + "Toggle"); - // Geolocation and PointerLock permission consumers use testExactPermission, not testPermission. + // Desktop Notification, Geolocation and PointerLock permission consumers use testExactPermission, not testPermission. var perm; - if (aPartId == "geo" || aPartId == "pointerLock") + if (aPartId == "desktop-notification" || aPartId == "geo" || aPartId == "pointerLock") perm = permissionManager.testExactPermission(gPermURI, aPartId); else perm = permissionManager.testPermission(gPermURI, aPartId); @@ -343,7 +343,7 @@ function initPluginsRow() { let entries = [{name: item[1], permission: item[0]} for (item of permissionMap)]; entries.sort(function(a, b) { - return a.name < b.name ? -1 : (a.name == b.name ? 0 : 1); + return ((a.name < b.name) ? -1 : (a.name == b.name ? 0 : 1)); }); let permissionEntries = [ diff --git a/browser/components/preferences/aboutPermissions.js b/browser/components/preferences/aboutPermissions.js index 77433c75e5..0f7064fae7 100644 --- a/browser/components/preferences/aboutPermissions.js +++ b/browser/components/preferences/aboutPermissions.js @@ -39,7 +39,7 @@ let gVisitStmt = gPlacesDatabase.createAsyncStatement( * Permission types that should be tested with testExactPermission, as opposed * to testPermission. This is based on what consumers use to test these permissions. */ -let TEST_EXACT_PERM_TYPES = ["desktop-notification", "geo"]; +let TEST_EXACT_PERM_TYPES = ["desktop-notification", "geo", "pointerLock"]; /** * Site object represents a single site, uniquely identified by a host. @@ -456,8 +456,11 @@ let AboutPermissions = { */ _noGlobalDeny: [], - _stringBundle: Services.strings. - createBundle("chrome://browser/locale/preferences/aboutPermissions.properties"), + _stringBundleBrowser: Services.strings. + createBundle("chrome://browser/locale/browser.properties"), + + _stringBundleAboutPermissions: Services.strings. + createBundle("chrome://browser/locale/preferences/aboutPermissions.properties"), /** * Called on page load. @@ -977,7 +980,9 @@ let AboutPermissions = { let pluginPermissionEntry = document.getElementById(aType + "-entry"); if (pluginPermissionEntry.isBlocklisted()) { permissionMenulist.disabled = true; - permissionMenulist.setAttribute("tooltiptext", AboutPermissions._stringBundle.GetStringFromName("pluginBlocklisted")); + permissionMenulist.setAttribute("tooltiptext", + AboutPermissions._stringBundleAboutPermissions + .GetStringFromName("pluginBlocklisted")); } else { permissionMenulist.disabled = false; permissionMenulist.removeAttribute("tooltiptext"); @@ -991,6 +996,14 @@ let AboutPermissions = { document.getElementById(aType + "-9").hidden = false; } else if (aType.startsWith("plugin")) { document.getElementById(aType + "-0").disabled = false; + let pluginPermissionEntry = document.getElementById(aType + "-entry"); + let permString = pluginPermissionEntry.getAttribute("permString"); + let name = pluginPermissionEntry.getAttribute("label"); + if (permString.startsWith("plugin-vulnerable:")) { + name += " \u2014 " + AboutPermissions._stringBundleBrowser + .GetStringFromName("pluginActivateVulnerable.label"); + pluginPermissionEntry.setAttribute("label", name); + } } let result = {}; permissionValue = this._selectedSite.getPermission(aType, result) ? @@ -1056,7 +1069,8 @@ let AboutPermissions = { updateVisitCount: function() { this._selectedSite.getVisitCount(function(aCount) { - let visitForm = AboutPermissions._stringBundle.GetStringFromName("visitCount"); + let visitForm = AboutPermissions._stringBundleAboutPermissions + .GetStringFromName("visitCount"); let visitLabel = PluralForm.get(aCount, visitForm) .replace("#1", aCount); document.getElementById("site-visit-count").value = visitLabel; @@ -1071,7 +1085,8 @@ let AboutPermissions = { } let passwordsCount = this._selectedSite.logins.length; - let passwordsForm = this._stringBundle.GetStringFromName("passwordsCount"); + let passwordsForm = this._stringBundleAboutPermissions + .GetStringFromName("passwordsCount"); let passwordsLabel = PluralForm.get(passwordsCount, passwordsForm) .replace("#1", passwordsCount); @@ -1109,7 +1124,8 @@ let AboutPermissions = { } let cookiesCount = this._selectedSite.cookies.length; - let cookiesForm = this._stringBundle.GetStringFromName("cookiesCount"); + let cookiesForm = this._stringBundleAboutPermissions + .GetStringFromName("cookiesCount"); let cookiesLabel = PluralForm.get(cookiesCount, cookiesForm) .replace("#1", cookiesCount);