Title: [198866] trunk
- Revision
- 198866
- Author
- msab...@apple.com
- Date
- 2016-03-30 17:38:20 -0700 (Wed, 30 Mar 2016)
Log Message
[ES6] Quantified unicode regular expressions do not work for counts greater than 1
https://bugs.webkit.org/show_bug.cgi?id=156044
Reviewed by Mark Lam.
Source/_javascript_Core:
Fixed incorrect indexing of non-BMP characters in fixed patterns. The old code
was indexing by character units, a single JS character, instead of code points
which is 2 JS characters.
* yarr/YarrInterpreter.cpp:
(JSC::Yarr::Interpreter::matchDisjunction):
LayoutTests:
Added new test cases.
* js/regexp-unicode-expected.txt:
* js/script-tests/regexp-unicode.js:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (198865 => 198866)
--- trunk/LayoutTests/ChangeLog 2016-03-30 23:44:08 UTC (rev 198865)
+++ trunk/LayoutTests/ChangeLog 2016-03-31 00:38:20 UTC (rev 198866)
@@ -1,3 +1,15 @@
+2016-03-30 Michael Saboff <msab...@apple.com>
+
+ [ES6] Quantified unicode regular expressions do not work for counts greater than 1
+ https://bugs.webkit.org/show_bug.cgi?id=156044
+
+ Reviewed by Mark Lam.
+
+ Added new test cases.
+
+ * js/regexp-unicode-expected.txt:
+ * js/script-tests/regexp-unicode.js:
+
2016-03-30 Myles C. Maxfield <mmaxfi...@apple.com>
[OS X] [RTL Scrollbars] Overlay RTL scrollbars animate in from the wrong side
Modified: trunk/LayoutTests/js/regexp-unicode-expected.txt (198865 => 198866)
--- trunk/LayoutTests/js/regexp-unicode-expected.txt 2016-03-30 23:44:08 UTC (rev 198865)
+++ trunk/LayoutTests/js/regexp-unicode-expected.txt 2016-03-31 00:38:20 UTC (rev 198866)
@@ -57,6 +57,11 @@
PASS re2.test("A") is true
PASS re2.test("\x{FFFF}") is false
PASS re2.test("𒍅") is true
+PASS /𝌆{2}/u.test("𝌆𝌆") is true
+PASS /𝌆{2}/u.test("𝌆𝌆") is true
+PASS "𐐁𐐁𐐀".match(/𐐁{1,3}/u)[0] is "𐐁𐐁"
+PASS "𐐁𐐩".match(/𐐁{1,3}/iu)[0] is "𐐁𐐩"
+PASS "𐐁𐐩𐐪𐐩".match(/𐐁{1,}/iu)[0] is "𐐁𐐩"
PASS "𐌑𐌑𐌑".match(/𐌑*a|𐌑*./u)[0] is "𐌑𐌑𐌑"
PASS "a𐌑𐌑".match(/a𐌑*?$/u)[0] is "a𐌑𐌑"
PASS "a𐌑𐌑𐌑c".match(/a𐌑*cd|a𐌑*c/u)[0] is "a𐌑𐌑𐌑c"
Modified: trunk/LayoutTests/js/script-tests/regexp-unicode.js (198865 => 198866)
--- trunk/LayoutTests/js/script-tests/regexp-unicode.js 2016-03-30 23:44:08 UTC (rev 198865)
+++ trunk/LayoutTests/js/script-tests/regexp-unicode.js 2016-03-31 00:38:20 UTC (rev 198866)
@@ -92,6 +92,13 @@
// shouldBeNull('/\uD803\u{10c01}/u.exec("\uD803")');
// shouldBe('"\uD803\u{10c01}".match(/\uD803\u{10c01}/u)[0].length', '3');
+// Check quantified matches
+shouldBeTrue('/\u{1d306}{2}/u.test("\u{1d306}\u{1d306}")');
+shouldBeTrue('/\uD834\uDF06{2}/u.test("\uD834\uDF06\uD834\uDF06")');
+shouldBe('"\u{10401}\u{10401}\u{10400}".match(/\u{10401}{1,3}/u)[0]', '"\u{10401}\u{10401}"');
+shouldBe('"\u{10401}\u{10429}".match(/\u{10401}{1,3}/iu)[0]', '"\u{10401}\u{10429}"');
+shouldBe('"\u{10401}\u{10429}\u{1042a}\u{10429}".match(/\u{10401}{1,}/iu)[0]', '"\u{10401}\u{10429}"');
+
// Check back tracking on partial matches
shouldBe('"\u{10311}\u{10311}\u{10311}".match(/\u{10311}*a|\u{10311}*./u)[0]', '"\u{10311}\u{10311}\u{10311}"');
shouldBe('"a\u{10311}\u{10311}".match(/a\u{10311}*?$/u)[0]', '"a\u{10311}\u{10311}"');
Modified: trunk/Source/_javascript_Core/ChangeLog (198865 => 198866)
--- trunk/Source/_javascript_Core/ChangeLog 2016-03-30 23:44:08 UTC (rev 198865)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-03-31 00:38:20 UTC (rev 198866)
@@ -1,3 +1,17 @@
+2016-03-30 Michael Saboff <msab...@apple.com>
+
+ [ES6] Quantified unicode regular expressions do not work for counts greater than 1
+ https://bugs.webkit.org/show_bug.cgi?id=156044
+
+ Reviewed by Mark Lam.
+
+ Fixed incorrect indexing of non-BMP characters in fixed patterns. The old code
+ was indexing by character units, a single JS character, instead of code points
+ which is 2 JS characters.
+
+ * yarr/YarrInterpreter.cpp:
+ (JSC::Yarr::Interpreter::matchDisjunction):
+
2016-03-30 Mark Lam <mark....@apple.com>
Make the $vm debugging tools available to builtins as @$vm.
Modified: trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp (198865 => 198866)
--- trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp 2016-03-30 23:44:08 UTC (rev 198865)
+++ trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp 2016-03-31 00:38:20 UTC (rev 198866)
@@ -1224,7 +1224,7 @@
if (unicode) {
if (!U_IS_BMP(currentTerm().atom.patternCharacter)) {
for (unsigned matchAmount = 0; matchAmount < currentTerm().atom.quantityCount; ++matchAmount) {
- if (!checkSurrogatePair(currentTerm().atom.patternCharacter, currentTerm().inputPosition - matchAmount)) {
+ if (!checkSurrogatePair(currentTerm().atom.patternCharacter, currentTerm().inputPosition - 2 * matchAmount)) {
BACKTRACK();
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes