Page MenuHomePhabricator

TypeError: Cannot read properties of undefined (reading 'parseWikitextFragment') when trying to view a visual diff
Open, Needs TriagePublic

Description

When trying to view this visual diff: https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_(technical)&diff=1100552364&oldid=1100442679&diffmode=visual

I get the error:

jQuery.Deferred exception: Cannot read properties of undefined (reading 'parseWikitextFragment') TypeError: Cannot read properties of undefined (reading 'parseWikitextFragment')
    at ve.ce.MWTransclusionNode.generateContents (https://en.wikipedia.org/w/load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector&version=vfm5e:882:538)
    at ve.ce.GeneratedContentNode.forceUpdate (https://en.wikipedia.org/w/load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector&version=vfm5e:551:80)
    at ve.ce.GeneratedContentNode.update (https://en.wikipedia.org/w/load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector&version=vfm5e:550:843)
    at VeCeMWTransclusionInlineNode.VeCeGeneratedContentNode (https://en.wikipedia.org/w/load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector&version=vfm5e:547:599)
    at VeCeMWTransclusionInlineNode.VeCeMWTransclusionNode (https://en.wikipedia.org/w/load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector&version=vfm5e:880:401)
    at VeCeMWTransclusionInlineNode (https://en.wikipedia.org/w/load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector&version=vfm5e:884:851)
    at OO.Factory.create (<anonymous>:593:592)
    at ve.ce.NodeFactory.createFromModel (https://en.wikipedia.org/w/load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector&version=vfm5e:374:553)
    at ve.dm.MWTransclusionNode.static.toDomElements (https://en.wikipedia.org/w/load.php?lang=en&modules=ext.visualEditor.core%2Cmwtransclusion&skin=vector&version=vfm5e:874:280)
    at ve.dm.MWSignatureNode.static.toDomElements (<anonymous>:285:1)

Event Timeline

There are at least three problems here:

  • This edit: https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_(technical)&diff=prev&oldid=1100545071 added <span data-dtsignatureforswitching="1"></span> to the page. This should never happen, it's an internal marker used in reply tool and it should be replaced by a signature when saving.
  • Visual diff understands that markup and tries to render it as the viewer's signature, like the reply tool would. It should not be treated as a signature outside of the reply tool.
  • When trying to render the signature (technically a transclusion of ~~~~), we call ve.init.target.parseWikitextFragment but ve.init.target is undefined. It should not depend on that (see T305762).
ppelberg added a project: Editing-team.
ppelberg subscribed.

We're going to start by taking a look at the first issue @matmarex identified in T313809#8105017:

We previously had a task about certain operations resulting in <nowiki><span data-dtsignatureforswitching="1"></span></nowiki>: . But this one is without <nowiki> and is probably a different bug.

I wanted to find out if this is an isolated incident, so I searched: https://en.wikipedia.org/w/index.php?search=insource%3Adtsignatureforswitching&profile=all which gives 15 cases of dtsignatureforswitching appearing in pages. I looked up the edits (using http://wikipedia.ramselehof.de/wikiblame.php), and tried to figure out what happened.

There seem to be three kinds of ways for <span data-dtsignatureforswitching="1"> to appear:

  • Kind A: <nowiki>...<span data-dtsignatureforswitching="1"></span></nowiki>. This was already reported as T280068. It happens when:
    • You input <nowiki>~~~~</nowiki> in wikitext mode (e.g. because you were explaining to someone how to add a signature), then switch to visual mode
    • You input ~~~~ in visual mode and prevent it from turning into a real signature (by pressing Ctrl+Z after the conversion, or by copy-pasting it rather than typing), then switch to wikitext mode (resulting in <nowiki>~~~~</nowiki>), then switch to visual mode again
  • Kind B: {{...|...<span data-dtsignatureforswitching="1"></span>}}. This is actually quite similar to the above, but I didn't think about it before. It happens when:
    • You input {{...|~~~~}} in wikitext mode (where ... is any template), then switch to visual mode
  • Kind C: <span data-dtsignatureforswitching="1"></span> without any other markup. I found one other example of this, but I still don't know how to reproduce it (except by doing one of the above, and then changing the markup in wikitext mode).
#DiffDateNotes
1https://en.wikipedia.org/w/index.php?title=User_talk:Memz.exe&diff=prev&oldid=10173893352021-04-12B
2https://en.wikipedia.org/w/index.php?title=User_talk:Chintan_Patoliya&diff=prev&oldid=10218777742021-05-07A (pasted template wikitext in visual mode)
3https://en.wikipedia.org/w/index.php?title=User_talk:Drsudhirgiri73&diff=prev&oldid=10798910082022-03-29A (pasted template wikitext in visual mode)
4https://en.wikipedia.org/w/index.php?title=User_talk:Coldstreamer20&diff=prev&oldid=10803812522022-03-31B
5https://en.wikipedia.org/w/index.php?title=Talk:Plastic_resin_pellet_pollution&diff=prev&oldid=10847257502022-04-26A (other weird markup)
6https://en.wikipedia.org/w/index.php?title=User_talk:DankJae&diff=prev&oldid=10917263662022-06-06A
7https://en.wikipedia.org/w/index.php?title=User_talk:Abrar19125&diff=prev&oldid=10935667732022-06-17A
8https://en.wikipedia.org/w/index.php?title=Talk:Taylor_Lorenz&diff=prev&oldid=10961834512022-07-02C (has nowiki elsewhere)
9https://en.wikipedia.org/w/index.php?title=User_talk:Jane023&diff=prev&oldid=10962538772022-07-03A
10https://en.wikipedia.org/w/index.php?title=User_talk:Louis_Versace&diff=prev&oldid=10965648372022-07-05A (pasted template wikitext in visual mode)
11https://en.wikipedia.org/w/index.php?title=User_talk:MARS_HALL_Rock_Band&diff=prev&oldid=10972415802022-07-09A (pasted template wikitext in visual mode)
12https://en.wikipedia.org/w/index.php?title=Talk:Chango_(company)&diff=prev&oldid=10982556492022-07-15A (pasted template wikitext in visual mode)
13https://en.wikipedia.org/w/index.php?title=User_talk:MoyaiViper&diff=prev&oldid=10986533982022-07-16B
14https://en.wikipedia.org/w/index.php?title=User_talk:MBugeyes&action=edit&oldid=10996093102022-07-21B
15https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_(technical)&diff=prev&oldid=11005450712022-07-26C