mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-23 23:57:31 +09:00
[PALEMOON] "Page Info" - "Permissions": Quota Manager => Quota Manager Service
Issue #112
This commit is contained in:
parent
23dfb5f92e
commit
f96ddd6e75
2 changed files with 17 additions and 10 deletions
|
|
@ -359,7 +359,7 @@ function loadPageInfo()
|
||||||
makeTabs(gDocument, gWindow);
|
makeTabs(gDocument, gWindow);
|
||||||
|
|
||||||
initFeedTab();
|
initFeedTab();
|
||||||
onLoadPermission();
|
onLoadPermission(gDocument.nodePrincipal);
|
||||||
|
|
||||||
/* Call registered overlay init functions */
|
/* Call registered overlay init functions */
|
||||||
onLoadRegistry.forEach(function(func) { func(); });
|
onLoadRegistry.forEach(function(func) { func(); });
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,10 @@ const IMAGE_DENY = 2;
|
||||||
const COOKIE_DENY = 2;
|
const COOKIE_DENY = 2;
|
||||||
const COOKIE_SESSION = 2;
|
const COOKIE_SESSION = 2;
|
||||||
|
|
||||||
const nsIQuotaManager = Components.interfaces.nsIQuotaManager;
|
const nsIQuotaManagerService = Components.interfaces.nsIQuotaManagerService;
|
||||||
|
|
||||||
var gPermURI;
|
var gPermURI;
|
||||||
|
var gPermPrincipal;
|
||||||
var gPrefs;
|
var gPrefs;
|
||||||
var gUsageRequest;
|
var gUsageRequest;
|
||||||
|
|
||||||
|
|
@ -107,7 +108,7 @@ var permissionObserver = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function onLoadPermission()
|
function onLoadPermission(principal)
|
||||||
{
|
{
|
||||||
gPrefs = Components.classes[PREFERENCES_CONTRACTID]
|
gPrefs = Components.classes[PREFERENCES_CONTRACTID]
|
||||||
.getService(Components.interfaces.nsIPrefBranch);
|
.getService(Components.interfaces.nsIPrefBranch);
|
||||||
|
|
@ -116,6 +117,7 @@ function onLoadPermission()
|
||||||
var permTab = document.getElementById("permTab");
|
var permTab = document.getElementById("permTab");
|
||||||
if (/^https?$/.test(uri.scheme)) {
|
if (/^https?$/.test(uri.scheme)) {
|
||||||
gPermURI = uri;
|
gPermURI = uri;
|
||||||
|
gPermPrincipal = principal;
|
||||||
var hostText = document.getElementById("hostText");
|
var hostText = document.getElementById("hostText");
|
||||||
hostText.value = gPermURI.host;
|
hostText.value = gPermURI.host;
|
||||||
|
|
||||||
|
|
@ -230,10 +232,13 @@ function initIndexedDBRow()
|
||||||
|
|
||||||
row.appendChild(extras);
|
row.appendChild(extras);
|
||||||
|
|
||||||
var quotaManager = Components.classes["@mozilla.org/dom/quota/manager;1"]
|
var quotaManagerService =
|
||||||
.getService(nsIQuotaManager);
|
Components.classes["@mozilla.org/dom/quota-manager-service;1"]
|
||||||
|
.getService(nsIQuotaManagerService);
|
||||||
|
|
||||||
gUsageRequest =
|
gUsageRequest =
|
||||||
quotaManager.getUsageForURI(gPermURI, onIndexedDBUsageCallback);
|
quotaManagerService.getUsageForPrincipal(gPermPrincipal,
|
||||||
|
onIndexedDBUsageCallback);
|
||||||
|
|
||||||
var status = document.getElementById("indexedDBStatus");
|
var status = document.getElementById("indexedDBStatus");
|
||||||
var button = document.getElementById("indexedDBClear");
|
var button = document.getElementById("indexedDBClear");
|
||||||
|
|
@ -245,9 +250,9 @@ function initIndexedDBRow()
|
||||||
|
|
||||||
function onIndexedDBClear()
|
function onIndexedDBClear()
|
||||||
{
|
{
|
||||||
Components.classes["@mozilla.org/dom/quota/manager;1"]
|
Components.classes["@mozilla.org/dom/quota-manager-service;1"]
|
||||||
.getService(nsIQuotaManager)
|
.getService(nsIQuotaManagerService)
|
||||||
.clearStoragesForURI(gPermURI);
|
.clearStoragesForPrincipal(gPermPrincipal);
|
||||||
|
|
||||||
var permissionManager = Components.classes[PERMISSION_CONTRACTID]
|
var permissionManager = Components.classes[PERMISSION_CONTRACTID]
|
||||||
.getService(nsIPermissionManager);
|
.getService(nsIPermissionManager);
|
||||||
|
|
@ -255,12 +260,14 @@ function onIndexedDBClear()
|
||||||
initIndexedDBRow();
|
initIndexedDBRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onIndexedDBUsageCallback(uri, usage, fileUsage)
|
function onIndexedDBUsageCallback(request)
|
||||||
{
|
{
|
||||||
|
let uri = request.principal.URI;
|
||||||
if (!uri.equals(gPermURI)) {
|
if (!uri.equals(gPermURI)) {
|
||||||
throw new Error("Callback received for bad URI: " + uri);
|
throw new Error("Callback received for bad URI: " + uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let usage = request.result.usage;
|
||||||
if (usage) {
|
if (usage) {
|
||||||
if (!("DownloadUtils" in window)) {
|
if (!("DownloadUtils" in window)) {
|
||||||
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
|
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue