WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 68348
String#split is buggy
https://bugs.webkit.org/show_bug.cgi?id=68348
Summary
String#split is buggy
Mathias Bynens
Reported
2011-09-19 04:19:25 PDT
Spec:
http://es5.github.com/x15.5.html#x15.5.4.14
Test case:
http://stevenlevithan.com/demo/split.cfm
'.'.split(/()()/); // should return ["."] but instead returns ["", "", "."] '.'.split(/(.??)(.??)/); // should return ["."] but instead returns ["", "", "."] 'tesst'.split(/(s)*/); // should return ["t", undefined, "e", "s", "t"] but returns [undefined, "t", undefined, "e", "s", undefined, "t"] 'tesst'.split(/(s)*?/); // should return ["t", undefined, "e", undefined, "s", undefined, "s", undefined, "t"] but returns [undefined, "t", undefined, "e", undefined, "s", undefined, "s", undefined, "t"] 'tesst'.split(/(s*)/); // should return ["t", "", "e", "ss", "t"] but returns ["", "t", "", "e", "ss", "", "t"] 'tesst'.split(/(s*?)/); // should return ["t", "", "e", "", "s", "", "s", "", "t"] but returns ["", "t", "", "e", "", "s", "", "s", "", "t"]
Attachments
Fix
(25.20 KB, patch)
2011-09-19 18:03 PDT
,
Gavin Barraclough
sam
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Gavin Barraclough
Comment 1
2011-09-19 18:03:18 PDT
Created
attachment 107951
[details]
Fix
WebKit Review Bot
Comment 2
2011-09-19 18:07:17 PDT
Attachment 107951
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast..." exit_code: 1 Source/JavaScriptCore/runtime/StringPrototype.cpp:824: Should have only a single space after a punctuation in a comment. [whitespace/comments] [5] Source/JavaScriptCore/runtime/StringPrototype.cpp:827: Should have only a single space after a punctuation in a comment. [whitespace/comments] [5] Source/JavaScriptCore/runtime/StringPrototype.cpp:928: Semicolon defining empty statement for this loop. Use { } instead. [whitespace/semicolon] [5] Total errors found: 3 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Sam Weinig
Comment 3
2011-09-19 18:09:04 PDT
Comment on
attachment 107951
[details]
Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=107951&action=review
> Source/JavaScriptCore/runtime/StringPrototype.cpp:806 > + // 3. Let A be a new array created as if by the expression new Array()where Array is the
Weird spacing.
> Source/JavaScriptCore/runtime/StringPrototype.cpp:813 > + // 5. If limit is undefined, let lim = 2^32รข1; else let lim = ToUint32(limit).
I think you have a unicode!
Gavin Barraclough
Comment 4
2011-09-19 18:41:00 PDT
Fixed in
r95504
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug