diff --git a/browser/base/content/urlbarBindings.xml b/browser/base/content/urlbarBindings.xml index d97eb17e6c7..8e05e250fbb 100644 --- a/browser/base/content/urlbarBindings.xml +++ b/browser/base/content/urlbarBindings.xml @@ -1714,15 +1714,39 @@ Services.strings.createBundle("chrome://branding/locale/brand.properties"); + + + @@ -1814,13 +1838,16 @@ // thus set a width on it, based on the available space, before // setting its textContent. Then set its height as well, to // fix wrong height calculation on Linux (bug 659578). - let self = this; - this._panel.addEventListener("popupshown", function (evt) { - self._panel.removeEventListener("popupshown", arguments.callee, true); - self._promomessage.width = self._promomessage.getBoundingClientRect().width; - self._promomessage.firstChild.textContent = self._notificationMessage; - self._promomessage.height = self._promomessage.getBoundingClientRect().height; - }, true); + this._panel.addEventListener("popupshown", function panelShown() { + this._panel.removeEventListener("popupshown", panelShown, true); + // Previous popupShown events may close the panel or change + // its contents, so ensure this is still valid. + if (this._panel.state != "open" || !this._notificationType) + return; + this._promomessage.width = this._promomessage.getBoundingClientRect().width; + this._promomessage.firstChild.textContent = this._notificationMessage; + this._promomessage.height = this._promomessage.getBoundingClientRect().height; + }.bind(this), true); } ]]>