Page MenuHomePhabricator

Possible to trigger "Error: Invalid start offset: -1" when opening Page Settings on once-contentful, currently blank, page
Closed, ResolvedPublic1 Estimated 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 raised the priority of this task from to Needs Triage.
eranroz updated the task description. (Show Details)
eranroz added a project: VisualEditor.
eranroz subscribed.

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 Medium priority.
Jdforrester-WMF set Security to None.
Jdforrester-WMF moved this task from To Triage to Freezer on the VisualEditor board.

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

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