Page MenuHomePhabricator

TreeModifier: remover does not skip over a deleted node immediately following a text node
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. In VisualEditor standalone, edit <p>abc<!--de--></p>
  2. Select from between b and c to the end of the paragraph (so range 3-6)
  3. Press Delete

Expected behaviour:

c<!--de--> is deleted

Actual behaviour:

An Error is thrown with the following stacktrace:

ve.dm.TreeModifier.js:534 Uncaught Error: Remover and inserter unexpectedly diverged
    at VeDmTreeModifier.ve.dm.TreeModifier.processRetain (ve.dm.TreeModifier.js:534)
    at VeDmTreeModifier.ve.dm.TreeModifier.processLinearOperation (ve.dm.TreeModifier.js:407)
    at VeDmTreeModifier.ve.dm.TreeModifier.calculateTreeOperations (ve.dm.TreeModifier.js:390)
    at VeDmTreeModifier.ve.dm.TreeModifier.process (ve.dm.TreeModifier.js:355)
    at VeDmTransactionProcessor.ve.dm.TransactionProcessor.process (ve.dm.TransactionProcessor.js:111)
    at VeDmDocument.ve.dm.Document.commit (ve.dm.Document.js:341)
    at VeDmSurface.ve.dm.Surface.changeInternal (ve.dm.Surface.js:950)
    at VeDmSurface.ve.dm.Surface.change (ve.dm.Surface.js:918)
    at VeDmSurfaceFragment.ve.dm.SurfaceFragment.change (ve.dm.SurfaceFragment.js:126)
    at VeDmSurfaceFragment.ve.dm.SurfaceFragment.delete (ve.dm.SurfaceFragment.js:965)

This is because if the ve.dm.TreeCursor is at the end of a text node and an ignored node follows, #crossIgnoredNodes should step out of the text node and cross the ignored node, but in fact it does not.

Details

Related Gerrit Patches:
mediawiki/extensions/VisualEditor : wmf/1.35.0-wmf.1Update VE core submodule to 2fc83d833
mediawiki/extensions/VisualEditor : REL1_34Update VE core submodule to 27e0abf04
VisualEditor/VisualEditor : wmf/1.35.0-wmf.1TreeCursor: cross ignored nodes properly from the end of a text node
VisualEditor/VisualEditor : REL1_34TreeCursor: cross ignored nodes properly from the end of a text node
VisualEditor/VisualEditor : masterTreeCursor: cross ignored nodes properly from the end of a text node
mediawiki/extensions/VisualEditor : masterUpdate VE core submodule to master (2f2cdd89d)

Event Timeline

dchan created this task.Oct 8 2019, 6:53 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 8 2019, 6:53 AM
Titore added a subscriber: Titore.Oct 8 2019, 10:07 AM
dchan added a comment.Oct 10 2019, 1:04 AM

Steps to reproduce real-life example (from T234142):

  1. Edit https://en.wikipedia.org/w/index.php?title=Nils_Grandelius&veaction=edit
  2. From the first paragraph, try to delete "Sweden[2]"

Expected behaviour: Sweden[2] disappears.

Actual behaviour: An Error is thrown "Remover and inserter unexpectedly diverged".

Change 541995 had a related patch set uploaded (by Divec; owner: Divec):
[VisualEditor/VisualEditor@master] TreeCursor: cross ignored nodes properly from the end of a text node

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

dchan added a comment.Oct 10 2019, 1:53 AM

Change 541995 fixes the real-life example above.

JTannerWMF added a subscriber: JTannerWMF.

Looks like @dchan is working on this and there is a patch for code review.

Change 541995 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] TreeCursor: cross ignored nodes properly from the end of a text node

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

Change 542177 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (2f2cdd89d)

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

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

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

Change 542228 had a related patch set uploaded (by Bartosz Dziewoński; owner: Divec):
[VisualEditor/VisualEditor@wmf/1.35.0-wmf.1] TreeCursor: cross ignored nodes properly from the end of a text node

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

Change 542229 had a related patch set uploaded (by Bartosz Dziewoński; owner: Divec):
[VisualEditor/VisualEditor@REL1_34] TreeCursor: cross ignored nodes properly from the end of a text node

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

Change 542230 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@wmf/1.35.0-wmf.1] Update VE core submodule to 2fc83d833

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

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

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

Change 542229 merged by jenkins-bot:
[VisualEditor/VisualEditor@REL1_34] TreeCursor: cross ignored nodes properly from the end of a text node

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

Change 542228 merged by jenkins-bot:
[VisualEditor/VisualEditor@wmf/1.35.0-wmf.1] TreeCursor: cross ignored nodes properly from the end of a text node

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

Change 542231 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@REL1_34] Update VE core submodule to 27e0abf04

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

Change 542230 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@wmf/1.35.0-wmf.1] Update VE core submodule to 2fc83d833

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

Mentioned in SAL (#wikimedia-operations) [2019-10-10T21:39:25Z] <jforrester@deploy1001> Synchronized php-1.35.0-wmf.1/extensions/VisualEditor/lib/ve/src/dm/ve.dm.TreeCursor.js: T234881 TreeCursor: cross ignored nodes properly from the end of a text node (duration: 00m 54s)

AxelBoldt closed this task as Resolved.Oct 11 2019, 5:45 PM

The issue is fixed on live Wikipedia, so I'm closing. Thanks everyone!