Page MenuHomePhabricator

"Uncaught Error: Cannot add a child to mwAlienMeta node" while removing text both in first heading and previous paragraph
Open, Needs TriagePublicBUG REPORT

Description

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

  • From a desktop computer, visit a page with a level-2 heading; click Edit to open VisualEditor. Example.
  • Select text in first heading along with some previous text, i.e. last words of introduction text. (e.g. "du xve siècle. Bio" in example page)
  • Press Del, Back, or any key to remove or replace the highlighted content.

What happens?:

  • The text is not removed/replaced.
  • You cannot highlight other text. You cannot type anything anymore.
  • JavaScript console displays:
Uncaught Error: Cannot add a child to mwAlienMeta node
    checkCanInsertNodeType ve.dm.TreeModifier.js:1134
    pushMoveNodeOp ve.dm.TreeModifier.js:804
    processRetain ve.dm.TreeModifier.js:600
    processLinearOperation ve.dm.TreeModifier.js:441
    calculateTreeOperations ve.dm.TreeModifier.js:425
    process ve.dm.TreeModifier.js:391
    process ve.dm.TransactionProcessor.js:110
    commit ve.dm.Document.js:391
    changeInternal ve.dm.Surface.js:970
    change ve.dm.Surface.js:939
    change ve.dm.SurfaceFragment.js:125
    removeContent ve.dm.SurfaceFragment.js:962
    handleInsertion ve.ce.Surface.js:4465
    onDocumentKeyPress ve.ce.Surface.js:1752
    callListener ve.EventSequencer.js:426
    onEvent ve.EventSequencer.js:258
    makeEventHandler ve.EventSequencer.js:62
    jQuery 2
ve.dm.TreeModifier.js:1134:8

What should have happened instead?:
The text you had selected is removed. If you pressed a letter key, the letter is inserted replacing previous text.

Event Timeline

Note I achieved to reproduce on several pages, but I can’t reproduce at fr:Koenigsegg_CC8S.

The 'mwAlienMeta' in question is the auto-generated TOC marker that gets inserted after the first paragraph:
<meta property="mw:PageProp/toc" data-mw="{&quot;autoGenerated&quot;:true}" id="mwDw">

Minimal test case in VE standalone:
<p>Foo</p><meta><h2>Bar</h2>

This doesn't appear to be a regression, and has been broken since we merged the linear data and metadata.

Change #1037507 had a related patch set uploaded (by Esanders; author: Esanders):

[VisualEditor/VisualEditor@master] TransactionBuilder failing test case

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

Change #1037579 had a related patch set uploaded (by Divec; author: Divec):

[VisualEditor/VisualEditor@master] TransactionBuilder: Handle preserved metaitems correctly

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

Change #1037579 merged by jenkins-bot:

[VisualEditor/VisualEditor@master] TransactionBuilder: Handle preserved metaitems correctly

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

Change #1041244 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (f7805878d)

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

Change #1041244 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (f7805878d)

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

Change #1037507 abandoned by Divec:

[VisualEditor/VisualEditor@master] TransactionBuilder failing test case

Reason:

tests moved to SurfaceFragment in Id98249dedad5f0c3a95e0539c61c8e29cde95409

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

Tested on 3 pages at Beta-Wikipedia, and I did not meet this issue anymore. Thank you!