Arlolra has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/232733

Change subject: T109686: Fix crasher in normalizer
......................................................................

T109686: Fix crasher in normalizer

 * There needs to be a next node to migrate trailing spaces.

Change-Id: Iffb1a00bbdfd5fbd22207c31f053d6bf70e2e3ea
---
M lib/wts.normalizeDOM.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/33/232733/1

diff --git a/lib/wts.normalizeDOM.js b/lib/wts.normalizeDOM.js
index dba11bb..925a259 100644
--- a/lib/wts.normalizeDOM.js
+++ b/lib/wts.normalizeDOM.js
@@ -215,7 +215,7 @@
        if (!this.inRtTestMode && endsInSpace) {
                last.nodeValue = last.nodeValue.substring(0, endsInSpace.index);
                // Try to be a little smarter and drop the spaces if possible.
-               if (!/^\s+/.test(next.nodeValue)) {
+               if (next && (!DU.isText(next) || !/^\s+/.test(next.nodeValue))) 
{
                        if (!DU.isText(next)) {
                                var txt = node.ownerDocument.createTextNode('');
                                node.parentNode.insertBefore(txt, next);

-- 
To view, visit https://gerrit.wikimedia.org/r/232733
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iffb1a00bbdfd5fbd22207c31f053d6bf70e2e3ea
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to