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
1985f330
Commit
1985f330
authored
Apr 12, 2021
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Add function name to its scope chain in ES5 mode.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c7fc18a6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
engine.c
dlls/jscript/engine.c
+8
-0
documentmode.js
dlls/mshtml/tests/documentmode.js
+36
-0
No files found.
dlls/jscript/engine.c
View file @
1985f330
...
...
@@ -661,6 +661,14 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re
if
(
FAILED
(
hres
))
return
hres
;
}
/* ECMA-262 5.1 Edition 13 */
if
(
func
->
name
&&
ctx
->
version
>=
SCRIPTLANGUAGEVERSION_ES5
&&
!
wcscmp
(
identifier
,
func
->
name
))
{
TRACE
(
"returning a function from scope chain
\n
"
);
ret
->
type
=
EXPRVAL_JSVAL
;
ret
->
u
.
val
=
jsval_obj
(
jsdisp_addref
(
scope
->
frame
->
function_instance
));
return
S_OK
;
}
}
if
(
scope
->
jsobj
)
hres
=
jsdisp_get_id
(
scope
->
jsobj
,
identifier
,
fdexNameImplicit
,
&
id
);
...
...
dlls/mshtml/tests/documentmode.js
View file @
1985f330
...
...
@@ -534,3 +534,39 @@ sync_test("delete_prop", function() {
todo_wine
.
ok
(
!
(
"globalprop4"
in
obj
),
"globalprop4 is still in obj"
);
});
var
func_scope_val
=
1
;
sync_test
(
"func_scope"
,
function
()
{
var
func_scope_val
=
2
;
var
f
=
function
func_scope_val
()
{
return
func_scope_val
;
};
func_scope_val
=
3
;
if
(
document
.
documentMode
<
9
)
{
ok
(
f
()
===
3
,
"f() = "
+
f
());
return
;
}
ok
(
f
===
f
(),
"f() = "
+
f
());
f
=
function
func_scope_val
(
a
)
{
func_scope_val
=
4
;
return
func_scope_val
;
};
func_scope_val
=
3
;
ok
(
f
===
f
(),
"f() = "
+
f
());
ok
(
func_scope_val
===
3
,
"func_scope_val = "
+
func_scope_val
);
ok
(
window
.
func_scope_val
===
1
,
"window.func_scope_val = "
+
window
.
func_scope_val
);
f
=
function
func_scope_val
(
a
)
{
return
(
function
()
{
return
a
?
func_scope_val
(
false
)
:
func_scope_val
;
})();
};
ok
(
f
===
f
(
true
),
"f(true) = "
+
f
(
true
));
window
=
1
;
ok
(
window
===
window
.
self
,
"window = "
+
window
);
});
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