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
6b1e54a2
Commit
6b1e54a2
authored
May 11, 2018
by
Jacek Caban
Committed by
Alexandre Julliard
May 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Make global constants non-writable in ES5 mode.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4555828c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
global.c
dlls/jscript/global.c
+4
-3
es5.js
dlls/mshtml/tests/es5.js
+19
-1
No files found.
dlls/jscript/global.c
View file @
6b1e54a2
...
...
@@ -1087,6 +1087,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
HRESULT
init_global
(
script_ctx_t
*
ctx
)
{
unsigned
const_flags
=
ctx
->
version
>=
SCRIPTLANGUAGEVERSION_ES5
?
0
:
PROPF_WRITABLE
;
jsdisp_t
*
math
,
*
object_prototype
,
*
constr
;
HRESULT
hres
;
...
...
@@ -1137,14 +1138,14 @@ HRESULT init_global(script_ctx_t *ctx)
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_
propput_dontenum
(
ctx
->
global
,
undefinedW
,
jsval_undefined
());
hres
=
jsdisp_
define_data_property
(
ctx
->
global
,
undefinedW
,
const_flags
,
jsval_undefined
());
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_
propput_dontenum
(
ctx
->
global
,
NaNW
,
jsval_number
(
NAN
));
hres
=
jsdisp_
define_data_property
(
ctx
->
global
,
NaNW
,
const_flags
,
jsval_number
(
NAN
));
if
(
FAILED
(
hres
))
return
hres
;
hres
=
jsdisp_
propput_dontenum
(
ctx
->
global
,
InfinityW
,
jsval_number
(
INFINITY
));
hres
=
jsdisp_
define_data_property
(
ctx
->
global
,
InfinityW
,
const_flags
,
jsval_number
(
INFINITY
));
return
hres
;
}
dlls/mshtml/tests/es5.js
View file @
6b1e54a2
...
...
@@ -284,6 +284,23 @@ function test_defineProperty() {
next_test
();
}
function
test_global_properties
()
{
var
o
;
/* Make sure that global properties are not writable. */
o
=
NaN
;
NaN
=
1
;
ok
(
isNaN
(
NaN
),
"NaN = "
+
NaN
);
o
=
undefined
;
undefined
=
1
;
ok
(
undefined
===
o
,
"NaN = "
+
NaN
);
o
=
Infinity
;
Infinity
=
1
;
ok
(
Infinity
===
o
,
"Infinity = "
+
NaN
);
next_test
();
}
var
tests
=
[
test_date_now
,
test_toISOString
,
...
...
@@ -291,5 +308,6 @@ var tests = [
test_isArray
,
test_identifier_keywords
,
test_getOwnPropertyDescriptor
,
test_defineProperty
test_defineProperty
,
test_global_properties
];
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