mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-27 09:43:30 +00:00
Parser: Fix the main loop getting stuck on some signatures
In certain cases the parser could go back rather than forward after finding a signature, causing it to find the same signature forever until it ran out of memory. Test cases coming later in a separate patch. Bug: T356884 Change-Id: I8ac72b05e5e4ed45e6119c012a69708c9d8eda29
This commit is contained in:
parent
9f650c92ee
commit
9db35873a4
|
@ -922,7 +922,8 @@ class CommentParser {
|
|||
$curCommentEnd = $node;
|
||||
} elseif ( $node instanceof Text && ( $match = $this->findTimestamp( $node, $timestampRegexps ) ) ) {
|
||||
$warnings = [];
|
||||
$foundSignature = $this->findSignature( $node, $lastSigNode );
|
||||
$foundSignature = $this->findSignature( $node,
|
||||
$curCommentEnd === $this->rootNode ? null : $curCommentEnd );
|
||||
$author = $foundSignature['username'];
|
||||
$lastSigNode = $foundSignature['nodes'][0];
|
||||
|
||||
|
|
|
@ -895,7 +895,8 @@ Parser.prototype.buildThreadItems = function () {
|
|||
curCommentEnd = node;
|
||||
} else if ( node.nodeType === Node.TEXT_NODE && ( match = this.findTimestamp( node, timestampRegexps ) ) ) {
|
||||
var warnings = [];
|
||||
var foundSignature = this.findSignature( node, lastSigNode );
|
||||
var foundSignature = this.findSignature( node,
|
||||
curCommentEnd === this.rootNode ? null : curCommentEnd );
|
||||
var author = foundSignature.username;
|
||||
lastSigNode = foundSignature.nodes[ 0 ];
|
||||
|
||||
|
|
Loading…
Reference in a new issue