Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
88d2576a
Commit
88d2576a
authored
Apr 22, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Don't skip empty strings in String.prototype.split in ES5 mode.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b48cc961
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
string.c
dlls/jscript/string.c
+2
-2
es5.js
dlls/mshtml/tests/es5.js
+35
-0
No files found.
dlls/jscript/string.c
View file @
88d2576a
...
...
@@ -1236,7 +1236,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
ptr2
=
ptr
+
1
;
}
if
(
!
regexp
||
ptr2
>
ptr
)
{
if
(
!
regexp
||
ptr2
>
ptr
||
ctx
->
version
>=
SCRIPTLANGUAGEVERSION_ES5
)
{
tmp_str
=
jsstr_alloc_len
(
ptr
,
ptr2
-
ptr
);
if
(
!
tmp_str
)
{
hres
=
E_OUTOFMEMORY
;
...
...
@@ -1261,7 +1261,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
SUCCEEDED
(
hres
)
&&
(
match_str
||
regexp
)
&&
i
<
limit
)
{
DWORD
len
=
(
str
+
length
)
-
ptr
;
if
(
len
||
match_str
||
!
length
)
{
if
(
len
||
match_str
||
!
length
||
ctx
->
version
>=
SCRIPTLANGUAGEVERSION_ES5
)
{
tmp_str
=
jsstr_alloc_len
(
ptr
,
len
);
if
(
tmp_str
)
{
...
...
dlls/mshtml/tests/es5.js
View file @
88d2576a
...
...
@@ -615,6 +615,41 @@ function test_string_split() {
return
;
}
function
test
(
string
,
separator
,
result
)
{
var
r
=
string
.
split
(
separator
);
ok
(
r
==
result
,
"
\"
"
+
string
+
"
\"
.split("
+
separator
+
") returned "
+
r
+
" expected "
+
result
);
}
test
(
"test"
,
/^|
\s
+/
,
"test"
);
test
(
"test"
,
/$|
\s
+/
,
"test"
);
test
(
"test"
,
/^|./
,
"t,,,"
);
test
(
"test"
,
/.*/
,
","
);
test
(
"test"
,
/x*/
,
"t,e,s,t"
);
test
(
"test"
,
/$|x*/
,
"t,e,s,t"
);
test
(
"test"
,
/^|x*/
,
"t,e,s,t"
);
test
(
"test"
,
/t*/
,
",e,s,"
);
test
(
"xaabaax"
,
/a*|b*/
,
"x,b,x"
);
test
(
"xaabaax"
,
/a+|b+/
,
"x,,,x"
);
test
(
"xaabaax"
,
/a+|b*/
,
"x,,,x"
);
test
(
"xaaxbaax"
,
/b+|a+/
,
"x,x,,x"
);
test
(
"test"
,
/^|t/
,
"tes,"
);
test
(
"test"
,
/^|t/
,
"tes,"
);
test
(
"a,,b"
,
/,/
,
"a,,b"
);
test
(
"ab"
,
/a*/
,
",b"
);
test
(
"aab"
,
"a"
,
",,b"
);
test
(
"a"
,
"a"
,
","
);
function
test_length
(
string
,
separator
,
len
)
{
var
r
=
string
.
split
(
separator
);
ok
(
r
.
length
===
len
,
"
\"
"
+
string
+
"
\"
.split("
+
separator
+
").length = "
+
r
.
length
+
" expected "
+
len
);
}
test_length
(
""
,
/a*/
,
0
);
test_length
(
""
,
/a+/
,
1
);
test_length
(
""
,
""
,
0
);
test_length
(
""
,
"x"
,
1
);
r
=
"1,2,3"
.
split
(
undefined
);
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
1
,
"r.length = "
+
r
.
length
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment