diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-10 20:28:06 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-10 20:28:06 +0200 |
commit | 9929aa7775f4ecee082c31cdd07a26992dba809f (patch) | |
tree | 8de38f7d05d8dee9a72f7e0ebc4fde734cf7d613 | |
parent | f858398f2f1387f95b718309c46d3a9eed30d9ae (diff) | |
download | UXP-9929aa7775f4ecee082c31cdd07a26992dba809f.tar UXP-9929aa7775f4ecee082c31cdd07a26992dba809f.tar.gz UXP-9929aa7775f4ecee082c31cdd07a26992dba809f.tar.lz UXP-9929aa7775f4ecee082c31cdd07a26992dba809f.tar.xz UXP-9929aa7775f4ecee082c31cdd07a26992dba809f.zip |
[PALEMOON] "Page Info" - "Permissions": Quota Manager => Quota Manager Service
Issue #112
-rw-r--r-- | application/palemoon/base/content/pageinfo/pageInfo.js | 2 | ||||
-rw-r--r-- | application/palemoon/base/content/pageinfo/permissions.js | 25 |
2 files changed, 17 insertions, 10 deletions
diff --git a/application/palemoon/base/content/pageinfo/pageInfo.js b/application/palemoon/base/content/pageinfo/pageInfo.js index f91a607af..83f0ddb91 100644 --- a/application/palemoon/base/content/pageinfo/pageInfo.js +++ b/application/palemoon/base/content/pageinfo/pageInfo.js @@ -359,7 +359,7 @@ function loadPageInfo() makeTabs(gDocument, gWindow); initFeedTab(); - onLoadPermission(); + onLoadPermission(gDocument.nodePrincipal); /* Call registered overlay init functions */ onLoadRegistry.forEach(function(func) { func(); }); diff --git a/application/palemoon/base/content/pageinfo/permissions.js b/application/palemoon/base/content/pageinfo/permissions.js index 81ff63f34..a4f7d5188 100644 --- a/application/palemoon/base/content/pageinfo/permissions.js +++ b/application/palemoon/base/content/pageinfo/permissions.js @@ -12,9 +12,10 @@ const IMAGE_DENY = 2; const COOKIE_DENY = 2; const COOKIE_SESSION = 2; -const nsIQuotaManager = Components.interfaces.nsIQuotaManager; +const nsIQuotaManagerService = Components.interfaces.nsIQuotaManagerService; var gPermURI; +var gPermPrincipal; var gPrefs; var gUsageRequest; @@ -107,7 +108,7 @@ var permissionObserver = { } }; -function onLoadPermission() +function onLoadPermission(principal) { gPrefs = Components.classes[PREFERENCES_CONTRACTID] .getService(Components.interfaces.nsIPrefBranch); @@ -116,6 +117,7 @@ function onLoadPermission() var permTab = document.getElementById("permTab"); if (/^https?$/.test(uri.scheme)) { gPermURI = uri; + gPermPrincipal = principal; var hostText = document.getElementById("hostText"); hostText.value = gPermURI.host; @@ -230,10 +232,13 @@ function initIndexedDBRow() row.appendChild(extras); - var quotaManager = Components.classes["@mozilla.org/dom/quota/manager;1"] - .getService(nsIQuotaManager); + var quotaManagerService = + Components.classes["@mozilla.org/dom/quota-manager-service;1"] + .getService(nsIQuotaManagerService); + gUsageRequest = - quotaManager.getUsageForURI(gPermURI, onIndexedDBUsageCallback); + quotaManagerService.getUsageForPrincipal(gPermPrincipal, + onIndexedDBUsageCallback); var status = document.getElementById("indexedDBStatus"); var button = document.getElementById("indexedDBClear"); @@ -245,9 +250,9 @@ function initIndexedDBRow() function onIndexedDBClear() { - Components.classes["@mozilla.org/dom/quota/manager;1"] - .getService(nsIQuotaManager) - .clearStoragesForURI(gPermURI); + Components.classes["@mozilla.org/dom/quota-manager-service;1"] + .getService(nsIQuotaManagerService) + .clearStoragesForPrincipal(gPermPrincipal); var permissionManager = Components.classes[PERMISSION_CONTRACTID] .getService(nsIPermissionManager); @@ -255,12 +260,14 @@ function onIndexedDBClear() initIndexedDBRow(); } -function onIndexedDBUsageCallback(uri, usage, fileUsage) +function onIndexedDBUsageCallback(request) { + let uri = request.principal.URI; if (!uri.equals(gPermURI)) { throw new Error("Callback received for bad URI: " + uri); } + let usage = request.result.usage; if (usage) { if (!("DownloadUtils" in window)) { Components.utils.import("resource://gre/modules/DownloadUtils.jsm"); |