Page MenuHomePhabricator

Possible to trigger "Error: Invalid start offset: -1" when opening Page Settings on once-contentful, currently blank, page
Closed, ResolvedPublic1 Story Points

Description

Callstack (using ?debug=1):

ve.Document.prototype.selectNodes(range=VeRange { from=-1, to=-1, start=-1, more...}, mode="covered")ve.Document.js (line 116)
ve.ce.Document.prototype.getDirectionFromSelection(selection=VeDmLinearSelection { documentModel=VeDmDocument, range=VeRange, toJSON=function(), more...})ve.ce.Document.js (line 272)
ve.ui.WindowAction.prototype.open(name="meta", data=Object { page="advancedSettings"}, action=undefined)ve.ui.W...tion.js (line 55)
ve.ui.Surface.prototype.execute(triggerOrAction="window", method="open")ve.ui.Surface.js (line 367)
ve.ui.Command.prototype.execute(surface=VeUiDesktopSurface { visible=true, $element={...}, updateThemeClassesPending=false, more...})ve.ui.Command.js (line 39)
ve.ui.Tool.prototype.onSelect()ve.ui.Tool.js (line 84)
OO.ui.ToolGroup.prototype.onMouseKeyUp(e=mouseup clientX=1625, clientY=230)oojs-ui.js (line 7625)
OO.ui.PopupToolGroup.prototype.onMouseKeyUp(e=mouseup clientX=1625, clientY=230)oojs-ui.js (line 10826)
OO.ui.ListToolGroup.prototype.onMouseKeyUp(e=mouseup clientX=1625, clientY=230)oojs-ui.js (line 11087)
OO.ui.ToolGroup.prototype.onCapturedMouseKeyUp(e=mouseup clientX=1625, clientY=230)oojs-ui.js (line 7609)

Relevant code (start=-1):

if ( start < 0 || start > doc.getLength() ) {
		throw new Error( 'Invalid start offset: ' + start );
	}

How to retest - turn a page to a redirect page by removing its content and opening the page settings:

  1. enter to some page with content
  2. empty the page - e.g ctrl+A & backspace
  3. Click on page settings
  4. page settings doesn't load. exception in console.

Tested with Firefox.

Event Timeline

eranroz created this task.Jul 31 2015, 8:06 AM
eranroz raised the priority of this task from to Needs Triage.
eranroz updated the task description. (Show Details)
eranroz added a project: VisualEditor.
eranroz added a subscriber: eranroz.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 31 2015, 8:06 AM

Which version is this with? Master? I thought we fixed these issues ages ago.

Jdforrester-WMF renamed this task from Error: Invalid start offset: -1 to Possible to trigger "Error: Invalid start offset: -1".Aug 4 2015, 7:09 PM
Jdforrester-WMF assigned this task to eranroz.
Jdforrester-WMF triaged this task as Normal priority.
Jdforrester-WMF set Security to None.
Jdforrester-WMF moved this task from To Triage to Freezer on the VisualEditor board.
eranroz added a comment.EditedAug 4 2015, 7:20 PM

For example on this page: https://en.wikipedia.org/wiki/Zach_Galifianakis?veaction=edit

On latest production version (12d22fe)
reproducible with chrome

Jdforrester-WMF renamed this task from Possible to trigger "Error: Invalid start offset: -1" to Possible to trigger "Error: Invalid start offset: -1" when opening Page Settings on once-contentful, currently blank, page.Sep 16 2015, 11:40 PM
Jdforrester-WMF edited a custom field.

I get an exception when I hit backspace

Minimal test document in ve core:

<div rel="ve:Alien">Alien</div>
<p>Foo</p>

CTRL+A gives a selection from 0 to just inside the </p>, so we didn't trigger the special "you deleted everything" branch in SurfaceFragment#delete

Esanders claimed this task.Oct 29 2015, 6:39 PM

Change 249801 had a related patch set uploaded (by Esanders):
SurfaceFragment: Improve handling of delete all

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

Change 249801 merged by jenkins-bot:
SurfaceFragment: Improve handling of delete all

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