Esanders has uploaded a new change for review.

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


Change subject: UncodeJS treating start/end tags as letters
......................................................................

UncodeJS treating start/end tags as letters

Becuase /[a-z]/.test(null) treats null as the string 'null' and
so returns true.

Bug: 48487
Change-Id: I2408229cddd876ff8fe55a9eddf9bac87a61457e
---
M modules/unicodejs/unicodejs.wordbreak.js
M modules/unicodejs/unicodejs.wordbreak.test.js
2 files changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/81/64481/1

diff --git a/modules/unicodejs/unicodejs.wordbreak.js 
b/modules/unicodejs/unicodejs.wordbreak.js
index f6a9e3c..25dce72 100644
--- a/modules/unicodejs/unicodejs.wordbreak.js
+++ b/modules/unicodejs/unicodejs.wordbreak.js
@@ -23,6 +23,10 @@
        }
 
        function getGroup( chr ) {
+               // null converts to 'null' in RegExp#test
+               if ( chr === null ) {
+                       return null;
+               }
                var group;
                for ( group in patterns ) {
                        if ( patterns[group].test( chr ) ) {
diff --git a/modules/unicodejs/unicodejs.wordbreak.test.js 
b/modules/unicodejs/unicodejs.wordbreak.test.js
index 769e610..ca33b26 100644
--- a/modules/unicodejs/unicodejs.wordbreak.test.js
+++ b/modules/unicodejs/unicodejs.wordbreak.test.js
@@ -22,7 +22,7 @@
                        // 40 - 50
                        "汉字/漢字 c\u0300\u0327k" +
                        // 50 - 60
-                       " c\u0300\u0327",
+                       " c\u0300\u0327 a.",
                        /*jshint quotmark:single */
                textString = new unicodeJS.TextString( text ),
                breaks = [
@@ -31,7 +31,7 @@
                        21, 25, 30,
                        31, 39, 40,
                        41, 42, 43, 44, 45, 46, 50,
-                       51, 54
+                       51, 54, 55, 56, 57
                ];
 
        QUnit.expect( text.length + 1 );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2408229cddd876ff8fe55a9eddf9bac87a61457e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>

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

Reply via email to