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
1fc9b2e9
Commit
1fc9b2e9
authored
Nov 30, 2018
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Support undefined separator in String.split implementation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8780a4fa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
6 deletions
+89
-6
string.c
dlls/jscript/string.c
+20
-5
api.js
dlls/jscript/tests/api.js
+22
-0
es5.js
dlls/mshtml/tests/es5.js
+47
-1
No files found.
dlls/jscript/string.c
View file @
1fc9b2e9
...
...
@@ -1140,17 +1140,32 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE
(
"
\n
"
);
if
(
argc
!=
1
&&
argc
!=
2
)
{
FIXME
(
"unsupported argc %u
\n
"
,
argc
);
return
E_NOTIMPL
;
}
hres
=
get_string_flat_val
(
ctx
,
jsthis
,
&
jsstr
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
length
=
jsstr_length
(
jsstr
);
if
(
!
argc
||
(
is_undefined
(
argv
[
0
])
&&
ctx
->
version
>=
SCRIPTLANGUAGEVERSION_ES5
))
{
if
(
!
r
)
return
S_OK
;
hres
=
create_array
(
ctx
,
0
,
&
array
);
if
(
FAILED
(
hres
))
return
hres
;
/* NOTE: according to spec, we should respect limit argument here (if provided).
* We have a test showing that it's broken in native IE. */
hres
=
jsdisp_propput_idx
(
array
,
0
,
jsval_string
(
jsstr
));
if
(
FAILED
(
hres
))
{
jsdisp_release
(
array
);
return
hres
;
}
*
r
=
jsval_obj
(
array
);
return
S_OK
;
}
if
(
argc
>
1
&&
!
is_undefined
(
argv
[
1
]))
{
hres
=
to_uint32
(
ctx
,
argv
[
1
],
&
limit
);
if
(
FAILED
(
hres
))
{
...
...
dlls/jscript/tests/api.js
View file @
1fc9b2e9
...
...
@@ -618,6 +618,28 @@ ok(r[0] === "1", "r[0] = " + r[0]);
ok
(
r
[
1
]
===
"2"
,
"r[1] = "
+
r
[
1
]);
ok
(
r
[
2
]
===
"3"
,
"r[1] = "
+
r
[
1
]);
r
=
"1,2,3"
.
split
(
undefined
);
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
1
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
"1,2,3"
,
"r[0] = "
+
r
[
0
]);
r
=
"1,undefined2undefined,3"
.
split
(
undefined
);
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
3
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
"1,"
,
"r[0] = "
+
r
[
0
]);
ok
(
r
[
1
]
===
"2"
,
"r[1] = "
+
r
[
1
]);
ok
(
r
[
2
]
===
",3"
,
"r[2] = "
+
r
[
2
]);
r
=
"1,undefined2undefined,3"
.
split
();
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
1
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
"1,undefined2undefined,3"
,
"r[0] = "
+
r
[
0
]);
r
=
""
.
split
();
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
1
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
""
,
"r[0] = "
+
r
[
0
]);
tmp
=
"abcd"
.
indexOf
(
"bc"
,
0
);
ok
(
tmp
===
1
,
"indexOf = "
+
tmp
);
tmp
=
"abcd"
.
indexOf
(
"bc"
,
1
);
...
...
dlls/mshtml/tests/es5.js
View file @
1fc9b2e9
...
...
@@ -460,6 +460,51 @@ function test_global_properties() {
next_test
();
}
function
test_string_split
()
{
var
r
;
/* IE9 got this wrong*/
if
(
"1undefined2"
.
split
(
undefined
).
length
!=
1
)
{
win_skip
(
"detected broken String.prototype.split implementation"
);
next_test
();
return
;
}
r
=
"1,2,3"
.
split
(
undefined
);
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
1
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
"1,2,3"
,
"r[0] = "
+
r
[
0
]);
r
=
"1,undefined2undefined,3"
.
split
(
undefined
);
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
1
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
"1,undefined2undefined,3"
,
"r[0] = "
+
r
[
0
]);
r
=
"1,undefined2undefined,3"
.
split
();
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
1
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
"1,undefined2undefined,3"
,
"r[0] = "
+
r
[
0
]);
/* note: spec violation, limit is ignored */
r
=
"1,undefined2undefined,3"
.
split
(
undefined
,
0
);
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
1
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
"1,undefined2undefined,3"
,
"r[0] = "
+
r
[
0
]);
r
=
"1,undefined2null,3"
.
split
(
null
);
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
2
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
"1,undefined2"
,
"r[0] = "
+
r
[
0
]);
ok
(
r
[
1
]
===
",3"
,
"r[1] = "
+
r
[
1
]);
r
=
""
.
split
();
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
1
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
""
,
"r[0] = "
+
r
[
0
]);
next_test
();
}
var
tests
=
[
test_date_now
,
test_toISOString
,
...
...
@@ -469,5 +514,6 @@ var tests = [
test_getOwnPropertyDescriptor
,
test_defineProperty
,
test_string_trim
,
test_global_properties
test_global_properties
,
test_string_split
];
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