Bug 932342 - PanelUI ensureReady should only ever be invoked once, r=mconley

This commit is contained in:
Gijs Kruitbosch 2013-10-29 17:26:13 +01:00
parent a10bb42d67
commit 9ddaf0fd17

View File

@ -192,7 +192,10 @@ const PanelUI = {
* @return a Promise that resolves once the panel is ready to roll.
*/
ensureReady: function(aCustomizing=false) {
return Task.spawn(function() {
if (this._readyPromise) {
return this._readyPromise;
}
this._readyPromise = Task.spawn(function() {
if (!this._scrollWidth) {
// In order to properly center the contents of the panel, while ensuring
// that we have enough space on either side to show a scrollbar, we have to
@ -221,6 +224,8 @@ const PanelUI = {
this.endBatchUpdate();
}
}.bind(this)).then(null, Cu.reportError);
return this._readyPromise;
},
/**