mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 1105511 - Make observer principal cache name reflect content; r=gerard-majax
This commit is contained in:
parent
acc7048fe4
commit
0636c32ce5
@ -188,7 +188,11 @@ let SettingsRequestManager = {
|
||||
// until they hit the front of the queue.
|
||||
settingsLockQueue: [],
|
||||
children: [],
|
||||
mmPrincipals: new Map(),
|
||||
// Since we need to call observers at times when we may not have
|
||||
// just received a message from a child process, we cache principals
|
||||
// for message managers and check permissions on them before we send
|
||||
// settings notifications to child processes.
|
||||
observerPrincipalCache: new Map(),
|
||||
tasksConsumed: 0,
|
||||
|
||||
init: function() {
|
||||
@ -765,7 +769,7 @@ let SettingsRequestManager = {
|
||||
broadcastMessage: function broadcastMessage(aMsgName, aContent) {
|
||||
if (VERBOSE) debug("Broadcast");
|
||||
this.children.forEach(function(msgMgr) {
|
||||
let principal = this.mmPrincipals.get(msgMgr);
|
||||
let principal = this.observerPrincipalCache.get(msgMgr);
|
||||
if (!principal) {
|
||||
if (DEBUG) debug("Cannot find principal for message manager to check permissions");
|
||||
}
|
||||
@ -784,13 +788,13 @@ let SettingsRequestManager = {
|
||||
if (VERBOSE) debug("Add observer for " + aPrincipal.origin);
|
||||
if (this.children.indexOf(aMsgMgr) == -1) {
|
||||
this.children.push(aMsgMgr);
|
||||
this.mmPrincipals.set(aMsgMgr, aPrincipal);
|
||||
this.observerPrincipalCache.set(aMsgMgr, aPrincipal);
|
||||
}
|
||||
},
|
||||
|
||||
removeObserver: function(aMsgMgr) {
|
||||
if (VERBOSE) {
|
||||
let principal = this.mmPrincipals.get(aMsgMgr);
|
||||
let principal = this.observerPrincipalCache.get(aMsgMgr);
|
||||
if (principal) {
|
||||
debug("Remove observer for " + principal.origin);
|
||||
}
|
||||
@ -798,9 +802,9 @@ let SettingsRequestManager = {
|
||||
let index = this.children.indexOf(aMsgMgr);
|
||||
if (index != -1) {
|
||||
this.children.splice(index, 1);
|
||||
this.mmPrincipals.delete(aMsgMgr);
|
||||
this.observerPrincipalCache.delete(aMsgMgr);
|
||||
}
|
||||
if (VERBOSE) debug("Principal/MessageManager pairs left: " + this.mmPrincipals.size);
|
||||
if (VERBOSE) debug("Principal/MessageManager pairs left in observer cache: " + this.observerPrincipalCache.size);
|
||||
},
|
||||
|
||||
removeLock: function(aLockID) {
|
||||
|
Loading…
Reference in New Issue
Block a user