From e5ea99cfe39df4a33077437c12c5938ac7683e37 Mon Sep 17 00:00:00 2001 From: Heather Arthur Date: Thu, 12 Dec 2013 12:58:29 -0800 Subject: [PATCH] Bug 948805 - Fix TypeError: this._toolbox is null: StyleEditorPanel.prototype._showError; r=pbrosset --- .../devtools/styleeditor/styleeditor-panel.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/browser/devtools/styleeditor/styleeditor-panel.js b/browser/devtools/styleeditor/styleeditor-panel.js index ef55e84761ee..9940fabd15db 100644 --- a/browser/devtools/styleeditor/styleeditor-panel.js +++ b/browser/devtools/styleeditor/styleeditor-panel.js @@ -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); } },