diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-26 07:16:10 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-26 07:16:10 +0200 |
commit | eebf4162a992bd0cc70f9c58bbb6e543b0438c89 (patch) | |
tree | 1ce6d6fbcf5ff3cc49b0a0943d96b2e5766dc5cb /application/palemoon/components/preferences/advanced.js | |
parent | 49ba38d216ec1a1f73d0368e4942bfd6bed9e52e (diff) | |
download | UXP-eebf4162a992bd0cc70f9c58bbb6e543b0438c89.tar UXP-eebf4162a992bd0cc70f9c58bbb6e543b0438c89.tar.gz UXP-eebf4162a992bd0cc70f9c58bbb6e543b0438c89.tar.lz UXP-eebf4162a992bd0cc70f9c58bbb6e543b0438c89.tar.xz UXP-eebf4162a992bd0cc70f9c58bbb6e543b0438c89.zip |
Bug 1170200 - Part 2: Update JavaScript consumers of nsIPermissionManager::Remove
Diffstat (limited to 'application/palemoon/components/preferences/advanced.js')
-rw-r--r-- | application/palemoon/components/preferences/advanced.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/application/palemoon/components/preferences/advanced.js b/application/palemoon/components/preferences/advanced.js index 429a0c419..902a0e3a8 100644 --- a/application/palemoon/components/preferences/advanced.js +++ b/application/palemoon/components/preferences/advanced.js @@ -377,7 +377,7 @@ var gAdvancedPane = { }, // XXX: duplicated in browser.js - _getOfflineAppUsage: function (host, groups) + _getOfflineAppUsage: function (perm, groups) { var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"]. getService(Components.interfaces.nsIApplicationCacheService); @@ -390,7 +390,7 @@ var gAdvancedPane = { var usage = 0; for (var i = 0; i < groups.length; i++) { var uri = ios.newURI(groups[i], null, null); - if (uri.asciiHost == host) { + if (uri.asciiHost == perm.host) { var cache = cacheService.getActiveCache(groups[i]); usage += cache.usage; } @@ -429,7 +429,7 @@ var gAdvancedPane = { row.className = "offlineapp"; row.setAttribute("host", perm.host); var converted = DownloadUtils. - convertByteUnits(this._getOfflineAppUsage(perm.host, groups)); + convertByteUnits(this._getOfflineAppUsage(perm, groups)); row.setAttribute("usage", bundle.getFormattedString("offlineAppUsage", converted)); @@ -476,7 +476,7 @@ var gAdvancedPane = { getService(Components.interfaces.nsIIOService); var groups = cacheService.getGroups(); for (var i = 0; i < groups.length; i++) { - var uri = ios.newURI(groups[i], null, null); + let uri = ios.newURI(groups[i], null, null); if (uri.asciiHost == host) { var cache = cacheService.getActiveCache(groups[i]); cache.discard(); @@ -486,10 +486,15 @@ var gAdvancedPane = { // remove the permission var pm = Components.classes["@mozilla.org/permissionmanager;1"] .getService(Components.interfaces.nsIPermissionManager); - pm.remove(host, "offline-app", - Components.interfaces.nsIPermissionManager.ALLOW_ACTION); - pm.remove(host, "offline-app", - Components.interfaces.nsIOfflineCacheUpdateService.ALLOW_NO_WARN); + let uri; + try { + // file:// URIs are stored with their scheme. We try to parse them first, as + // URIs like http://file:///foo/bar/baz.html will parse as HTTP URIs. + uri = ios.newURI(host, null, null); + } catch (e) { + uri = ios.newURI("http://" + host, null, null); + } + pm.remove(uri, "offline-app"); list.removeChild(item); gAdvancedPane.offlineAppSelected(); |