From 373a19f1cc2b9ba01962c8ef1793b7dcb551b6dd Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Tue, 5 Apr 2016 01:25:33 +0100 Subject: [PATCH] Ensure veswitched is not set when we set wteswitched in the URI veswitched and wteswitched together cannot result in any sane behaviour. To reproduce: * Open VE (while having multi-tab pref?), switch into WTE * Make a change * Switch into VE Change-Id: I90e19169e3fab60ab876c8e4d349801309db262f --- .../init/targets/ve.init.mw.DesktopArticleTarget.init.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js index 180b6ce028..26d940b5e8 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js @@ -567,11 +567,14 @@ .then( function ( opened ) { return opened; } ) .then( function ( closing ) { return closing; } ) .then( function ( data ) { + var oldUri; if ( data && data.action === 'keep' ) { activatePageTarget( true ); } else if ( data && data.action === 'discard' ) { setEditorPreference( 'visualeditor' ); - location.href = veEditUri.clone().extend( { wteswitched: 1 } ); + oldUri = veEditUri.clone(); + delete oldUri.query.veswitched; + location.href = oldUri.extend( { wteswitched: 1 } ); } } ); } );