Bug 1334411 - Remove the UI for indexedDB in Page Info and Permissions Manager

This commit is contained in:
janekptacijarabaci 2018-07-02 21:20:26 +02:00 • committed by Roy Tam
commit ef547d4967
18 changed files with 6 additions and 251 deletions

View file

@ -53,7 +53,6 @@
<command id="cmd_desktop-notificationDef" oncommand="onCheckboxClick('desktop-notification');"/>
<command id="cmd_installDef" oncommand="onCheckboxClick('install');"/>
<command id="cmd_geoDef" oncommand="onCheckboxClick('geo');"/>
<command id="cmd_indexedDBDef" oncommand="onCheckboxClick('indexedDB');"/>
<command id="cmd_pluginsDef" oncommand="onCheckboxClick('plugins');"/>
<command id="cmd_imageToggle" oncommand="onRadioClick('image');"/>
<command id="cmd_popupToggle" oncommand="onRadioClick('popup');"/>
@ -61,7 +60,6 @@
<command id="cmd_desktop-notificationToggle" oncommand="onRadioClick('desktop-notification');"/>
<command id="cmd_installToggle" oncommand="onRadioClick('install');"/>
<command id="cmd_geoToggle" oncommand="onRadioClick('geo');"/>
<command id="cmd_indexedDBToggle" oncommand="onRadioClick('indexedDB');"/>
<command id="cmd_pluginsToggle" oncommand="onPluginRadioClick(event);"/>
</commandset>
@ -366,27 +364,6 @@
</radiogroup>
</hbox>
</vbox>
<vbox class="permission" id="permIndexedDBRow">
<label class="permissionLabel" id="permIndexedDBLabel"
value="&permIndexedDB;" control="indexedDBRadioGroup"/>
<hbox id="permIndexedDBBox" role="group" aria-labelledby="permIndexedDBLabel">
<checkbox id="indexedDBDef" command="cmd_indexedDBDef" label="&permUseDefault;"/>
<spacer flex="1"/>
<radiogroup id="indexedDBRadioGroup" orient="horizontal">
<radio id="indexedDB#0" command="cmd_indexedDBToggle" label="&permAskAlways;"/>
<radio id="indexedDB#1" command="cmd_indexedDBToggle" label="&permAllow;"/>
<radio id="indexedDB#2" command="cmd_indexedDBToggle" label="&permBlock;"/>
</radiogroup>
</hbox>
<hbox id="permIndexedDBExtras">
<spacer flex="1"/>
<vbox id="permIndexedDBStatusBox" pack="center">
<label id="indexedDBStatus" control="indexedDBClear" hidden="true"/>
</vbox>
<button id="indexedDBClear" label="&permClearStorage;" hidden="true"
accesskey="&permClearStorage.accesskey;" onclick="onIndexedDBClear();"/>
</hbox>
</vbox>
<vbox class="permission" id="permPluginsRow">
<label class="permissionLabel" id="permPluginsLabel"
value="&permPlugins;" control="pluginsRadioGroup"/>

View file

@ -12,8 +12,6 @@ const IMAGE_DENY = 2;
const COOKIE_DENY = 2;
const COOKIE_SESSION = 2;
const nsIQuotaManagerService = Components.interfaces.nsIQuotaManagerService;
var gPermURI;
var gPermPrincipal;
var gPrefs;
@ -65,13 +63,6 @@ var gPermObj = {
}
return ALLOW;
},
indexedDB: function getIndexedDBDefaultPermissions()
{
if (!gPrefs.getBoolPref("dom.indexedDB.enabled")) {
return DENY;
}
return UNKNOWN;
},
plugins: function getPluginsDefaultPermissions()
{
return UNKNOWN;
@ -161,10 +152,6 @@ function initRow(aPartId)
perm = gPermObj[aPartId]();
}
setRadioState(aPartId, perm);
if (aPartId == "indexedDB") {
initIndexedDBRow();
}
}
function onCheckboxClick(aPartId)
@ -211,65 +198,6 @@ function setRadioState(aPartId, aValue)
radio.radioGroup.selectedItem = radio;
}
function initIndexedDBRow()
{
let row = document.getElementById("permIndexedDBRow");
let extras = document.getElementById("permIndexedDBExtras");
row.appendChild(extras);
var quotaManagerService =
Components.classes["@mozilla.org/dom/quota-manager-service;1"]
.getService(nsIQuotaManagerService);
gUsageRequest =
quotaManagerService.getUsageForPrincipal(gPermPrincipal,
onIndexedDBUsageCallback);
var status = document.getElementById("indexedDBStatus");
var button = document.getElementById("indexedDBClear");
status.value = "";
status.setAttribute("hidden", "true");
button.setAttribute("hidden", "true");
}
function onIndexedDBClear()
{
Components.classes["@mozilla.org/dom/quota-manager-service;1"]
.getService(nsIQuotaManagerService)
.clearStoragesForPrincipal(gPermPrincipal);
var permissionManager = Components.classes[PERMISSION_CONTRACTID]
.getService(nsIPermissionManager);
permissionManager.remove(gPermURI, "indexedDB");
initIndexedDBRow();
}
function onIndexedDBUsageCallback(request)
{
let uri = request.principal.URI;
if (!uri.equals(gPermURI)) {
throw new Error("Callback received for bad URI: " + uri.spec);
}
let usage = request.result.usage;
if (usage) {
if (!("DownloadUtils" in window)) {
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
}
var status = document.getElementById("indexedDBStatus");
var button = document.getElementById("indexedDBClear");
status.value =
gBundle.getFormattedString("indexedDBUsage",
DownloadUtils.convertByteUnits(usage));
status.removeAttribute("hidden");
button.removeAttribute("hidden");
}
}
// XXX copied this from browser-plugins.js - is there a way to share?
function makeNicePluginName(aName) {
if (aName == "Shockwave Flash")

View file

@ -130,7 +130,7 @@ Site.prototype = {
*
* @param aType
* The permission type string stored in permission manager.
* e.g. "cookie", "geo", "indexedDB", "popup", "image"
* e.g. "cookie", "geo", "popup", "image"
* @param aResultObj
* An object that stores the permission value set for aType.
*
@ -169,7 +169,7 @@ Site.prototype = {
*
* @param aType
* The permission type string stored in permission manager.
* e.g. "cookie", "geo", "indexedDB", "popup", "image"
* e.g. "cookie", "geo", "popup", "image"
* @param aPerm
* The permission value to set for the permission type. This should
* be one of the constants defined in nsIPermissionManager.
@ -196,7 +196,7 @@ Site.prototype = {
*
* @param aType
* The permission type string stored in permission manager.
* e.g. "cookie", "geo", "indexedDB", "popup", "image"
* e.g. "cookie", "geo", "popup", "image"
*/
clearPermission: function(aType) {
Services.perms.removeFromPrincipal(this.principal, aType);
@ -405,20 +405,6 @@ var PermissionDefaults = {
let value = (aValue != this.DENY);
Services.prefs.setBoolPref("geo.enabled", value);
},
get indexedDB() {
if (!Services.prefs.getBoolPref("dom.indexedDB.enabled")) {
return this.DENY;
}
// We always ask for permission to enable indexedDB storage for a specific
// site, so there is no global ALLOW.
return this.UNKNOWN;
},
set indexedDB(aValue) {
let value = (aValue != this.DENY);
Services.prefs.setBoolPref("dom.indexedDB.enabled", value);
},
}
/**
@ -465,12 +451,12 @@ var AboutPermissions = {
* Potential future additions: "sts/use", "sts/subd"
*/
_supportedPermissions: ["password", "image", "popup", "cookie",
"desktop-notification", "install", "geo", "indexedDB"],
"desktop-notification", "install", "geo"],
/**
* Permissions that don't have a global "Allow" option.
*/
_noGlobalAllow: ["desktop-notification", "geo", "indexedDB"],
_noGlobalAllow: ["desktop-notification", "geo"],
/**
* Permissions that don't have a global "Deny" option.
@ -515,7 +501,6 @@ var AboutPermissions = {
Services.prefs.addObserver("dom.webnotifications.enabled", this, false);
Services.prefs.addObserver("xpinstall.whitelist.required", this, false);
Services.prefs.addObserver("geo.enabled", this, false);
Services.prefs.addObserver("dom.indexedDB.enabled", this, false);
Services.prefs.addObserver("plugins.click_to_play", this, false);
Services.prefs.addObserver("permissions.places-sites-limit", this, false);
@ -665,7 +650,6 @@ var AboutPermissions = {
Services.prefs.removeObserver("dom.webnotifications.enabled", this, false);
Services.prefs.removeObserver("xpinstall.whitelist.required", this, false);
Services.prefs.removeObserver("geo.enabled", this, false);
Services.prefs.removeObserver("dom.indexedDB.enabled", this, false);
Services.prefs.removeObserver("plugins.click_to_play", this, false);
Services.prefs.removeObserver("permissions.places-sites-limit", this, false);
@ -1030,7 +1014,7 @@ var AboutPermissions = {
*
* @param aType
* The permission type string stored in permission manager.
* e.g. "cookie", "geo", "indexedDB", "popup", "image"
* e.g. "cookie", "geo", "popup", "image"
*/
updatePermission: function(aType) {
let allowItem = document.getElementById(

View file

@ -298,35 +298,6 @@
</vbox>
</hbox>
<!-- IndexedDB Storage -->
<hbox id="indexedDB-pref-item"
class="pref-item" align="top">
<image class="pref-icon" type="indexedDB"/>
<vbox>
<hbox>
<label class="pref-title" value="&indexedDB.label;"/>
<label id="indexedDB-default" class="pref-default" value="*"/>
</hbox>
<hbox>
<menulist id="indexedDB-menulist"
class="pref-menulist"
type="indexedDB"
oncommand="AboutPermissions.onPermissionCommand(event, false);">
<menupopup>
<menuitem id="indexedDB-0" value="0" label="&permission.alwaysAsk;"/>
<menuitem id="indexedDB-1" value="1" label="&permission.allow;"/>
<menuitem id="indexedDB-2" value="2" label="&permission.block;"/>
</menupopup>
</menulist>
<button id="indexedDB-set-default"
class="pref-set-default"
label="&permission.default;"
type="indexedDB"
oncommand="AboutPermissions.onPermissionCommand(event, true);"/>
</hbox>
</vbox>
</hbox>
<!-- Opt-in activation of Plug-ins -->
<hbox id="plugins-pref-item"
class="pref-item" align="top">

View file

@ -67,10 +67,6 @@
<!ENTITY permGeo "Share Location">
<!ENTITY permPlugins "Activate Plugins">
<!ENTITY permIndexedDB "Maintain Offline Storage">
<!ENTITY permClearStorage "Clear Storage">
<!ENTITY permClearStorage.accesskey "C">
<!ENTITY securityTab "Security">
<!ENTITY securityTab.accesskey "S">
<!ENTITY securityHeader "Security information for this page">

View file

@ -45,10 +45,6 @@
<!ENTITY plugins.label "Plugins">
<!-- LOCALIZATION NOTE (indexedDB.label): This is describing indexedDB storage
using the same language used for the permIndexedDB string in browser/pageInfo.dtd -->
<!ENTITY indexedDB.label "Maintain Offline Storage">
<!ENTITY popup.label "Open Pop-up Windows">
<!ENTITY focusSearch.key "f">

View file

@ -98,9 +98,6 @@
.pref-icon[type="geo"] {
list-style-image: url(chrome://browser/skin/Geolocation-64.png);
}
.pref-icon[type="indexedDB"] {
list-style-image: url(chrome://global/skin/icons/question-64.png);
}
.pref-icon[type="plugins"] {
list-style-image: url(chrome://mozapps/skin/plugins/pluginGeneric.png);
}

View file

@ -101,9 +101,6 @@
.pref-icon[type="geo"] {
list-style-image: url(chrome://browser/skin/Geolocation-64.png);
}
.pref-icon[type="indexedDB"] {
list-style-image: url(chrome://global/skin/icons/question-64.png);
}
.pref-icon[type="plugins"] {
list-style-image: url(chrome://mozapps/skin/plugins/pluginGeneric.png);
}

View file

@ -101,9 +101,6 @@
.pref-icon[type="geo"] {
list-style-image: url(chrome://browser/skin/Geolocation-64.png);
}
.pref-icon[type="indexedDB"] {
list-style-image: url(chrome://global/skin/icons/question-48.png);
}
.pref-icon[type="plugins"] {
list-style-image: url(chrome://mozapps/skin/plugins/pluginGeneric-48.png);
}