mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 814222 - Need additional security checks for the networkstats-manage permission. r=philikon
This commit is contained in:
parent
5e42b191c3
commit
af053f1ad8
@ -101,7 +101,7 @@ NetworkStatsManager.prototype = {
|
||||
|
||||
checkPrivileges: function checkPrivileges() {
|
||||
if (!this.hasPrivileges) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
throw Components.Exception("Permission denied", Cr.NS_ERROR_FAILURE);
|
||||
}
|
||||
},
|
||||
|
||||
@ -198,8 +198,6 @@ NetworkStatsManager.prototype = {
|
||||
if (!Services.prefs.getBoolPref("dom.mozNetworkStats.enabled")) {
|
||||
return null;
|
||||
}
|
||||
this.initHelper(aWindow, ["NetworkStats:Get:Return",
|
||||
"NetworkStats:Clear:Return"]);
|
||||
|
||||
let principal = aWindow.document.nodePrincipal;
|
||||
let secMan = Services.scriptSecurityManager;
|
||||
@ -213,6 +211,13 @@ NetworkStatsManager.prototype = {
|
||||
if (DEBUG) {
|
||||
debug("has privileges: " + this.hasPrivileges);
|
||||
}
|
||||
|
||||
if (!this.hasPrivileges) {
|
||||
return null;
|
||||
}
|
||||
|
||||
this.initHelper(aWindow, ["NetworkStats:Get:Return",
|
||||
"NetworkStats:Clear:Return"]);
|
||||
},
|
||||
|
||||
// Called from DOMRequestIpcHelper
|
||||
|
@ -74,6 +74,10 @@ this.NetworkStatsService = {
|
||||
},
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
if (!aMessage.target.assertPermission("networkstats-manage")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
debug("receiveMessage " + aMessage.name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user