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
34d4a9c7
Commit
34d4a9c7
authored
Aug 21, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Add Object.defineProperties implementation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9b4267b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
2 deletions
+65
-2
object.c
dlls/jscript/object.c
+65
-2
No files found.
dlls/jscript/object.c
View file @
34d4a9c7
...
...
@@ -409,6 +409,57 @@ static HRESULT to_property_descriptor(script_ctx_t *ctx, jsdisp_t *attr_obj, pro
return
hres
;
}
static
HRESULT
jsdisp_define_properties
(
script_ctx_t
*
ctx
,
jsdisp_t
*
obj
,
jsval_t
list_val
)
{
DISPID
id
=
DISPID_STARTENUM
;
property_desc_t
prop_desc
;
IDispatch
*
list_disp
;
jsdisp_t
*
list_obj
,
*
desc_obj
;
jsval_t
desc_val
;
BSTR
name
;
HRESULT
hres
;
hres
=
to_object
(
ctx
,
list_val
,
&
list_disp
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
!
(
list_obj
=
to_jsdisp
(
list_disp
)))
{
FIXME
(
"non-JS list obj
\n
"
);
IDispatch_Release
(
list_disp
);
return
E_NOTIMPL
;
}
while
(
1
)
{
hres
=
jsdisp_next_prop
(
list_obj
,
id
,
TRUE
,
&
id
);
if
(
hres
!=
S_OK
)
break
;
hres
=
jsdisp_propget
(
list_obj
,
id
,
&
desc_val
);
if
(
FAILED
(
hres
))
break
;
if
(
!
is_object_instance
(
desc_val
)
||
!
get_object
(
desc_val
)
||
!
(
desc_obj
=
to_jsdisp
(
get_object
(
desc_val
))))
{
jsval_release
(
desc_val
);
break
;
}
hres
=
to_property_descriptor
(
ctx
,
desc_obj
,
&
prop_desc
);
jsdisp_release
(
desc_obj
);
if
(
FAILED
(
hres
))
break
;
hres
=
IDispatchEx_GetMemberName
(
&
list_obj
->
IDispatchEx_iface
,
id
,
&
name
);
if
(
SUCCEEDED
(
hres
))
hres
=
jsdisp_define_property
(
obj
,
name
,
&
prop_desc
);
release_property_descriptor
(
&
prop_desc
);
if
(
FAILED
(
hres
))
break
;
}
jsdisp_release
(
list_obj
);
return
FAILED
(
hres
)
?
hres
:
S_OK
;
}
static
HRESULT
Object_defineProperty
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
...
...
@@ -455,8 +506,20 @@ static HRESULT Object_defineProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
static
HRESULT
Object_defineProperties
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
jsdisp_t
*
obj
;
HRESULT
hres
;
if
(
argc
<
1
||
!
is_object_instance
(
argv
[
0
])
||
!
get_object
(
argv
[
0
])
||
!
(
obj
=
to_jsdisp
(
get_object
(
argv
[
0
]))))
{
FIXME
(
"not an object
\n
"
);
return
E_NOTIMPL
;
}
TRACE
(
"%p
\n
"
,
obj
);
hres
=
jsdisp_define_properties
(
ctx
,
obj
,
argc
>=
2
?
argv
[
1
]
:
jsval_undefined
());
if
(
SUCCEEDED
(
hres
)
&&
r
)
*
r
=
jsval_obj
(
jsdisp_addref
(
obj
));
return
hres
;
}
static
HRESULT
Object_getOwnPropertyDescriptor
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
...
...
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