diff --git a/browser/components/preferences/permissions.js b/browser/components/preferences/permissions.js index dc6e4b42fafe..995123b06570 100644 --- a/browser/components/preferences/permissions.js +++ b/browser/components/preferences/permissions.js @@ -236,10 +236,17 @@ var gPermissionManager = { } this._tree.treeBoxObject.invalidate(); } - // No UI other than this window causes this method to be sent a "deleted" - // notification, so we don't need to implement it since Delete is handled - // directly by the Permission Removal handlers. If that ever changes, those - // implementations will have to move into here. + else if (aData == "deleted") { + for (var i = 0; i < this._permissions.length; i++) { + if (this._permissions[i].host == permission.host) { + this._permissions.splice(i, 1); + this._view._rowCount--; + this._tree.treeBoxObject.rowCountChanged(this._view.rowCount - 1, -1); + this._tree.treeBoxObject.invalidate(); + break; + } + } + } } }, diff --git a/browser/components/preferences/tests/browser_cookies_exceptions.js b/browser/components/preferences/tests/browser_cookies_exceptions.js index 9f5463334c3e..c47c7fc3dbbf 100644 --- a/browser/components/preferences/tests/browser_cookies_exceptions.js +++ b/browser/components/preferences/tests/browser_cookies_exceptions.js @@ -114,6 +114,17 @@ function windowLoad(event, win, dialog) { pm.remove("test.com", "popup"); }, }, + { + test: function() { + url.value = "test.com"; + btnAllow.doCommand(); + pm.remove("test.com", "cookie"); + is(tree.view.rowCount, 0, "display should update when cookie permission is deleted"); + }, + observances: [{ type: "cookie", host: "test.com", data: "added", + capability: allow }, + { type: "cookie", host: "test.com", data: "deleted" }] + }, ]; let permObserver = {