Bug 1073259 - Print more descriptive errors when SettingsManager tries to make a request with an invalid window. r=bent

This commit is contained in:
Kyle Machulis 2014-10-17 05:24:00 -04:00
parent 41e66a285c
commit ee719e8f3c

View File

@ -86,14 +86,6 @@ SettingsLock.prototype = {
_closeHelper: function() {
if (DEBUG) debug("closing lock " + this._id);
// sendMessage can get queued to run later in a thread via
// _closeHelper, but the SettingsManager may have died in between
// the time it was scheduled and the time it runs. Make sure our
// window is valid before sending, otherwise just ignore.
if (!this._settingsManager._window) {
if (DEBUG) debug("SettingsManager died, cannot send " + aMessageName + " message window principal.");
return;
}
this._open = false;
this._closeCalled = false;
if (!this._requests || Object.keys(this._requests).length == 0) {
@ -112,6 +104,18 @@ SettingsLock.prototype = {
},
sendMessage: function(aMessageName, aData) {
// sendMessage can be called after our window has died, or get
// queued to run later in a thread via _closeHelper, but the
// SettingsManager may have died in between the time it was
// scheduled and the time it runs. Make sure our window is valid
// before sending, otherwise just ignore.
if (!this._settingsManager._window) {
Cu.reportError(
"SettingsManager window died, cannot run settings transaction." +
" SettingsMessage: " + aMessageName +
" SettingsData: " + JSON.stringify(aData));
return;
}
cpmm.sendAsyncMessage(aMessageName,
aData,
undefined,