Page MenuHomePhabricator

Copy-pasting section headings emits JS error and doesn't let you save
Closed, ResolvedPublic1 Story Points

Description

I am trying to edit [[Queensland Cultural Centre]] to merge the existing article with other material. The problem seems to be that when I move a heading and its content into another section and click Published Changes, the VE hangs. There is then nothing that can be done except to click on Article and abort the edit. The problem has happened many times now but I cannot provide any diffs, because I can never save the result.

But take [https://en.wikipedia.org/w/index.php?title=Queensland_Cultural_Centre&oldid=826472167 this version] and try to cut-and-paste the section "Queensland Gallery of Modern Art", the photo captioned "Queensland Gallery of Modern Art main entrance", and the paragraph commencing "The Queensland Gallery of Modern Art, which operates in association with the Queensland Art Gallery ..." from its present location to above the heading "The Queensland Gallery of Modern Art, which operates in association with the Queensland Art Gallery" a few lines earlier. I select the desired heading and para (which picks up the photo as well), cut it, and then move up to the desired location and paste it. Immediately something odd occurs . There is an extra line saying

Heritage listingQueensland C

and the heading that you didn't touch is messed up.

At this point, Publish Changes is blue, but if you click it, everything hangs! I have done a series of screen shots to illustrate each step of the process.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 19 2018, 9:35 AM
Deskana triaged this task as Normal priority.Feb 20 2018, 7:45 PM
Deskana set the point value for this task to 1.
Deskana added a subscriber: Deskana.

I followed the reproduction steps. When you click "Publish changes", the editor doesn't hang, but it does emit a JavaScript error and do nothing. Cut and paste seems to work just fine in other circumstances, so I'm guessing it's specific to some property of the text copied here.

Uncaught TypeError: Cannot read property 'lastOuterPost' of null
    at VeDmConverter.ve.dm.Converter.getDomSubtreeFromData (/w/load.php?debug=false&lang=en&modules=ext.CodeMirror.lib%7Cext.visualEditor.core%2Cmwwikitext%7Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=1er608d:505)
    at Object.ve.dm.MWReferenceNode.static.toDomElements (<anonymous>:704:242)
    at VeDmConverter.ve.dm.Converter.getDomElementsFromDataElement (/w/load.php?debug=false&lang=en&modules=ext.CodeMirror.lib%7Cext.visualEditor.core%2Cmwwikitext%7Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=1er608d:484)
    at VeDmConverter.ve.dm.Converter.getDomSubtreeFromData (/w/load.php?debug=false&lang=en&modules=ext.CodeMirror.lib%7Cext.visualEditor.core%2Cmwwikitext%7Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=1er608d:507)
    at VeDmConverter.ve.dm.Converter.getDomSubtreeFromModel (/w/load.php?debug=false&lang=en&modules=ext.CodeMirror.lib%7Cext.visualEditor.core%2Cmwwikitext%7Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=1er608d:499)
    at VeDmConverter.ve.dm.Converter.getDomFromModel (/w/load.php?debug=false&lang=en&modules=ext.CodeMirror.lib%7Cext.visualEditor.core%2Cmwwikitext%7Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=1er608d:499)
    at VeUiSurface.ve.ui.Surface.getDom (/w/load.php?debug=false&lang=en&modules=ext.CodeMirror.lib%7Cext.visualEditor.core%2Cmwwikitext%7Coojs-ui-core%2Coojs-ui-widgets&skin=vector&version=1er608d:802)
    at VeInitMwDesktopArticleTarget.ve.init.mw.ArticleTarget.createDocToSave (<anonymous>:645:155)
    at VeInitMwDesktopArticleTarget.ve.init.mw.ArticleTarget.getDocToSave (<anonymous>:644:845)
    at VeInitMwDesktopArticleTarget.ve.init.mw.ArticleTarget.showSaveDialog (<anonymous>:657:88)
Deskana renamed this task from Visual Editor hangs at Publish Changes, it seems cut-and-paste is not working properly to Cutting and pasting some text on one article emits JS error and doesn't let you save.Feb 20 2018, 7:46 PM
Deskana moved this task from To Triage to Current work on the VisualEditor board.
Deskana edited projects, added VisualEditor (Current work); removed VisualEditor.

On no occasion did I see a Javascript error display, I saw nothing happen at all.

On no occasion did I see a Javascript error display, I saw nothing happen at all.

Yes, the error is in the browser console, so you won't see it unless you have the console open.

The editor can appear like it's frozen, but it actually hasn't, even though it won't be working. The reason I'm making the distinction between freezing and error is because errors have tangible data that can help engineers fix things, whereas freezing issues frequently do not. It's not intended to be a nitpick about your report. :-)

Elitre added a subscriber: Elitre.

The report is great. Kudos for adding screenshots!

How about a button on the VE that takes a screenshot (or better still a Start/Stop recording) so you can see exactly what I can see. There are a lot of problems in the VE in execution (like the constant problem of how it repositions the text you are working on off screen) which cannot be demonstrated by a diff as it affects the user experience but cannot be captured either with a screen shot because the act of starting my tool to take a screenshot generally loses the popup on my VE screen. It also affects me in making training materials as there are some pop-ups/drop-downs that I just cannot screen capture.

Esanders assigned this task to DLynch.

I see someone else reporting similar problems here:

https://en.wikipedia.org/w/index.php?title=Wikipedia:VisualEditor/Feedback&diff=0&oldid=827580820

I went in and experimented with copy/cut/paste in the section Cancellation and found the same strange behaviours as I had experienced. For example, try to copy the whole 2nd sentence "With its cancellation, for the 1996 holiday season Sega instead decided to concentrate on Sonic Team's Nights into Dreams and a port of the Genesis title Sonic 3D Blast, the latter project to which Wallis contributed after X-treme's cancellation." and then paste it at the bottom of the section. Nothing happens. Try to cut the 2nd sentence and you get the trailing "n." left behind. Exactly the same kinds of things I experienced. However this time there did not appear to be a problem with Publish Changes hanging as I experienced, but copy/cut/paste are getting something very wrong in some situations.

Alsee added a subscriber: Alsee.EditedFeb 28 2018, 6:18 PM

I tried testing the bug mentioned just above, at this revision of the EnWiki article Sonic_X-treme.

I got a simple and consistent glitch. The problem appears to be confined to the === Cancellation === subsection. Any text selected with the mouse highlights correctly. However when I delete there appears to be an offset of two characters in which content is actually removed. I tried ending the selection in the middle of a series of refs, and the offset changed which refs were removed. Furthermore I believe I have identified the source of the problem. The glitch appeared to be triggered by this content:
''X-treme''<nowiki/>'s
The problem went away when I removed that portion using the wikitext editor, prior to switching to VE.

It's funny that you should mention

<nowiki/>

Lately I have noticed this turning up in a number of articles, which seemed strange to me as it's a meaningless thing for anyone to write. The VE does emit things wrapped in nowiki tags some times; is it possible that it is the VE that is producing this tag which then interferes with VE's operation? I notice that this nowiki tag was introduced in a edit tagged as VE:

https://en.wikipedia.org/w/index.php?title=Sonic_X-treme&diff=prev&oldid=823149762

However, I checked back on [[Queensland Cultural Centre]] and cannot find a nowiki (or anything else that looks unusual) in the wikitext of the version that was given me the grief. Maybe it is not the same bug.

I notice that this nowiki tag was introduced in a edit tagged as VE:

https://en.wikipedia.org/w/index.php?title=Sonic_X-treme&diff=prev&oldid=823149762

The tag is introduced by Parsoid to distinguish between apostrophes used for formatting, and typographic apostrophes. In this case the user effectively wrote <i>Sonic X-treme</i>'s in the editor. If we just converted that to ''Sonic X-treme'''s in wikitext, that would convert back to <i>Sonic X-treme'</i>s in HTML, which is subtly different (the apostrophe is now italicised).

TheDJ added a subscriber: TheDJ.EditedMar 8 2018, 2:20 PM

I too experienced this today, and there is a report on WP:VP/T
https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#Visual_Editor_freezing_at_'Publish_Changes'

I can reliably reproduce it just by copying an h2 (Safari, Mac OS X, as always)

DLynch added a comment.Mar 8 2018, 3:49 PM

Yeah, it's copying a heading, in my experience. But it's not just that, since I can't trigger it in a relatively simple document with that.

Deskana renamed this task from Cutting and pasting some text on one article emits JS error and doesn't let you save to Cutting and pasting some text on a small number of articles emits JS error and doesn't let you save.Mar 8 2018, 3:57 PM
Deskana raised the priority of this task from Normal to High.

Bumping up in priority due to reports that it's happening in more than one place.

Can I add that, following my report yesterday to the Village Pump (linked to by User:TheDJ above), on a completely different Windows 10 PC with Google Chrome, I encountered the identical freezing issue when switching from source editing to visual editor. At what I've always felt was the rather pointless stage of the user confirming they want to switch, the window froze up., But but this time had not moved, cut or copied any content whatsoever. I had simply spent forty minutes expanding Bulbophyllum trichorhachis on en.wiki, but have lost all detailed references and content I was inserting. I've rather lost confidence in switching whilst editing, and will now save and reopen in another editor until this issue is resolved. I appreciate its priority being raised.

matmarex added a subscriber: matmarex.

Let's split the "Sonic X-treme" issue to a separate task, that one is easily reproducible and clearly caused by the <nowiki/>, while this is a bit more nebulous. If they turn out to be the same problem, we can merge them again. Filed T189562: Presence of <nowiki/> on a page break everything in VisualEditor.

Here's a much simpler page that is also affected by the issue: https://en.wikipedia.org/wiki/Nico_Verlaan

To reproduce:

  1. Select the "References" section heading together with the list item below it
  2. Copy
  3. Paste at the end of the preceding paragraph (after "North Holland.")
matmarex renamed this task from Cutting and pasting some text on a small number of articles emits JS error and doesn't let you save to Copy-pasting section headings emits JS error and doesn't let you save.Mar 13 2018, 11:17 AM
matmarex claimed this task.Mar 13 2018, 2:25 PM
matmarex added a subscriber: DLynch.

How this happens: ve.ce.Surface#afterPaste is handling the "Internal paste" case. The data to insert is something like this: ["R","e","f","e","r","e","n","c","e","s",{"type":"/mwHeading"},{"type":"list",...},{"type":"listItem",...},{"type":"paragraph",...}]. The insertion fails, with TreeModifier throwing an exception, because this is silly and unbalanced – this is normal. However, ve.dm.TransactionProcessor#process fails to cleanly undo the changes – the rebuildTree() call also throws an exception. At this point the editing surface is irrecoverably corrupted and we should stop trying to do anything. However, ve.ce.Surface#afterPaste catches this exception, expecting it to be the one from TreeModifier, and carries on with the "balanced" insertion.

Things to fix:

  • ve.dm.TransactionProcessor#process should differentiate between exceptions from TreeModifier (which are recoverable) and exceptions from the code that tries to recover TreeModifier exceptions (which are not). This will make debugging of similar issues easier in the future.
  • Find out why rebuildTree() throws an exception for this case, and fix that bug.

Change 419189 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[VisualEditor/VisualEditor@master] ve.dm.Node: Make #getOffsetPath not fail while rebuilding the document

https://gerrit.wikimedia.org/r/419189

TheDJ added a comment.Mar 14 2018, 8:58 AM

I see more and more complaints, this might be a SWAT item...

Change 419189 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] ve.Node: Make #getOffsetPath not fail while rebuilding the document

https://gerrit.wikimedia.org/r/419189

Change 419512 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (dc5a65131)

https://gerrit.wikimedia.org/r/419512

Change 419512 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (dc5a65131)

https://gerrit.wikimedia.org/r/419512

Change 419518 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@wmf/1.31.0-wmf.25] Update VE core submodule to master (dc5a65131)

https://gerrit.wikimedia.org/r/419518

Scheduled for deployment: https://wikitech.wikimedia.org/wiki/Deployments#deploycal-item-20180314T2300

Note that I am only backporting to MediaWiki 1.31.0-wmf.25, and not wmf.24. This means the patch go live on all non-Wikipedia wikis now, and will reach Wikipedias tomorrow, per the usual schedule (https://www.mediawiki.org/wiki/MediaWiki_1.31/Roadmap).

Backporting to wmf.24 would conflict with other changes we merged in the last week, and while it would be possible to resolve that, it would not be much faster than just waiting about 23 hours for the regular deployment.

Change 419518 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@wmf/1.31.0-wmf.25] Update VE core submodule to master (dc5a65131)

https://gerrit.wikimedia.org/r/419518

matmarex closed this task as Resolved.Mar 15 2018, 12:45 AM
matmarex removed a project: Patch-For-Review.

The patch is live on all non-Wikipedia wikis now, and will reach Wikipedias tomorrow, per the usual schedule (https://www.mediawiki.org/wiki/MediaWiki_1.31/Roadmap).

Elitre rescinded a token.Mar 15 2018, 12:09 PM
Elitre awarded a token.