Page MenuHomePhabricator

[betalabs] Uncaught TypeError: Cannot read property 'nextSibling' of null - when Reply to WikiLove
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. On betalabs, enable WikiLove (Special:Preferenes-Editing).
  2. Post WikiLove message on a user page. The WikiLove messages will have a reply link:

  1. Click on the reply link - the link disappear and no text box is open. The Console will display the following error:
Uncaught TypeError: Cannot read property 'nextSibling' of null
at Object.addListItem
at CommentController.js.CommentController.setup 
at CommentController.js.CommentController.onReplyLinkClick
at HTMLAnchorElement.dispatch
at HTMLAnchorElement.elemData.handle

and the warning

jQuery.Deferred exception: Cannot read property 'nodeType' of null TypeError: Cannot read property 'nodeType' of null

Example page: https://en.wikipedia.beta.wmflabs.org/wiki/User_talk:ET10#A_kitten_for_you!

Event Timeline

matmarex added a subscriber: matmarex.

Seems to be a problem with server-side reply links; there is a marker for the start of the comment (e.g. <span data-mw-comment-start="c|ET13|2020-10-22T22:11:00.000Z|A_kitten_for_you!_2"></span>), but a matching marker for the end (data-mw-comment-end) is nowhere to be found. So we get a null and these exceptions.

Okay, I see what is happening… We insert the end marker inside the <br style="clear: both;"/> node, which is of course impossible in HTML. Oof…

matmarex updated the task description. (Show Details)

I wanted to fix this and discovered that it's already fixed, as a result of the changes in rEDTOd0ae6c4e445e: Skip end marker "forward" until a block tag is reached. We should add a unit test for this case though.

Change 647381 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Add test case for trailing void tags (<br>)

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

Change 649413 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Fix trying to insert start/end markers in impossible locations

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

While writing the test case, I found that it's not actually fixed in all cases, and this patch fixes it for real.

Change 649413 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Fix trying to insert start/end markers in impossible locations

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

ppelberg claimed this task.

Change 647381 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Add test case for trailing void tags (<br>)

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