mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Close the save dialog on teardown only, not on save
Closing a dialog with specific data means closing it again with potentially different data, while the dialog is already closing, means someone wins and someone looses. Silently failing in this case is bad, because if the first close call was a cancel, producing no side effects, but the second close call would have produced some side effect, the side effect would never occur. The problem here really was that the save dialog needs to be closed before we can destroy the surface so we can uphold the assumption that hold and teardown processes are operating on an attached DOM. The solution is to automatically close the save dialog on teardown, rather than on save. Since save triggers teardown, this has and identical user experience. Bug: 68048 Change-Id: I669448739f168737d4eddd6496189a819ce894b1
This commit is contained in:
parent
040ef014bd
commit
49ffef5a0f
|
@ -470,7 +470,6 @@ ve.init.mw.ViewPageTarget.prototype.onSave = function ( html, categoriesHtml, ne
|
|||
} );
|
||||
this.revid = newid;
|
||||
}
|
||||
this.saveDialog.close();
|
||||
this.saveDialog.reset();
|
||||
this.replacePageContent( html, categoriesHtml, isRedirect, displayTitle );
|
||||
this.setupSectionEditLinks();
|
||||
|
@ -1090,9 +1089,11 @@ ve.init.mw.ViewPageTarget.prototype.tearDownSurface = function () {
|
|||
if ( this.surface.mwTocWidget ) {
|
||||
this.surface.mwTocWidget.teardown();
|
||||
}
|
||||
|
||||
if ( this.saveDialog ) {
|
||||
// If we got as far as setting up the save dialog, tear it down
|
||||
// If the save dialog is still open (from saving) close it
|
||||
promises.push( this.saveDialog.close() );
|
||||
// Release the reference
|
||||
this.saveDialog = null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue