Page MenuHomePhabricator

[Regression wmf.3] Inserting template into a block slug(?) throws "Uncaught Error: Invalid retain length, cannot retain backwards:-1", crashes editor
Closed, ResolvedPublic1 Story Points

Description

I was trying to edit MobileFrontend_font_size_changer.png on mediawiki.org and when I try to insert a template the UI does nothing. The templates I was trying to add were Wikimedia screenshot, Information and cc-by-sa-4.0.

On further inspection I saw this on the console of the devtools:

Firefox 46, OSX 10.11.5

Error: Invalid retain length, cannot retain backwards:-1
ve.dm.Transaction.prototype.pushRetain()
 load.php:325
ve.dm.Transaction.prototype.pushInsertion()
 load.php:330
ve.dm.Transaction.newFromReplacement()
 load.php:309
insertNode()
 load.php:1278
ve.dm.MWTransclusionModel.prototype.insertTransclusionNode/<()
 load.php:1279
.Deferred/promise.then/</</<()
 load.php:47
jQuery.Callbacks/fire()
 load.php:45
jQuery.Callbacks/self.fireWith()
 load.php:46
.Deferred/</deferred[tuple[0]]()
 load.php:47
mw.Api.prototype.ajax/xhr<()
 load.php:133
jQuery.Callbacks/fire()
 load.php:45
jQuery.Callbacks/self.fireWith()
 load.php:46
done()
 load.php:135
.send/callback()
 load.php:141

Event Timeline

Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptMay 26 2016, 9:27 AM
Krinkle added a subscriber: Krinkle.EditedMay 26 2016, 3:40 PM

I can reproduce this bug in Chrome.

  1. https://www.mediawiki.org/wiki/ResourceLoader/Version_1_Design_Specification?action=edit
  2. Insert paragraph on top of the page.
  3. Insert Template. Name: "Tracked". Bug id: T26415. Press "Insert" to finish insertion.

Actual:

Template dialog goes into "pending" animation and never ends.

Console contains:

load.php?debug=false&lang=en&modules=ext.visualEditor.core|oojs-ui-core&skin=vector&version=a5ed76d…:118
Uncaught Error: Invalid retain length, cannot retain backwards:-1

At this point there is no recovery. I can't close the dialog or otherwise get back to the page. Changes are lost (from user perspective).

Krinkle renamed this task from JS Error when trying to insert template in Firefox to Inserting template may throw "Uncaught Error: Invalid retain length, cannot retain backwards:-1".May 26 2016, 3:41 PM
Krinkle edited projects, added VisualEditor-MediaWiki; removed JavaScript.
Jdforrester-WMF renamed this task from Inserting template may throw "Uncaught Error: Invalid retain length, cannot retain backwards:-1" to Inserting template into a block slug(?) throws "Uncaught Error: Invalid retain length, cannot retain backwards:-1", crashes editor.May 26 2016, 3:56 PM
Jdforrester-WMF assigned this task to Esanders.
Jdforrester-WMF triaged this task as Unbreak Now! priority.
Restricted Application added subscribers: Luke081515, TerraCodes, Urbanecm. · View Herald TranscriptMay 26 2016, 3:56 PM

I tried to reproduce this with the template "Citation Needed" but couldnt, it happens for some specific templates. Also, it happens for those templates even if you try to add those outside a block slug.

It happens to block templates.

Jdforrester-WMF renamed this task from Inserting template into a block slug(?) throws "Uncaught Error: Invalid retain length, cannot retain backwards:-1", crashes editor to [Regression wmf.3] Inserting template into a block slug(?) throws "Uncaught Error: Invalid retain length, cannot retain backwards:-1", crashes editor.May 26 2016, 4:27 PM
Jdforrester-WMF set the point value for this task to 1.

Change 290961 merged by jenkins-bot:
Use insertContent with templates when range is collapsed

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

Change 290972 had a related patch set uploaded (by Jforrester):
Use insertContent with templates when range is collapsed

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

Change 290972 merged by jenkins-bot:
Use insertContent with templates when range is collapsed

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

Jdforrester-WMF closed this task as Resolved.May 26 2016, 7:12 PM