Since implementation of document.execCommand() is the *huge* source bugs of editing bugs, Cluster Fuzz found lots of bug, we would like to fix these bugs.
But, it is hard to fix them, Becasue it is very old code, +12 years old, with lots of ad-hoc things and fragile, e.g. it allows executing JavaScript script during command execution to invalid node positions hold in C++ memory, and it updates layout frequently to slow down command execution and consume battery.
Thus, we should re-architecture document.execCommand() to clean, cheap and robust The new architecture will incorporate two phase approach:
Phase 1: Generate editing instructions, e.g. insert node, remove node, change attribute etc, with clean layout tree.
Phase 2: Execute editing instructions and tracking node positions during script execution, e.g. appehChild() can execute script via IFRAME load event or infamous DOM mutation event handler can do.
Comment 1 by gabriel6...@gmail.com
, Jan 12 2017