Commit 0e593030 authored by Masayuki Nakano's avatar Masayuki Nakano
Browse files

Bug 1742744 - part 1: Make `CreateElementTransaction::InsertNode()` not return...

Bug 1742744 - part 1: Make `CreateElementTransaction::InsertNode()` not return error if reference child is disconnected r=m_kato

This is a different point from `InsertNodeTransaction`.  If reference node has
been removed from the DOM tree, it tries to insert the given node to end of
the container instead of returning error.  This is an edge case of "redo", and
this is tested by WPT.  If we'd need to back it out with Normandy after shipping
this changes, we'd need to uplift WPT expectation change.  However, we should
avoid this situation.  Therefore, this patch fixes the bug of
`CreateElementTransaction` first.

Differential Revision: https://phabricator.services.mozilla.com/D132118
parent 351e97fb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@ void CreateElementTransaction::InsertNewNode(ErrorResult& aError) {
  // We still know a child, but the child is different element's child,
  // we should just return error.
  if (NS_WARN_IF(mPointToInsert.GetChild() &&
                 mPointToInsert.GetChild()->IsInComposedDoc() &&
                 mPointToInsert.GetContainer() !=
                     mPointToInsert.GetChild()->GetParentNode())) {
    // XXX Is NS_ERROR_EDITOR_UNEXPECTED_DOM_TREE better? Since it won't
+0 −3
Original line number Diff line number Diff line
[undo-redo-after-mutation.html]
  [Redo for execCommand("insertLineBreak") between <b> and <i> after after removing following <i> element with DOM API after undoing]
    expected: FAIL