Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught DOMException: Failed to execute 'setStart' on 'Range' upon Undo/Redo #3158

Closed
bsilvern opened this issue Jun 12, 2019 · 5 comments · Fixed by #3325
Closed

Uncaught DOMException: Failed to execute 'setStart' on 'Range' upon Undo/Redo #3158

bsilvern opened this issue Jun 12, 2019 · 5 comments · Fixed by #3325
Assignees
Labels
browser:chrome The issue can only be reproduced in the Chrome browser. browser:safari The issue can only be reproduced in the Safari browser. plugin:undo The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. support:2 An issue reported by a commercially licensed client. type:bug A bug.
Milestone

Comments

@bsilvern
Copy link

bsilvern commented Jun 12, 2019

Type of report

Bug

Provide detailed reproduction steps (if any)

While performing Undo or Redo, on numerous seemingly random occasions, I've observed messages such as the following in the console:
Uncaught DOMException: Failed to execute 'setStart' on 'Range': There is no child at offset 6, accompanied by a loss of function of the Undo/Redo keys, as if the snapshot stack had become truncated.

The presence of <br>'s rather than <p>'s appears to be a critical element in this issue. The following sequence provides a repeatable example:

  1. Go to https://ckeditor.com/docs/ckeditor4/latest/examples/htmlformatting.html.

  2. Replace the contents of the editor (in Source mode) with the following:
    <img alt="" src="https://ckeditor.com/apps/ckfinder/userfiles/images/pebbles.jpg" style="float:left; height:40px; width:60px">​​​​

  3. Click Source (to go to WYSIWYG mode)

  4. Click the image

  5. Hit the following keys:

    • Ctrl-X (Cut)
    • Ctrl-V (Paste)
    • End
    • Shift-Enter (to enter a <br>)
    • Paste
    • Shift-Enter (to enter a <br>)
    • foo (enter any text)
    • Undo

Expected result

The entered text "foo" should be removed. Further Undos should remove the images.

Actual result

"foo" is removed, but Undo/Redo no longer function.

The following error is observed in the console:

ckeditor.js:454 Uncaught DOMException: Failed to execute 'setStart' on 'Range': There is no child at offset 6.
    at CKEDITOR.dom.selection.selectRanges (https://ckeditor.com/docs/vendors/4.11.4/ckeditor/ckeditor.js:454:418)
    at CKEDITOR.dom.selection.selectBookmarks (https://ckeditor.com/docs/vendors/4.11.4/ckeditor/ckeditor.js:457:393)
    at CKEDITOR.plugins.undo.UndoManager.restoreImage (https://ckeditor.com/docs/vendors/4.11.4/ckeditor/ckeditor.js:1093:96)
    at CKEDITOR.plugins.undo.UndoManager.redo (https://ckeditor.com/docs/vendors/4.11.4/ckeditor/ckeditor.js:1094:454)
    at window.CKEDITOR.window.CKEDITOR.dom.CKEDITOR.command.exec (https://ckeditor.com/docs/vendors/4.11.4/ckeditor/ckeditor.js:1087:467)
    at window.CKEDITOR.window.CKEDITOR.dom.CKEDITOR.command.exec (https://ckeditor.com/docs/vendors/4.11.4/ckeditor/ckeditor.js:201:500)
    at a.execCommand (https://ckeditor.com/docs/vendors/4.11.4/ckeditor/ckeditor.js:270:143)
    at window.CKEDITOR.window.CKEDITOR.dom.CKEDITOR.keystrokeHandler.e (https://ckeditor.com/docs/vendors/4.11.4/ckeditor/ckeditor.js:242:238)
    at $.h (https://ckeditor.com/docs/vendors/4.11.4/ckeditor/ckeditor.js:10:70)
    at $.fire (https://ckeditor.com/docs/vendors/4.11.4/ckeditor/ckeditor.js:11:433)
selectRanges @ ckeditor.js:454
selectBookmarks @ ckeditor.js:457
restoreImage @ ckeditor.js:1093
redo @ ckeditor.js:1094
exec @ ckeditor.js:1087
exec @ ckeditor.js:201
execCommand @ ckeditor.js:270
e @ ckeditor.js:242
h @ ckeditor.js:10
(anonymous) @ ckeditor.js:11
(anonymous) @ ckeditor.js:63

Other details

  • Browser: Vivaldi 2.5.1525.48
  • OS: Win 8.1
  • CKEditor version: at least 4.10.0
  • Installed CKEditor plugins: dialogui,dialog,a11yhelp,about,basicstyles,blockquote,notification,button,toolbar,clipboard,panel,floatpanel,menu,contextmenu,elementspath,indent,indentlist,list,enterkey,entities,popup,filetools,filebrowser,floatingspace,listblock,richcombo,format,horizontalrule,htmlwriter,image,fakeobjects,link,magicline,maximize,pastefromword,pastetext,removeformat,resize,menubutton,scayt,showborders,sourcearea,specialchar,stylescombo,tab,table,tabletools,tableselection,undo,lineutils,widgetselection,widget,notificationaggregator,uploadwidget,uploadimage,wsc,wysiwygarea
@bsilvern bsilvern added the type:bug A bug. label Jun 12, 2019
@jacekbogdanski jacekbogdanski self-assigned this Jun 17, 2019
@jacekbogdanski jacekbogdanski added plugin:undo The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. labels Jun 17, 2019
@jacekbogdanski
Copy link
Member

I can reproduce the issue on Chrome. It looks like a selection bookmarked by the undo manager is somehow corrupted after inserting the next image at the next line broken with br (using SHIFT + ENTER).

@jacekbogdanski jacekbogdanski removed their assignment Jun 17, 2019
@remigasas
Copy link

I can reproduce this issue as well.
Chrome & ckeditor: "4.11.1".

No reliable way to reproduce it, happens editing li element and doing undo.
DOMException: Failed to execute 'setStart' on 'Range': The offset 14 is larger than the node's length (7).
Because exception refers to text nodes (nodeName: "#text") and offset difference (offset - length) is typically 7.

Perhaps it is somehow related to 8203 chars ?

@eszczygiel eszczygiel added the support:3 An issue reported by a commercially licensed client. label Aug 8, 2019
@jacekbogdanski jacekbogdanski self-assigned this Aug 8, 2019
@jacekbogdanski
Copy link
Member

Perhaps it is somehow related to 8203 chars ?

Yes, that's the case. The issue exists only on chromium browsers. We are currently investigating it and hopefully will be able to provide bug fix soon.

@Comandeer
Copy link
Member

The issue is present also in Safari browsers. The same reproduction steps throw following error:

[Error] IndexSizeError: The index is not in the allowed range.
	setStart (selection.js:2206)
	selectRanges (selection.js:2206)
	selectBookmarks (selection.js:2402)
	restoreImage (plugin.js:443)
	undo (plugin.js:528)
	exec (plugin.js:33)
	exec (command.js:56)
	execCommand (editor.js:976)
	(anonymous function) (plugin.js:87)
	execute (plugin.js:165)
	(anonymous function) (plugin.js:197)
	(anonymous function) (tools.js:828)
	callFunction (tools.js:856)
	onclick (Script Element 4:1)

@Comandeer Comandeer added browser:chrome The issue can only be reproduced in the Chrome browser. browser:safari The issue can only be reproduced in the Safari browser. labels Aug 11, 2019
@Comandeer Comandeer added this to the 4.13.0 milestone Aug 14, 2019
@lslowikowska lslowikowska added support:2 An issue reported by a commercially licensed client. and removed support:3 An issue reported by a commercially licensed client. labels Aug 21, 2019
@mudasir-ganayee124
Copy link

i have the sam issue in office.com/setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser:chrome The issue can only be reproduced in the Chrome browser. browser:safari The issue can only be reproduced in the Safari browser. plugin:undo The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. support:2 An issue reported by a commercially licensed client. type:bug A bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants