Open Bug 1454900 Opened 2 years ago Updated Last year

Editor methods which changes DOM tree should return new error code which means editor is destroyed

Categories

(Core :: DOM: Editor, enhancement, P3)

enhancement

Tracking

()

Tracking Status
firefox61 --- affected

People

(Reporter: masayuki, Unassigned)

References

Details

When I work on bug 1451672, I also struggled with the wallpapers like:

NS_ENSURE_STATE(mHTMLEditor);
mHTMLEditor->Foo();

This is safer, but not correct approach and the code is too ugly. I think that any editor methods which changes DOM tree should return new error code when editor is destroyed during the change. And then, if the return code is marked as MOZ_MUST_USE, all callers in any places can return from current job quickly and surely.

Perhaps, NS_ERROR_EDITOR_DESTROYED? (Perhaps, we need to check if mutation event listener changed DOM tree, e.g., inserting node is removed from the tree etc. But it should needs more investigation.)
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.