Bug #78918

Pasting long text into the RTE leads to browser crashes

Added by Marco Huber almost 3 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2016-12-08
Due date:
% Done:

0%

TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

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.

Examples:
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.

Testtable.doc (38.5 KB) Marco Huber, 2016-12-12 13:53


Related issues

Related to TYPO3 Core - Bug #70246: RTE fields do not handle eval validation like required Closed 2015-10-01

History

#1 Updated by Marco Huber almost 3 years ago

  • Category set to RTE (rtehtmlarea + ckeditor)

#2 Updated by Gerrit Code Review almost 3 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50932

#3 Updated by Marco Huber almost 3 years ago

I can reproduce this bug in the IE11 with pasting the table from the attached doc and the following TsConfig:

User-TsConfig:

setup.default.rteCleanPasteBehaviour = pasteStructure

Page-TsConfig:

RTE.default {
    buttons{
        pastetoggle {
            setActiveOnRteOpen = 1
            hidden = 1
        }

        pastebehaviour {
            pasteStructure.keepTags = a,p,h[2-3],pre,address,article,aside,blockquote,div,footer,header,nav,section,hr,br,table,thead,tbody,tfoot,caption,tr,th,td,ul,ol,dl,li,dt,dd,b,i,strong,em
        }
    }
}

#4 Updated by Gerrit Code Review almost 3 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50932

#5 Updated by Gerrit Code Review over 2 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50932

#6 Updated by Gerrit Code Review over 2 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50932

#7 Updated by Gerrit Code Review over 2 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50932

#8 Updated by Riccardo De Contardi almost 2 years ago

  • Status changed from Under Review to Closed

We are sorry, but we close this issue as now TYPO3 uses CKEditor and RTEHtmlarea is no more supported by TYPO3 .

RTEHtmlarea development has stopped - it has been decoupled from the core and its code is available on GitHub:
https://github.com/FriendsOfTYPO3/rtehtmlarea

If you still need this fixed please create a PR on GitHub

Regards
Riccardo De Contardi

Also available in: Atom PDF