From e644d33a8d7c109c4c31c2e07405e319f83ef2c2 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 6 May 2015 16:04:53 -0700 Subject: [PATCH] Follow-up 5c38995bd94f: don't destroy toolbar twice The toolbar.destroy() call that was added in 5c38995bd94f was needed to destroy the dummy toolbar when tearing down VE before a surface had been intialized. But when tearing down VE after the surface had been initialized (e.g. exiting using the Read tab), we would do: * setTimeout in tearDownToolbar() ** Set toolbar height to 0 and wait for transitionend *** toolbar.destroy() once transition complete * toolbar.destroy() in cancel() This meant that we'd listen for a transitionend event on an unattached element (because once the setTimeout runs, the toolbar has already been destroyed by the second call), which of course never fires, so we'd never resolve the tearDownToolbar deferred and never finish tearing down VE. Bug: T98388 Change-Id: I504f0cb0bf13643773fc98cb18b7b380cccb2f88 --- modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js index 11714f16c5..e2cffc37d5 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js @@ -419,10 +419,8 @@ ve.init.mw.ViewPageTarget.prototype.cancel = function ( trackMechanism ) { this.tearDownUnloadHandlers(); // If we got as far as setting up the surface, tear that down promises.push( this.tearDownSurface() ); - } - - // If a dummy toolbar was created, destroy it - if ( this.toolbar ) { + } else if ( this.toolbar ) { + // If a dummy toolbar was created, destroy it this.toolbar.destroy(); }