Skip to content

Commit 0828391

Browse files
masayuki-nakanomoz-wptsync-bot
authored andcommitted
Make DocumentModifiedEvent and HTMLEditor::OnModifyDocument assume there is no editing host
The logic before getting editing host in them are correct, but both `nsIContent::GetEditingHost()` and `HTMLEditor::ComputeEditingHostInternal()` return `Document::GetBody()` result if it's in the design mode. For now, we should just add nullptr checks into the methods since they are required only for some specific web apps. Differential Revision: https://phabricator.services.mozilla.com/D234442 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1941827 gecko-commit: a177fb513de65e6af5daf405f96baced5702e3fa gecko-reviewers: m_kato
1 parent c9cae21 commit 0828391

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<script>
6+
document.addEventListener("DOMContentLoaded", () => {
7+
document.designMode = "on";
8+
document.documentElement.innerText = "abc def\n"; // causes removing the implicit <body> element
9+
let child;
10+
while ((child = document.documentElement.lastChild)) {
11+
child.remove();
12+
}
13+
}, {once: true});
14+
</script>
15+
</head>
16+
</html>

0 commit comments

Comments
 (0)