Page MenuHomePhabricator

Clicking on red link gives error "Uncaught TypeError: Cannot read property 'start' of null"
Closed, ResolvedPublic

Description

  1. Click on a red link on read mode such as this one:

https://en.wikipedia.org/w/index.php?title=Examples/Red&action=edit&redlink=1

The following error appears:

VM108:1078 Uncaught TypeError: Cannot read property 'start' of null
    at jQuery.fn.init.getCaretPosition (<anonymous>:1078:106)
    at jQuery.fn.init.$.fn.textSelection (<anonymous>:108:121)
    at jQuery.fn.init.$.fn.wikiEditor (load.php?debug=false&lang=en&modules=ext.wikiEditor&skin=vector&version=03d7n1u:5)
    at Object.CiteTB.init (index.php?title=MediaWiki:RefToolbar.js&action=raw&ctype=text/javascript:128)
    at index.php?title=MediaWiki:RefToolbarConfig.js&action=raw&ctype=text/javascript:233

Event Timeline

Deskana triaged this task as Medium priority.Aug 7 2018, 6:57 PM
Deskana edited projects, added VisualEditor (Current work); removed VisualEditor.

I do not like errors in production, even if they do not seem to be causing any problems, because they often end up causing more problems down the line. Needs investigation.

Looks like the editor is originating from gadget code, requesting a caret position from the editor when there is none, but we can guard against that.

Change 451392 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Wikitext surface getCaretPosition: Handle null ranges

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

Change 451392 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Wikitext surface getCaretPosition: Handle null ranges

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

Deskana claimed this task.

If the fix for this has been deployed on 21Aug2018, I would like to inform that I still see the following error when visiting the link found in the task description.

TypeError: Argument 1 of Window.getComputedStyle is not an object.

I also get an error when visiting https://en.wikipedia.org/w/index.php?title=Wikipedia:Teahouse&action=edit&section=new which is the place in which I initially noticed this issue long before the proposed fix was made. The errors I get there is:

Argument 1 of Window.getComputedStyle is not an object.
TypeError: range is null, can't access property "end" of it

So, should this task be re-opened?