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

[FF] NS_ERROR_FAILURE thrown randomly when setting DOM selection #14493

Closed
scofalik opened this issue Jun 29, 2023 · 2 comments · Fixed by #14494
Closed

[FF] NS_ERROR_FAILURE thrown randomly when setting DOM selection #14493

scofalik opened this issue Jun 29, 2023 · 2 comments · Fixed by #14494
Labels
browser:firefox package:engine squad:collaboration Issue to be handled by the Collaboration team. type:bug This issue reports a buggy (incorrect) behavior.

Comments

@scofalik
Copy link
Contributor

📝 Provide detailed reproduction steps (if any)

We had problems with NS_ERROR_FAILURE thrown on random occasions, some of them seems fixed (closed issues in this repository), and at least one error is not closed (https://github.com/cksource/collaboration-features/issues/4183).

When testing multi-root editor in RTC environment, this happened again, this time, when removing the last root and performing undo. It seems to not be 100%, but it mostly throws when you do it right. It is an edge case but that's not entirely the point.

The point is that the error is not described and it is hard to find any information about when it would be thrown.

The error is thrown in renderer.ts in _updateDomSelection:

domSelection.collapse( anchor.parent, anchor.offset );
domSelection.extend( focus.parent, focus.offset );

I checked and anchor and focus are set correctly. The DOM elements have same owner document and it is the same as the selection. Everything seems right.

One suggestion I did find when looking for the solution is to use setBaseAndExtent instead. After using it, I wasn't able to reproduce this problem anymore.

Maybe we will be able to fix random FF bugs this way?

@scofalik scofalik added type:bug This issue reports a buggy (incorrect) behavior. package:engine browser:firefox squad:collaboration Issue to be handled by the Collaboration team. labels Jun 29, 2023
@CKEditorBot CKEditorBot added status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. and removed status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. labels Jun 29, 2023
@Witoso
Copy link
Member

Witoso commented Jul 4, 2023

@scofalik could it help solve #9635 in your opinion?

@scofalik
Copy link
Contributor Author

scofalik commented Jul 4, 2023

I thought so initially, but I confused two different things, both being Firefox errors. This one is when we try to set DOM selection, the one you linked is when we want to read the DOM selection.

niegowski added a commit that referenced this issue Jul 25, 2023
Fix (engine): Fix random selection-releated crashes happening on Firefox for unknown reasons (error code `NS_ERROR_FAILURE`). Closes #14493.
@CKEditorBot CKEditorBot removed the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Jul 25, 2023
@CKEditorBot CKEditorBot added this to the iteration 65 milestone Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser:firefox package:engine squad:collaboration Issue to be handled by the Collaboration team. type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
3 participants