Page MenuHomePhabricator

VisualEditor failing to load on interwiki redirect pages
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  1. https://www.mediawiki.org/wiki/Performance_profiling_for_Wikimedia_code?veaction=edit

What happens?:

Page is stuck indefinitely loading.

cap.png (1×2 px, 624 KB)

Uncaught TypeError: linkData is null
  toDataElement @injectedScript
  createDataElements https://www.mediawiki.org/w/load.php?lang=en&modules=ext.visualEditor.core,mwtransclusion&skin=vector&version=1s8p8:251
  getDataFromDomSubtree https://www.mediawiki.org/w/load.php?lang=en&modules=ext.visualEditor.core,mwtransclusion&skin=vector&version=1s8p8:257
  getModelFromDom https://www.mediawiki.org/w/load.php?lang=en&modules=ext.visualEditor.core,mwtransclusion&skin=vector&version=1s8p8:252
  createModelFromDom @injectedScript
  createModelFromDom @injectedScript
  setupSurface

Other information (browser name/version, screenshots, etc.):

Firefox. macOS. Is affecting other redirect pages on mediawik.org as well, but only interwiki ones it seems. For example:

And several others.

Event Timeline

I don't think we've ever supported editing cross-wiki redirects (or realized that the feature exists).

The following VisualEditor patch appears to be sufficient to stop the visual editor from breaking, without any other cascading failure that I can see from a quick test:

diff --git a/modules/ve-mw/dm/metaitems/ve.dm.MWRedirectMetaItem.js b/modules/ve-mw/dm/metaitems/ve.dm.MWRedirectMetaItem.js
index 3d5d1a8bb..231f00c0a 100644
--- a/modules/ve-mw/dm/metaitems/ve.dm.MWRedirectMetaItem.js
+++ b/modules/ve-mw/dm/metaitems/ve.dm.MWRedirectMetaItem.js
@@ -35,7 +35,7 @@ ve.dm.MWRedirectMetaItem.static.matchRdfaTypes = [ 'mw:PageProp/redirect' ];
 ve.dm.MWRedirectMetaItem.static.toDataElement = function ( domElements, converter ) {
        // HACK piggy-back on MWInternalLinkAnnotation's ./ stripping logic
        var linkData = ve.dm.MWInternalLinkAnnotation.static.toDataElement( domElements, converter );
-       linkData.type = this.name;
+       if (linkData) linkData.type = this.name;
        return linkData;
 };

Of course, in addition to this we'd probably want to patch MW itself to hide the visual edit option and default to edit source, because all you get is an empty visual editor.