Page MenuHomePhabricator

JS error when trying to view visual diff after switching from source to visual with new annotation
Closed, ResolvedPublic0 Estimated Story Points

Description

  1. Edit https://en.wikipedia.org/wiki/PGPfone?action=edit with NWE enabled
  2. Switch to source mode if you're not there already
  3. Make a change that changes an existing annotation or introduces a new annotation. For example, italicize a word (change telephony to ''telephony'').
  4. Switch to visual mode
  5. With or without making any further changes, view a visual diff
  6. JS error

Making the same change without switching from source to visual does not cause an error.

Uncaught TypeError: Cannot read property 'getOriginalDomElements' of undefined
    at closeAnnotation (load.php?debug=false&lang=en&modules=diffMatchPatch%2Coojs-ui-core%2Coojs-ui-widgets%2Cpapaparse%2C…:31876)
    at Object.ve.dm.Converter.static.openAndCloseAnnotations (load.php?debug=false&lang=en&modules=diffMatchPatch%2Coojs-ui-core%2Coojs-ui-widgets%2Cpapaparse%2C…:31290)
    at VeDmConverter.ve.dm.Converter.getDomSubtreeFromData (load.php?debug=false&lang=en&modules=diffMatchPatch%2Coojs-ui-core%2Coojs-ui-widgets%2Cpapaparse%2C…:31994)
    at VeDmConverter.ve.dm.Converter.getDomSubtreeFromModel (load.php?debug=false&lang=en&modules=diffMatchPatch%2Coojs-ui-core%2Coojs-ui-widgets%2Cpapaparse%2C…:31858)
    at VeDmConverter.ve.dm.Converter.getDomFromModel (load.php?debug=false&lang=en&modules=diffMatchPatch%2Coojs-ui-core%2Coojs-ui-widgets%2Cpapaparse%2C…:31845)
    at VeUiDiffElement.ve.ui.DiffElement.getChangedNodeElements (load.php?debug=false&lang=en&modules=diffMatchPatch%2Coojs-ui-core%2Coojs-ui-widgets%2Cpapaparse%2C…:50888)
    at VeUiDiffElement.ve.ui.DiffElement.renderDiff (load.php?debug=false&lang=en&modules=diffMatchPatch%2Coojs-ui-core%2Coojs-ui-widgets%2Cpapaparse%2C…:50718)
    at new VeUiDiffElement (load.php?debug=false&lang=en&modules=diffMatchPatch%2Coojs-ui-core%2Coojs-ui-widgets%2Cpapaparse%2C…:50588)
    at Object.<anonymous> (load.php?debug=false&lang=en&modules=diffMatchPatch%2Coojs-ui-core%2Coojs-ui-widgets%2Cpapaparse%2C…:21862)
    at Object.<anonymous> (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin…:47)
    at fire (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin…:45)
    at Object.add [as done] (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin…:45)
    at Array.<anonymous> (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin…:47)
    at Function.each (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin…:5)
    at Object.<anonymous> (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin…:47)
    at Function.Deferred (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin…:47)
    at Object.then (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin…:46)
    at VeUiMwSaveDialog.getDiffElementPromise (load.php?debug=false&lang=en&modules=diffMatchPatch%2Coojs-ui-core%2Coojs-ui-widgets%2Cpapaparse%2C…:21861)
    at VeUiMwSaveDialog.ve.ui.MWSaveDialog.updateReviewMode (load.php?debug=false&lang=en&modules=diffMatchPatch%2Coojs-ui-core%2Coojs-ui-widgets%2Cpapaparse%2C…:22174)
    at load.php?debug=false&lang=en&modules=diffMatchPatch%2Coojs-ui-core%2Coojs-ui-widgets%2Cpapaparse%2C…:21989

In this case, it looks like it's trying to find a hash in the store that's not there. Stepping down to the getChangedNodeElements frame, the hash is in this.oldDoc.store but not in this.newDoc.store or documentSlice.store. Between different test sessions it has varied for me what it refers to, but it's usually a link that appears early in the article (when I most recently tried it, it was the link to Phil Zimmerman).

Is it maybe trying to reuse the store/document from before I switched to source mode?

Event Timeline

In beta labs, I can reproduce this on a simple sandbox page, but I get a slightly different error: Uncaught Error: Annotation with index hde03dda5232c856c not found in store. This is probably because of rGVED8f4b2339ae02: dm.AnnotationSet: Throw an exception when constructing with missing indexes.

Jdforrester-WMF moved this task from To Triage to TR6: Visual diffs on the VisualEditor board.
Jdforrester-WMF set the point value for this task to 1.

I just tried reproducing both of these examples, but looks like it's fixed now?

Deskana claimed this task.
Deskana changed the point value for this task from 1 to 0.
Deskana subscribed.

I can't reproduce either, so I assume this was fixed at some point. If someone can still reproduce, feel free to reopen with your reproduction steps.