Bug 1460509 - part 34: Make HTMLEditRules::MaybeSplitAncestorsForInsertWithTransaction() return NS_ERROR_EDITOR_DESTROYED if it causes destroying the editor r=m_kato

MozReview-Commit-ID: 7MqtKPNAOZ1

--HG--
extra : rebase_source : e66f057754082e0b28f14311462a84516c06cc37
This commit is contained in:
Masayuki Nakano 2018-05-14 23:55:53 +09:00
parent a3320a815b
commit 76e7240d35
2 changed files with 6 additions and 3 deletions

View File

@ -8385,6 +8385,9 @@ HTMLEditRules::MaybeSplitAncestorsForInsertWithTransaction(
*pointToInsert.GetChild(),
aStartOfDeepestRightNode,
SplitAtEdges::eAllowToCreateEmptyContainer);
if (NS_WARN_IF(!CanHandleEditAction())) {
return SplitNodeResult(NS_ERROR_EDITOR_DESTROYED);
}
NS_WARNING_ASSERTION(splitNodeResult.Succeeded(),
"Failed to split the node for insert the element");
return splitNodeResult;

View File

@ -528,9 +528,9 @@ protected:
* the point to insert the element.
*/
template<typename PT, typename CT>
SplitNodeResult MaybeSplitAncestorsForInsertWithTransaction(
nsAtom& aTag,
const EditorDOMPointBase<PT, CT>& aStartOfDeepestRightNode);
MOZ_MUST_USE SplitNodeResult
MaybeSplitAncestorsForInsertWithTransaction(
nsAtom& aTag, const EditorDOMPointBase<PT, CT>& aStartOfDeepestRightNode);
/**
* JoinNearestEditableNodesWithTransaction() joins two editable nodes which