Bug 948805 - Fix TypeError: this._toolbox is null: StyleEditorPanel.prototype._showError; r=pbrosset

This commit is contained in:
Heather Arthur 2013-12-12 12:58:29 -08:00
parent a69da81877
commit b59b275a5f

View File

@ -72,15 +72,26 @@ StyleEditorPanel.prototype = {
*
* @param {string} event
* Type of event
* @param {string} errorCode
* @param {string} code
* Error code of error to report
* @param {string} message
* Extra message to append to error message
*/
_showError: function(event, errorCode) {
let message = _(errorCode);
_showError: function(event, code, message) {
if (!this._toolbox) {
// could get an async error after we've been destroyed
return;
}
let errorMessage = _(code);
if (message) {
errorMessage += " " + message;
}
let notificationBox = this._toolbox.getNotificationBox();
let notification = notificationBox.getNotificationWithValue("styleeditor-error");
if (!notification) {
notificationBox.appendNotification(message,
notificationBox.appendNotification(errorMessage,
"styleeditor-error", "", notificationBox.PRIORITY_CRITICAL_LOW);
}
},