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 | |
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')
4 files changed, 17 insertions, 12 deletions
diff --git a/application/palemoon/base/content/browser-fullScreen.js b/application/palemoon/base/content/browser-fullScreen.js index 400340e77..73b10ae85 100644 --- a/application/palemoon/base/content/browser-fullScreen.js +++ b/application/palemoon/base/content/browser-fullScreen.js @@ -354,11 +354,10 @@ var FullScreen = { "fullscreen", Services.perms.ALLOW_ACTION, Services.perms.EXPIRE_SESSION); - let host = uri.host; var onFullscreenchange = function onFullscreenchange(event) { if (event.target == document && document.mozFullScreenElement == null) { // The chrome document has left fullscreen. Remove the temporary permission grant. - Services.perms.remove(host, "fullscreen"); + Services.perms.remove(uri, "fullscreen"); document.removeEventListener("mozfullscreenchange", onFullscreenchange); } } diff --git a/application/palemoon/components/preferences/aboutPermissions.js b/application/palemoon/components/preferences/aboutPermissions.js index 73d51909b..484758148 100644 --- a/application/palemoon/components/preferences/aboutPermissions.js +++ b/application/palemoon/components/preferences/aboutPermissions.js @@ -205,7 +205,7 @@ Site.prototype = { * e.g. "cookie", "geo", "indexedDB", "popup", "image" */ clearPermission: function Site_clearPermission(aType) { - Services.perms.remove(this.host, aType); + Services.perms.remove(this.httpURI, aType); }, /** 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(); diff --git a/application/palemoon/components/preferences/permissions.js b/application/palemoon/components/preferences/permissions.js index 0bae7fc8d..9fa2b84b9 100644 --- a/application/palemoon/components/preferences/permissions.js +++ b/application/palemoon/components/preferences/permissions.js @@ -371,7 +371,8 @@ var gPermissionManager = { } for (let p of this._permissionsToDelete.values()) { - Services.perms.remove(p.host, p.type); + let uri = Services.io.newURI("http://" + p.host, null, null); + Services.perms.remove(uri, p.type); } window.close(); |