Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
3bd3d559
Commit
3bd3d559
authored
Mar 01, 2018
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Array.isArray implementation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
af5edf95
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
2 deletions
+55
-2
array.c
dlls/jscript/array.c
+34
-1
documentmode.js
dlls/mshtml/tests/documentmode.js
+1
-0
es5.js
dlls/mshtml/tests/es5.js
+20
-1
No files found.
dlls/jscript/array.c
View file @
3bd3d559
...
...
@@ -1079,6 +1079,24 @@ static const builtin_info_t ArrayInst_info = {
Array_on_put
};
/* ECMA-262 5.1 Edition 15.4.3.2 */
static
HRESULT
ArrayConstr_isArray
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
jsdisp_t
*
obj
;
TRACE
(
"
\n
"
);
if
(
!
argc
||
!
is_object_instance
(
argv
[
0
]))
{
if
(
r
)
*
r
=
jsval_bool
(
FALSE
);
return
S_OK
;
}
obj
=
iface_to_jsdisp
(
get_object
(
argv
[
0
]));
if
(
r
)
*
r
=
jsval_bool
(
obj
&&
is_class
(
obj
,
JSCLASS_ARRAY
));
if
(
obj
)
jsdisp_release
(
obj
);
return
S_OK
;
}
static
HRESULT
ArrayConstr_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
...
...
@@ -1153,6 +1171,21 @@ static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayI
return
S_OK
;
}
static
const
WCHAR
isArrayW
[]
=
{
'i'
,
's'
,
'A'
,
'r'
,
'r'
,
'a'
,
'y'
,
0
};
static
const
builtin_prop_t
ArrayConstr_props
[]
=
{
{
isArrayW
,
ArrayConstr_isArray
,
PROPF_ES5
|
PROPF_METHOD
|
1
}
};
static
const
builtin_info_t
ArrayConstr_info
=
{
JSCLASS_FUNCTION
,
DEFAULT_FUNCTION_VALUE
,
sizeof
(
ArrayConstr_props
)
/
sizeof
(
*
ArrayConstr_props
),
ArrayConstr_props
,
NULL
,
NULL
};
HRESULT
create_array_constr
(
script_ctx_t
*
ctx
,
jsdisp_t
*
object_prototype
,
jsdisp_t
**
ret
)
{
ArrayInstance
*
array
;
...
...
@@ -1164,7 +1197,7 @@ HRESULT create_array_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdis
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_builtin_constructor
(
ctx
,
ArrayConstr_value
,
ArrayW
,
NULL
,
PROPF_CONSTR
|
1
,
&
array
->
dispex
,
ret
);
hres
=
create_builtin_constructor
(
ctx
,
ArrayConstr_value
,
ArrayW
,
&
ArrayConstr_info
,
PROPF_CONSTR
|
1
,
&
array
->
dispex
,
ret
);
jsdisp_release
(
&
array
->
dispex
);
return
hres
;
...
...
dlls/mshtml/tests/documentmode.js
View file @
3bd3d559
...
...
@@ -122,6 +122,7 @@ function test_javascript() {
test_exposed
(
"JSON"
,
g
,
v
>=
8
);
test_exposed
(
"now"
,
Date
,
true
);
test_exposed
(
"isArray"
,
Array
,
v
>=
9
);
next_test
();
}
...
...
dlls/mshtml/tests/es5.js
View file @
3bd3d559
...
...
@@ -27,6 +27,25 @@ function test_date_now() {
next_test
();
}
function
test_isArray
()
{
function
expect_array
(
a
,
exr
)
{
var
r
=
Array
.
isArray
(
a
);
ok
(
r
===
exr
,
"isArray returned "
+
r
+
" expected "
+
exr
);
}
expect_array
([
1
],
true
);
expect_array
(
Array
,
false
);
expect_array
(
new
Array
(),
true
);
expect_array
({
"1"
:
1
,
"2"
:
2
,
length
:
2
},
false
);
function
C
()
{}
C
.
prototype
=
Array
.
prototype
;
expect_array
(
new
C
(),
false
);
next_test
();
}
var
tests
=
[
test_date_now
test_date_now
,
test_isArray
];
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