Bug 1016031 - Fix ProfD race in b2g child processes. r=fabrice

This commit is contained in:
Alexandre Poirot 2014-05-26 10:39:00 +02:00
parent d0c33feb10
commit 1e8598317b
2 changed files with 10 additions and 3 deletions

View File

@ -358,9 +358,6 @@ var shell = {
ppmm.addMessageListener("sms-handler", this); ppmm.addMessageListener("sms-handler", this);
ppmm.addMessageListener("mail-handler", this); ppmm.addMessageListener("mail-handler", this);
ppmm.addMessageListener("file-picker", this); ppmm.addMessageListener("file-picker", this);
ppmm.addMessageListener("getProfD", function(message) {
return Services.dirsvc.get("ProfD", Ci.nsIFile).path;
});
}, },
stop: function shell_stop() { stop: function shell_stop() {

View File

@ -43,6 +43,16 @@ ProcessGlobal.prototype = {
switch (topic) { switch (topic) {
case 'app-startup': { case 'app-startup': {
Services.obs.addObserver(this, 'console-api-log-event', false); Services.obs.addObserver(this, 'console-api-log-event', false);
let inParent = Cc["@mozilla.org/xre/app-info;1"]
.getService(Ci.nsIXULRuntime)
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
if (inParent) {
let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]
.getService(Ci.nsIMessageListenerManager);
ppmm.addMessageListener("getProfD", function(message) {
return Services.dirsvc.get("ProfD", Ci.nsIFile).path;
});
}
break; break;
} }
case 'console-api-log-event': { case 'console-api-log-event': {