Skip to content

Avoid using a null edit toolbar when the editor is removed while it's being built (issue 22341) - #22362

Open
cestercian wants to merge 1 commit into
mozilla:masterfrom
cestercian:fix-edit-toolbar-null-after-delete
Open

cestercian wants to merge 1 commit into
mozilla:masterfrom
cestercian:fix-edit-toolbar-null-after-delete

Conversation

@cestercian

Copy link
Copy Markdown

addEditToolbar awaits this._editToolbar.addButton(...), and if the editor gets removed in the meantime (e.g. delete() while a FreeText editor is still being edited) _editToolbar is null when it resumes, so it throws Cannot read properties of null (reading 'addButton').

Now the toolbar is kept in a local and we bail out if _editToolbar isn't that instance anymore after the await. Added an integration test that deletes a FreeText editor mid-edit and checks there's no error, then undoes and checks there's a single toolbar.

Fixes #22341

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Editor] "Cannot read properties of null (reading 'addButton')" when deleting a FreeText editor that is in edit mode

2 participants