author | Fred Lin <gasolin@mozilla.com> |
Mon, 19 Sep 2016 15:03:46 +0800 | |
changeset 357223 | 20c898adf320d85dba847c39539e88dedbab3624 |
parent 355636 | d3e3c644160a6d527045d377f894e98d70060d46 |
child 357224 | 948c8cc4b5d04312037f45a67e8496a19e94ea6e |
push id | 6795 |
push user | jlund@mozilla.com |
push date | Mon, 23 Jan 2017 14:19:46 +0000 |
treeherder | mozilla-beta@76101b503191 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | MattN |
bugs | 1295151 |
milestone | 51.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
browser/modules/SitePermissions.jsm | file | annotate | diff | comparison | revisions | |
browser/modules/test/xpcshell/test_SitePermissions.js | file | annotate | diff | comparison | revisions |
--- a/browser/modules/SitePermissions.jsm +++ b/browser/modules/SitePermissions.jsm @@ -19,29 +19,35 @@ this.SitePermissions = { /* Returns all custom permissions for a given URI, the return * type is a list of objects with the keys: * - id: the permissionId of the permission * - state: a constant representing the current permission state * (e.g. SitePermissions.ALLOW) * * To receive a more detailed, albeit less performant listing see * SitePermissions.getPermissionDetailsByURI(). + * + * install addon permission is excluded, check bug 1303108 */ getAllByURI: function (aURI) { let result = []; if (!this.isSupportedURI(aURI)) { return result; } let permissions = Services.perms.getAllForURI(aURI); while (permissions.hasMoreElements()) { let permission = permissions.getNext(); // filter out unknown permissions if (gPermissionObject[permission.type]) { + // XXX Bug 1303108 - Control Center should only show non-default permissions + if (permission.type == "install") { + continue; + } result.push({ id: permission.type, state: permission.capability, }); } } return result;
--- a/browser/modules/test/xpcshell/test_SitePermissions.js +++ b/browser/modules/test/xpcshell/test_SitePermissions.js @@ -40,16 +40,21 @@ add_task(function* testGetAllByURI() { Assert.deepEqual(SitePermissions.getAllByURI(uri), [ { id: "camera", state: SitePermissions.ALLOW }, { id: "desktop-notification", state: SitePermissions.BLOCK } ]); SitePermissions.remove(uri, "camera"); SitePermissions.remove(uri, "desktop-notification"); Assert.deepEqual(SitePermissions.getAllByURI(uri), []); + + // XXX Bug 1303108 - Control Center should only show non-default permissions + SitePermissions.set(uri, "addon", SitePermissions.BLOCK); + Assert.deepEqual(SitePermissions.getAllByURI(uri), []); + SitePermissions.remove(uri, "addon"); }); add_task(function* testGetPermissionDetailsByURI() { // check that it returns an empty array on an invalid URI // like a file URI, which doesn't support site permissions let wrongURI = Services.io.newURI("file:///example.js", null, null) Assert.deepEqual(SitePermissions.getPermissionDetailsByURI(wrongURI), []);