mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Always initialize data before use
LinkNodeInspector was broken when you clicked away/pressed escape, because data was not set. Normalizing on data being initialized at the top of get*Process methods if used. Change-Id: I89728ac558545a6f2c325014b6f457ec6bef17b8
This commit is contained in:
parent
b37a947f78
commit
f30336bc2e
|
@ -135,11 +135,9 @@ ve.ui.MWMetaDialog.prototype.getActionProcess = function ( action ) {
|
|||
* @inheritdoc
|
||||
*/
|
||||
ve.ui.MWMetaDialog.prototype.getSetupProcess = function ( data ) {
|
||||
data = data || {};
|
||||
return ve.ui.MWMetaDialog.super.prototype.getSetupProcess.call( this, data )
|
||||
.next( function () {
|
||||
// Data initialization
|
||||
data = data || {};
|
||||
|
||||
var surfaceModel = this.getFragment().getSurface();
|
||||
|
||||
if ( data.page && this.bookletLayout.getPage( data.page ) ) {
|
||||
|
|
|
@ -363,6 +363,7 @@ ve.ui.MWReferenceDialog.prototype.getActionProcess = function ( action ) {
|
|||
* @param {boolean} [data.useExistingReference] Open the dialog in "use existing reference" mode
|
||||
*/
|
||||
ve.ui.MWReferenceDialog.prototype.getSetupProcess = function ( data ) {
|
||||
data = data || {};
|
||||
return ve.ui.MWReferenceDialog.super.prototype.getSetupProcess.call( this, data )
|
||||
.next( function () {
|
||||
this.panels.setItem( this.editPanel );
|
||||
|
|
|
@ -354,13 +354,11 @@ ve.ui.MWTemplateDialog.prototype.getActionProcess = function ( action ) {
|
|||
* @inheritdoc
|
||||
*/
|
||||
ve.ui.MWTemplateDialog.prototype.getSetupProcess = function ( data ) {
|
||||
data = data || {};
|
||||
return ve.ui.MWTemplateDialog.super.prototype.getSetupProcess.call( this, data )
|
||||
.next( function () {
|
||||
var template, promise;
|
||||
|
||||
// Data initialization
|
||||
data = data || {};
|
||||
|
||||
// Properties
|
||||
this.loaded = false;
|
||||
this.transclusionModel = new ve.dm.MWTransclusionModel();
|
||||
|
|
|
@ -78,10 +78,9 @@ ve.ui.MWWikitextSwitchConfirmDialog.prototype.getActionProcess = function ( acti
|
|||
* @inheritdoc
|
||||
*/
|
||||
ve.ui.MWWikitextSwitchConfirmDialog.prototype.getTeardownProcess = function ( data ) {
|
||||
data = data || {};
|
||||
return ve.ui.MWWikitextSwitchConfirmDialog.super.prototype.getTeardownProcess.call( this, data )
|
||||
.first( function () {
|
||||
data = data || {};
|
||||
|
||||
// EVIL HACK - we shouldn't be reaching into the manager for these promises
|
||||
if ( data.action === 'switch' || data.action === 'discard' ) {
|
||||
this.manager.closing.resolve( data );
|
||||
|
|
|
@ -89,6 +89,7 @@ ve.ui.MWExtensionInspector.prototype.getInputPlaceholder = function () {
|
|||
* @inheritdoc
|
||||
*/
|
||||
ve.ui.MWExtensionInspector.prototype.getSetupProcess = function ( data ) {
|
||||
data = data || {};
|
||||
return ve.ui.MWExtensionInspector.super.prototype.getSetupProcess.call( this, data )
|
||||
.next( function () {
|
||||
var value, dir;
|
||||
|
|
|
@ -98,6 +98,7 @@ ve.ui.MWLinkNodeInspector.prototype.getReadyProcess = function ( data ) {
|
|||
* @inheritdoc
|
||||
*/
|
||||
ve.ui.MWLinkNodeInspector.prototype.getTeardownProcess = function ( data ) {
|
||||
data = data || {};
|
||||
return ve.ui.MWLinkNodeInspector.super.prototype.getTeardownProcess.call( this, data )
|
||||
.first( function () {
|
||||
var content, annotation, annotations,
|
||||
|
|
Loading…
Reference in a new issue