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
51742d80
Commit
51742d80
authored
Apr 01, 2021
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Add Object.seal implementation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0d3634b3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
4 deletions
+69
-4
dispex.c
dlls/jscript/dispex.c
+2
-2
jscript.h
dlls/jscript/jscript.h
+1
-1
object.c
dlls/jscript/object.c
+25
-1
es5.js
dlls/mshtml/tests/es5.js
+41
-0
No files found.
dlls/jscript/dispex.c
View file @
51742d80
...
...
@@ -2628,12 +2628,12 @@ HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned f
return
jsdisp_define_property
(
obj
,
name
,
&
prop_desc
);
}
void
jsdisp_freeze
(
jsdisp_t
*
obj
)
void
jsdisp_freeze
(
jsdisp_t
*
obj
,
BOOL
seal
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
obj
->
prop_cnt
;
i
++
)
{
if
(
obj
->
props
[
i
].
type
==
PROP_JSVAL
)
if
(
!
seal
&&
obj
->
props
[
i
].
type
==
PROP_JSVAL
)
obj
->
props
[
i
].
flags
&=
~
PROPF_WRITABLE
;
obj
->
props
[
i
].
flags
&=
~
PROPF_CONFIGURABLE
;
}
...
...
dlls/jscript/jscript.h
View file @
51742d80
...
...
@@ -317,7 +317,7 @@ HRESULT jsdisp_define_property(jsdisp_t*,const WCHAR*,property_desc_t*) DECLSPEC
HRESULT
jsdisp_define_data_property
(
jsdisp_t
*
,
const
WCHAR
*
,
unsigned
,
jsval_t
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_next_prop
(
jsdisp_t
*
,
DISPID
,
BOOL
,
DISPID
*
)
DECLSPEC_HIDDEN
;
HRESULT
jsdisp_get_prop_name
(
jsdisp_t
*
,
DISPID
,
jsstr_t
**
);
void
jsdisp_freeze
(
jsdisp_t
*
)
DECLSPEC_HIDDEN
;
void
jsdisp_freeze
(
jsdisp_t
*
,
BOOL
)
DECLSPEC_HIDDEN
;
HRESULT
create_builtin_function
(
script_ctx_t
*
,
builtin_invoke_t
,
const
WCHAR
*
,
const
builtin_info_t
*
,
DWORD
,
jsdisp_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
...
...
dlls/jscript/object.c
View file @
51742d80
...
...
@@ -711,7 +711,30 @@ static HRESULT Object_freeze(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
return
E_NOTIMPL
;
}
jsdisp_freeze
(
obj
);
jsdisp_freeze
(
obj
,
FALSE
);
if
(
r
)
*
r
=
jsval_obj
(
jsdisp_addref
(
obj
));
return
S_OK
;
}
static
HRESULT
Object_seal
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
unsigned
argc
,
jsval_t
*
argv
,
jsval_t
*
r
)
{
jsdisp_t
*
obj
;
if
(
!
argc
||
!
is_object_instance
(
argv
[
0
])
||
!
get_object
(
argv
[
0
]))
{
WARN
(
"argument is not an object
\n
"
);
return
JS_E_OBJECT_EXPECTED
;
}
TRACE
(
"(%s)
\n
"
,
debugstr_jsval
(
argv
[
0
]));
obj
=
to_jsdisp
(
get_object
(
argv
[
0
]));
if
(
!
obj
)
{
FIXME
(
"Non-JS object
\n
"
);
return
E_NOTIMPL
;
}
jsdisp_freeze
(
obj
,
TRUE
);
if
(
r
)
*
r
=
jsval_obj
(
jsdisp_addref
(
obj
));
return
S_OK
;
}
...
...
@@ -747,6 +770,7 @@ static const builtin_prop_t ObjectConstr_props[] = {
{
L"isExtensible"
,
Object_isExtensible
,
PROPF_ES5
|
PROPF_METHOD
|
1
},
{
L"keys"
,
Object_keys
,
PROPF_ES5
|
PROPF_METHOD
|
1
},
{
L"preventExtensions"
,
Object_preventExtensions
,
PROPF_ES5
|
PROPF_METHOD
|
1
},
{
L"seal"
,
Object_seal
,
PROPF_ES5
|
PROPF_METHOD
|
1
},
};
static
const
builtin_info_t
ObjectConstr_info
=
{
...
...
dlls/mshtml/tests/es5.js
View file @
51742d80
...
...
@@ -1024,6 +1024,47 @@ sync_test("freeze", function() {
ok
(
o
.
accprop
===
3
,
"o.accprop = "
+
o
.
accprop
);
});
sync_test
(
"seal"
,
function
()
{
ok
(
Object
.
seal
.
length
===
1
,
"Object.seal.length = "
+
Object
.
seal
.
length
);
try
{
Object
.
seal
(
1
);
ok
(
false
,
"exception expected"
);
}
catch
(
e
)
{
ok
(
e
.
name
===
"TypeError"
,
"got "
+
e
.
name
+
" exception"
);
}
function
f
()
{}
var
o
=
{},
r
;
o
.
prop
=
1
;
o
.
func
=
f
;
Object
.
defineProperty
(
o
,
"accprop"
,
{
get
:
function
()
{
return
r
;
},
set
:
function
(
v
)
{
r
=
v
;
}
});
test_own_data_prop_desc
(
o
,
"prop"
,
true
,
true
,
true
);
r
=
Object
.
seal
(
o
);
ok
(
r
===
o
,
"r != o"
);
test_own_data_prop_desc
(
o
,
"prop"
,
true
,
true
,
false
);
test_own_data_prop_desc
(
o
,
"func"
,
true
,
true
,
false
);
ok
(
!
Object
.
isExtensible
(
o
),
"o is still extensible"
);
o
.
prop
=
false
;
o
.
func
=
false
;
ok
(
o
.
prop
===
false
,
"o.prop = "
+
o
.
prop
);
ok
(
o
.
func
===
false
,
"o.func = "
+
o
.
func
);
r
=
1
;
o
.
accprop
=
2
;
ok
(
r
===
2
,
"r = "
+
r
);
r
=
3
;
ok
(
o
.
accprop
===
3
,
"o.accprop = "
+
o
.
accprop
);
});
sync_test
(
"head_setter"
,
function
()
{
document
.
head
=
""
;
ok
(
typeof
(
document
.
head
)
===
"object"
,
"typeof(document.head) = "
+
typeof
(
document
.
head
));
...
...
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