Pasting long text into the RTE leads to browser crashes
The browser crashes, if you copy a long text into the RTE. This happens always in the IE and if you open the developer toolbar it happens in the firefox, too.
I think the reason is this patch: https://review.typo3.org/#/c/44810/
The event DOMSubtreeModified is triggered very often on changes in the RTE. And because everytime the event is triggered a complete form validation is startet, the script runtime gets to long and makes the browser crash.
How often the event is triggered depends on which transformations are done while pasting content into the RTE. I mean, which tags and attributes are allowed and which should be removed and so on.
1. If you make a linebreak in an empty RTE, then the event is triggered 3 times.
2. If you paste the text "asd" into an emtpy RTE, then the event is triggered 1 time.
3. If you paste the two textblocks "TYPO3 Schulungen" and "TYPO3 Hosting" from https://typo3.bgm-gmbh.de/leistungen/ into an empty RTE, then the event is triggered more than 30 times (then my browser crached ;-)).
3.1 If you deaktivate the validation in the function Editor.prototype.onDOMSubtreeModified, then the event ist triggered "only" 9 times.
To count how often the event is triggered I added this code to the function Editor.prototype.onDOMSubtreeModified:
this.onDOMSubtreeModifiedCounter = this.onDOMSubtreeModifiedCounter || 0; this.onDOMSubtreeModifiedCounter++; console.log(this.onDOMSubtreeModifiedCounter);
Perheps there is a better event to start the validation? Perheps when the hidden textarea is updated? But I haven't found the place where this happens.