Page MenuHomePhabricator

Error after cancelling switch between edit modes
Closed, ResolvedPublic1 Estimated Story Points


For a normal wikitext editor (Without the beta setting of a new editor)

  1. Start editing an article in the visual editor
  2. Click to switch to wiki mode
  3. In the confirmation window, click cancel

The confirmation window disappears, VE remains inactive

VM421:312 Uncaught TypeError: Cannot read property 'reject' of undefined
    at VeUiMWWikitextSwitchConfirmDialog.eval (eval at <anonymous> (load.php?debug=false&lang=ru&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=0r0nkm9:4), <anonymous>:312:755)
    at eval (eval at <anonymous> (load.php?debug=false&lang=ru&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=0r0nkm9:4), <anonymous>:29:113)
    at OO.ui.Process.execute (eval at <anonymous> (load.php?debug=false&lang=ru&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=0r0nkm9:4), <anonymous>:29:760)
    at VeUiMWWikitextSwitchConfirmDialog.OO.ui.Window.teardown (eval at <anonymous> (load.php?debug=false&lang=ru&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=0r0nkm9:4), <anonymous>:47:681)
    at eval (eval at <anonymous> (load.php?debug=false&lang=ru&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=0r0nkm9:4), <anonymous>:37:876)

Event Timeline

Deskana triaged this task as Unbreak Now! priority.Jul 4 2017, 6:01 PM
Deskana moved this task from To Triage to TR0: Interrupt on the VisualEditor board.
Deskana subscribed.

This is happening in production and could cause data loss.


ve.ui.MWWikitextSwitchConfirmDialog.prototype.getTeardownProcess = function ( data ) {
	data = data || {};
	return this, data )
		.first( function () {
			// EVIL HACK - we shouldn't be reaching into the manager for these promises
			if ( data.action === 'switch' ) {
				this.manager.closing.resolve( data );
			} else {
				this.manager.closing.reject( data );
		}, this );

Looks like the evil hack broke.

It was probably broken by rGOJUac10e40b6b4a: WindowManager: Add WindowInstance - a Promise-based lifecycle object in OOjs UI, which removed this undocumented private property that we relied on.

I'm not sure if this was actually doing anything, before it broke. In the original version of the "switch to wikitext" functionality (rEVED237d68f6dbdd: Offer to retain changes when switching to the wikitext editor), it appears that this was used to pass the 'data' from 'getTeardownProcess' to outside of the dialog instance, to the Target. But this code works differently these days (the dialog calls Target#switchToWikitextEditor itself), so these might not be necessary at all?

Change 363231 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] ve.ui.MWWikitextSwitchConfirmDialog: Remove broken "evil hack"

Change 363231 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] ve.ui.MWWikitextSwitchConfirmDialog: Remove broken "evil hack"

Jdforrester-WMF renamed this task from Error after canceling switch to Error after cancelling switch between edit modes.Jul 6 2017, 7:11 PM
Jdforrester-WMF closed this task as Resolved.
Jdforrester-WMF assigned this task to matmarex.
Jdforrester-WMF set the point value for this task to 1.