summaryrefslogtreecommitdiffstats
path: root/application/palemoon/components/preferences/advanced.js
diff options
context:
space:
mode:
Diffstat (limited to 'application/palemoon/components/preferences/advanced.js')
-rw-r--r--application/palemoon/components/preferences/advanced.js21
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();