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
b8dbee69
Commit
b8dbee69
authored
Jul 20, 2023
by
Gabriel Ivăncescu
Committed by
Alexandre Julliard
Jul 20, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Implement WeakMap instance stub and constructor.
Signed-off-by:
Gabriel Ivăncescu
<
gabrielopcode@gmail.com
>
parent
3f20b8aa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
139 additions
and
2 deletions
+139
-2
jscript.h
dlls/jscript/jscript.h
+4
-2
object.c
dlls/jscript/object.c
+1
-0
set.c
dlls/jscript/set.c
+134
-0
No files found.
dlls/jscript/jscript.h
View file @
b8dbee69
...
...
@@ -117,6 +117,7 @@ typedef enum {
JSCLASS_JSON
,
JSCLASS_MAP
,
JSCLASS_SET
,
JSCLASS_WEAKMAP
,
}
jsclass_t
;
jsdisp_t
*
iface_to_jsdisp
(
IDispatch
*
);
...
...
@@ -418,11 +419,12 @@ struct _script_ctx_t {
jsdisp_t
*
vbarray_constr
;
jsdisp_t
*
map_prototype
;
jsdisp_t
*
set_prototype
;
jsdisp_t
*
weakmap_prototype
;
};
jsdisp_t
*
global_objects
[
2
2
];
jsdisp_t
*
global_objects
[
2
3
];
};
};
C_ASSERT
(
RTL_SIZEOF_THROUGH_FIELD
(
script_ctx_t
,
set
_prototype
)
==
RTL_SIZEOF_THROUGH_FIELD
(
script_ctx_t
,
global_objects
));
C_ASSERT
(
RTL_SIZEOF_THROUGH_FIELD
(
script_ctx_t
,
weakmap
_prototype
)
==
RTL_SIZEOF_THROUGH_FIELD
(
script_ctx_t
,
global_objects
));
void
script_release
(
script_ctx_t
*
);
...
...
dlls/jscript/object.c
View file @
b8dbee69
...
...
@@ -51,6 +51,7 @@ static HRESULT Object_toString(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns
L"[object Object]"
,
L"[object Object]"
,
L"[object Object]"
,
L"[object Object]"
,
L"[object Object]"
};
...
...
dlls/jscript/set.c
View file @
b8dbee69
...
...
@@ -614,6 +614,125 @@ static HRESULT Set_constructor(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns
}
}
typedef
struct
{
jsdisp_t
dispex
;
}
WeakMapInstance
;
static
HRESULT
WeakMap_clear
(
script_ctx_t
*
ctx
,
jsval_t
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WeakMap_delete
(
script_ctx_t
*
ctx
,
jsval_t
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WeakMap_get
(
script_ctx_t
*
ctx
,
jsval_t
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WeakMap_set
(
script_ctx_t
*
ctx
,
jsval_t
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WeakMap_has
(
script_ctx_t
*
ctx
,
jsval_t
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WeakMap_value
(
script_ctx_t
*
ctx
,
jsval_t
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
void
WeakMap_destructor
(
jsdisp_t
*
dispex
)
{
WeakMapInstance
*
weakmap
=
(
WeakMapInstance
*
)
dispex
;
free
(
weakmap
);
}
static
HRESULT
WeakMap_gc_traverse
(
struct
gc_ctx
*
gc_ctx
,
enum
gc_traverse_op
op
,
jsdisp_t
*
dispex
)
{
return
S_OK
;
}
static
const
builtin_prop_t
WeakMap_prototype_props
[]
=
{
{
L"clear"
,
WeakMap_clear
,
PROPF_METHOD
},
{
L"delete"
,
WeakMap_delete
,
PROPF_METHOD
|
1
},
{
L"get"
,
WeakMap_get
,
PROPF_METHOD
|
1
},
{
L"has"
,
WeakMap_has
,
PROPF_METHOD
|
1
},
{
L"set"
,
WeakMap_set
,
PROPF_METHOD
|
2
},
};
static
const
builtin_info_t
WeakMap_prototype_info
=
{
JSCLASS_OBJECT
,
WeakMap_value
,
ARRAY_SIZE
(
WeakMap_prototype_props
),
WeakMap_prototype_props
,
NULL
,
NULL
};
static
const
builtin_info_t
WeakMap_info
=
{
JSCLASS_WEAKMAP
,
WeakMap_value
,
0
,
NULL
,
WeakMap_destructor
,
NULL
,
NULL
,
NULL
,
NULL
,
WeakMap_gc_traverse
};
static
HRESULT
WeakMap_constructor
(
script_ctx_t
*
ctx
,
jsval_t
vthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
WeakMapInstance
*
weakmap
;
HRESULT
hres
;
switch
(
flags
)
{
case
DISPATCH_CONSTRUCT
:
TRACE
(
"
\n
"
);
if
(
!
r
)
return
S_OK
;
if
(
!
(
weakmap
=
calloc
(
1
,
sizeof
(
*
weakmap
))))
return
E_OUTOFMEMORY
;
hres
=
init_dispex
(
&
weakmap
->
dispex
,
ctx
,
&
WeakMap_info
,
ctx
->
weakmap_prototype
);
if
(
FAILED
(
hres
))
return
hres
;
*
r
=
jsval_obj
(
&
weakmap
->
dispex
);
return
S_OK
;
case
DISPATCH_METHOD
:
return
throw_error
(
ctx
,
JS_E_WRONG_THIS
,
L"WeakMap"
);
default:
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
return
E_NOTIMPL
;
}
}
HRESULT
init_set_constructor
(
script_ctx_t
*
ctx
)
{
jsdisp_t
*
constructor
;
...
...
@@ -649,5 +768,20 @@ HRESULT init_set_constructor(script_ctx_t *ctx)
hres
=
jsdisp_define_data_property
(
ctx
->
global
,
L"Map"
,
PROPF_WRITABLE
,
jsval_obj
(
constructor
));
jsdisp_release
(
constructor
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_dispex
(
ctx
,
&
WeakMap_prototype_info
,
ctx
->
object_prototype
,
&
ctx
->
weakmap_prototype
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_builtin_constructor
(
ctx
,
WeakMap_constructor
,
L"WeakMap"
,
NULL
,
PROPF_CONSTR
,
ctx
->
weakmap_prototype
,
&
constructor
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_define_data_property
(
ctx
->
global
,
L"WeakMap"
,
PROPF_WRITABLE
,
jsval_obj
(
constructor
));
jsdisp_release
(
constructor
);
return
hres
;
}
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