gecko-dev/editor/libeditor/crashtests/1402196.html
Masayuki Nakano b327dea259 Bug 1411345 - HTMLEditRules::GetHighestInlineParent() shouldn't return editing host even when it's the highest inline parent of aNode r=m_kato
HTMLEditRules::BustUpInlinesAtRangeEndpoints() tries to split all inline nodes
at range start and range end.  It uses EditorBase::SplitNodeDeep() to split
the nodes and HTMLEditRules::GetHighestInlineParent() to retrieve the highest
inline parent of them.

Currently, HTMLEditRules::GetHighestInlineParent() may return editing host or
ancestor of it if active editing host is not block.  Then, it may cause
splitting editing host or its parents and following methods of HTMLEditRules
will fail to modify the nodes created outside the editing host.

So, HTMLEditRules::GetHighestInlineParent() should return only one of the
descendants of active editing host.

Unfortunately, even if just adding the test case as a crash test, I cannot
reproduce the crash with automated tests.  Therefore, this patch doesn't
include any automated tests.

And this patch changes a crash test, 1402196.html, which expects that an inline
editing host is split by execCommand("insertOrderedList").  However, this patch
fixes this wrong behavior.  Therefore, this patch changes the event target of
event listener from <p> inside the editing host to the editing host itself.

MozReview-Commit-ID: 8i5ci1fcrDd

--HG--
extra : rebase_source : 572a7b22550a38ca71c954f62eefa695addd53c2
2017-10-31 01:14:58 +09:00

22 lines
575 B
HTML

<!DOCTYPE html>
<html class="reftest-wait">
<head>
<script>
function load() {
document.getElementById("spacer").addEventListener("DOMNodeInserted", () => {
document.getElementById("style").appendChild(
document.getElementById("table"));
document.documentElement.classList.remove("reftest-wait");
});
document.execCommand("insertOrderedList", false);
}
</script>
</head>
<body onload="load()">
<table id="table"></table>
<style id="style"></style>
<spacer id="spacer" contenteditable="true">
<p id="p"></p>
</body>
</html>