Bug 1187419 - Make sure SettingsRequestManager is only loaded in parent. r=gwagner

This commit is contained in:
Alexandre Lissy 2015-07-24 12:32:00 +02:00
Родитель a39ceed4a2
Коммит 4bf7163f65
1 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -6,6 +6,7 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
Cu.importGlobalProperties(['File']);
@ -39,6 +40,9 @@ function debug(s) {
dump("-*- SettingsRequestManager: " + s + "\n");
}
let inParent = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
const kXpcomShutdownObserverTopic = "xpcom-shutdown";
const kInnerWindowDestroyed = "inner-window-destroyed";
const kMozSettingsChangedObserverTopic = "mozsettings-changed";
@ -1210,5 +1214,11 @@ let SettingsRequestManager = {
}
};
this.SettingsRequestManager = SettingsRequestManager;
SettingsRequestManager.init();
// This code should ALWAYS be living only on the parent side.
if (!inParent) {
debug("SettingsRequestManager should be living on parent side.");
throw Cr.NS_ERROR_ABORT;
} else {
this.SettingsRequestManager = SettingsRequestManager;
SettingsRequestManager.init();
}