Bug 1460509 - part 5: Make TextEditRules::CreateTrailingBRIfNeeded() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato

MozReview-Commit-ID: CNTgECam862

--HG--
extra : rebase_source : 633d729868f9cb6a287c45f98497e45a08ef2c95
This commit is contained in:
Masayuki Nakano 2018-05-11 16:31:53 +09:00
parent 349bf14f6b
commit 849d638e49
2 changed files with 4 additions and 1 deletions

View File

@ -1412,6 +1412,9 @@ TextEditRules::CreateTrailingBRIfNeeded()
lastChild->AsElement()->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
NS_LITERAL_STRING("_moz"),
true);
if (NS_WARN_IF(!CanHandleEditAction())) {
return NS_ERROR_EDITOR_DESTROYED;
}
return NS_OK;
}

View File

@ -184,7 +184,7 @@ protected:
/**
* Creates a trailing break in the text doc if there is not one already.
*/
nsresult CreateTrailingBRIfNeeded();
MOZ_MUST_USE nsresult CreateTrailingBRIfNeeded();
/**
* Creates a bogus <br> node if the root element has no editable content.