Alex Monk has uploaded a new change for review.
https://gerrit.wikimedia.org/r/321908
Change subject: Prevent endless error loop if falling back to wikitext (after a
load failure) fails.
......................................................................
Prevent endless error loop if falling back to wikitext (after a load failure)
fails.
Change-Id: Id48fa13a33aee9fabf857d20a75d26463c329f44
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/08/321908/1
diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
index 17082a3..339c61d 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
@@ -317,6 +317,7 @@
// Parent method
ve.init.mw.DesktopArticleTarget.super.prototype.loadSuccess.apply(
this, arguments );
+ this.wikitextFallbackLoading = false;
// Duplicate of this code in ve.init.mw.DesktopArticleTarget.init.js
if ( $( '#ca-edit' ).hasClass( 'visualeditor-showtabdialog' ) ) {
$( '#ca-edit' ).removeClass( 'visualeditor-showtabdialog' );
@@ -609,6 +610,13 @@
// Parent method
ve.init.mw.DesktopArticleTarget.super.prototype.loadFail.apply( this,
arguments );
+ if ( this.wikitextFallbackLoading ) {
+ // Failed twice now
+ mw.log.warn( "Failed to fall back to wikitext", errorText,
error );
+ location.href = target.viewUri.clone().extend( { action:
'edit', veswitched: 1 } );
+ return;
+ }
+
// Don't show an error if the load was manually aborted
// The response.status check here is to catch aborts triggered by
navigation away from the page
if (
@@ -650,6 +658,7 @@
target.deactivate( true );
} else {
// TODO: Some sort of progress bar?
+ target.wikitextFallbackLoading = true;
target.switchToWikitextEditor( true, false );
}
} );
--
To view, visit https://gerrit.wikimedia.org/r/321908
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id48fa13a33aee9fabf857d20a75d26463c329f44
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits