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
6dda7096
Commit
6dda7096
authored
Apr 27, 2021
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Add Map object stub implementation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d5aa6377
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
152 additions
and
0 deletions
+152
-0
jscript.c
dlls/jscript/jscript.c
+5
-0
jscript.h
dlls/jscript/jscript.h
+2
-0
object.c
dlls/jscript/object.c
+1
-0
set.c
dlls/jscript/set.c
+120
-0
documentmode.js
dlls/mshtml/tests/documentmode.js
+24
-0
No files found.
dlls/jscript/jscript.c
View file @
6dda7096
...
@@ -483,6 +483,11 @@ static void decrease_state(JScript *This, SCRIPTSTATE state)
...
@@ -483,6 +483,11 @@ static void decrease_state(JScript *This, SCRIPTSTATE state)
This
->
ctx
->
site
=
NULL
;
This
->
ctx
->
site
=
NULL
;
}
}
if
(
This
->
ctx
->
map_prototype
)
{
jsdisp_release
(
This
->
ctx
->
map_prototype
);
This
->
ctx
->
map_prototype
=
NULL
;
}
if
(
This
->
ctx
->
set_prototype
)
{
if
(
This
->
ctx
->
set_prototype
)
{
jsdisp_release
(
This
->
ctx
->
set_prototype
);
jsdisp_release
(
This
->
ctx
->
set_prototype
);
This
->
ctx
->
set_prototype
=
NULL
;
This
->
ctx
->
set_prototype
=
NULL
;
...
...
dlls/jscript/jscript.h
View file @
6dda7096
...
@@ -131,6 +131,7 @@ typedef enum {
...
@@ -131,6 +131,7 @@ typedef enum {
JSCLASS_ARGUMENTS
,
JSCLASS_ARGUMENTS
,
JSCLASS_VBARRAY
,
JSCLASS_VBARRAY
,
JSCLASS_JSON
,
JSCLASS_JSON
,
JSCLASS_MAP
,
JSCLASS_SET
,
JSCLASS_SET
,
}
jsclass_t
;
}
jsclass_t
;
...
@@ -467,6 +468,7 @@ struct _script_ctx_t {
...
@@ -467,6 +468,7 @@ struct _script_ctx_t {
jsdisp_t
*
regexp_constr
;
jsdisp_t
*
regexp_constr
;
jsdisp_t
*
string_constr
;
jsdisp_t
*
string_constr
;
jsdisp_t
*
vbarray_constr
;
jsdisp_t
*
vbarray_constr
;
jsdisp_t
*
map_prototype
;
jsdisp_t
*
set_prototype
;
jsdisp_t
*
set_prototype
;
};
};
...
...
dlls/jscript/object.c
View file @
6dda7096
...
@@ -48,6 +48,7 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -48,6 +48,7 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
L"[object Object]"
,
L"[object Object]"
,
L"[object Object]"
,
L"[object Object]"
,
L"[object Object]"
,
L"[object Object]"
,
L"[object Object]"
,
L"[object Object]"
L"[object Object]"
};
};
...
...
dlls/jscript/set.c
View file @
6dda7096
...
@@ -26,6 +26,10 @@ typedef struct {
...
@@ -26,6 +26,10 @@ typedef struct {
jsdisp_t
dispex
;
jsdisp_t
dispex
;
}
SetInstance
;
}
SetInstance
;
typedef
struct
{
jsdisp_t
dispex
;
}
MapInstance
;
static
HRESULT
Set_add
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
static
HRESULT
Set_add
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
jsval_t
*
r
)
{
{
...
@@ -119,6 +123,107 @@ static HRESULT Set_constructor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
...
@@ -119,6 +123,107 @@ static HRESULT Set_constructor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
}
}
}
}
static
HRESULT
Map_clear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"%p
\n
"
,
jsthis
);
return
E_NOTIMPL
;
}
static
HRESULT
Map_delete
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"%p
\n
"
,
jsthis
);
return
E_NOTIMPL
;
}
static
HRESULT
Map_forEach
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"%p
\n
"
,
jsthis
);
return
E_NOTIMPL
;
}
static
HRESULT
Map_get
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"%p
\n
"
,
jsthis
);
return
E_NOTIMPL
;
}
static
HRESULT
Map_set
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"%p
\n
"
,
jsthis
);
return
E_NOTIMPL
;
}
static
HRESULT
Map_has
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"%p
\n
"
,
jsthis
);
return
E_NOTIMPL
;
}
static
HRESULT
Map_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
const
builtin_prop_t
Map_prototype_props
[]
=
{
{
L"clear"
,
Map_clear
,
PROPF_METHOD
},
{
L"delete"
,
Map_delete
,
PROPF_METHOD
|
1
},
{
L"forEach"
,
Map_forEach
,
PROPF_METHOD
|
1
},
{
L"get"
,
Map_get
,
PROPF_METHOD
|
1
},
{
L"has"
,
Map_has
,
PROPF_METHOD
|
1
},
{
L"set"
,
Map_set
,
PROPF_METHOD
|
2
},
};
static
const
builtin_info_t
Map_prototype_info
=
{
JSCLASS_OBJECT
,
{
NULL
,
Map_value
,
0
},
ARRAY_SIZE
(
Map_prototype_props
),
Map_prototype_props
,
NULL
,
NULL
};
static
const
builtin_info_t
Map_info
=
{
JSCLASS_MAP
,
{
NULL
,
Map_value
,
0
},
0
,
NULL
,
NULL
,
NULL
};
static
HRESULT
Map_constructor
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
MapInstance
*
map
;
HRESULT
hres
;
switch
(
flags
)
{
case
DISPATCH_CONSTRUCT
:
TRACE
(
"
\n
"
);
if
(
!
(
map
=
heap_alloc_zero
(
sizeof
(
*
map
))))
return
E_OUTOFMEMORY
;
hres
=
init_dispex
(
&
map
->
dispex
,
ctx
,
&
Map_info
,
ctx
->
map_prototype
);
if
(
FAILED
(
hres
))
return
hres
;
*
r
=
jsval_obj
(
&
map
->
dispex
);
return
S_OK
;
default:
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
return
E_NOTIMPL
;
}
}
HRESULT
init_set_constructor
(
script_ctx_t
*
ctx
)
HRESULT
init_set_constructor
(
script_ctx_t
*
ctx
)
{
{
jsdisp_t
*
constructor
;
jsdisp_t
*
constructor
;
...
@@ -139,5 +244,20 @@ HRESULT init_set_constructor(script_ctx_t *ctx)
...
@@ -139,5 +244,20 @@ HRESULT init_set_constructor(script_ctx_t *ctx)
hres
=
jsdisp_define_data_property
(
ctx
->
global
,
L"Set"
,
PROPF_WRITABLE
,
hres
=
jsdisp_define_data_property
(
ctx
->
global
,
L"Set"
,
PROPF_WRITABLE
,
jsval_obj
(
constructor
));
jsval_obj
(
constructor
));
jsdisp_release
(
constructor
);
jsdisp_release
(
constructor
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_dispex
(
ctx
,
&
Map_prototype_info
,
ctx
->
object_prototype
,
&
ctx
->
map_prototype
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_builtin_constructor
(
ctx
,
Map_constructor
,
L"Map"
,
NULL
,
PROPF_CONSTR
,
ctx
->
map_prototype
,
&
constructor
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_define_data_property
(
ctx
->
global
,
L"Map"
,
PROPF_WRITABLE
,
jsval_obj
(
constructor
));
jsdisp_release
(
constructor
);
return
hres
;
return
hres
;
}
}
dlls/mshtml/tests/documentmode.js
View file @
6dda7096
...
@@ -117,6 +117,7 @@ sync_test("window_props", function() {
...
@@ -117,6 +117,7 @@ sync_test("window_props", function() {
test_exposed
(
"onfocusout"
,
v
>=
9
);
test_exposed
(
"onfocusout"
,
v
>=
9
);
test_exposed
(
"getComputedStyle"
,
v
>=
9
);
test_exposed
(
"getComputedStyle"
,
v
>=
9
);
test_exposed
(
"requestAnimationFrame"
,
v
>=
10
);
test_exposed
(
"requestAnimationFrame"
,
v
>=
10
);
test_exposed
(
"Map"
,
v
>=
11
);
test_exposed
(
"Set"
,
v
>=
11
);
test_exposed
(
"Set"
,
v
>=
11
);
if
(
v
>=
9
)
/* FIXME: native exposes it in all compat modes */
if
(
v
>=
9
)
/* FIXME: native exposes it in all compat modes */
test_exposed
(
"performance"
,
true
);
test_exposed
(
"performance"
,
true
);
...
@@ -623,6 +624,29 @@ sync_test("set_obj", function() {
...
@@ -623,6 +624,29 @@ sync_test("set_obj", function() {
ok
(
r
===
"[object Object]"
,
"toString returned "
+
r
);
ok
(
r
===
"[object Object]"
,
"toString returned "
+
r
);
});
});
sync_test
(
"map_obj"
,
function
()
{
if
(
!
(
"Map"
in
window
))
return
;
var
s
=
new
Map
,
r
;
ok
(
Object
.
getPrototypeOf
(
s
)
===
Map
.
prototype
,
"unexpected Map prototype"
);
function
test_length
(
name
,
len
)
{
ok
(
Map
.
prototype
[
name
].
length
===
len
,
"Map.prototype."
+
name
+
" = "
+
Map
.
prototype
[
name
].
length
);
}
test_length
(
"clear"
,
0
);
test_length
(
"delete"
,
1
);
test_length
(
"forEach"
,
1
);
test_length
(
"get"
,
1
);
test_length
(
"has"
,
1
);
test_length
(
"set"
,
2
);
ok
(
!
(
"entries"
in
s
),
"entries are in Map"
);
ok
(
!
(
"keys"
in
s
),
"keys are in Map"
);
ok
(
!
(
"values"
in
s
),
"values are in Map"
);
r
=
Object
.
prototype
.
toString
.
call
(
s
);
ok
(
r
===
"[object Object]"
,
"toString returned "
+
r
);
});
sync_test
(
"elem_attr"
,
function
()
{
sync_test
(
"elem_attr"
,
function
()
{
var
v
=
document
.
documentMode
;
var
v
=
document
.
documentMode
;
var
elem
=
document
.
createElement
(
"div"
),
r
;
var
elem
=
document
.
createElement
(
"div"
),
r
;
...
...
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