Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
55f0663e
Commit
55f0663e
authored
Nov 14, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 14, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Use proper object as 'this' when function is called on an activation object.
parent
c0589a31
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
1 deletion
+26
-1
engine.c
dlls/jscript/engine.c
+12
-0
object.c
dlls/jscript/object.c
+4
-1
lang.js
dlls/jscript/tests/lang.js
+6
-0
run.c
dlls/jscript/tests/run.c
+4
-0
No files found.
dlls/jscript/engine.c
View file @
55f0663e
...
...
@@ -292,6 +292,18 @@ HRESULT create_exec_ctx(script_ctx_t *script_ctx, IDispatch *this_obj, jsdisp_t
ctx
->
ref
=
1
;
ctx
->
is_global
=
is_global
;
/* ECMA-262 3rd Edition 11.2.3.7 */
if
(
this_obj
)
{
jsdisp_t
*
jsthis
;
jsthis
=
iface_to_jsdisp
((
IUnknown
*
)
this_obj
);
if
(
jsthis
)
{
if
(
jsthis
->
builtin_info
->
class
==
JSCLASS_GLOBAL
||
jsthis
->
builtin_info
->
class
==
JSCLASS_NONE
)
this_obj
=
NULL
;
jsdisp_release
(
jsthis
);
}
}
if
(
this_obj
)
ctx
->
this_obj
=
this_obj
;
else
if
(
script_ctx
->
host_global
)
...
...
dlls/jscript/object.c
View file @
55f0663e
...
...
@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include "jscript.h"
#include "wine/debug.h"
...
...
@@ -51,7 +53,7 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
static
const
WCHAR
regexpW
[]
=
{
'R'
,
'e'
,
'g'
,
'E'
,
'x'
,
'p'
,
0
};
static
const
WCHAR
stringW
[]
=
{
'S'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
/* Keep in sync with jsclass_t enum */
static
const
WCHAR
*
names
[]
=
{
objectW
,
arrayW
,
booleanW
,
dateW
,
errorW
,
static
const
WCHAR
*
names
[]
=
{
NULL
,
arrayW
,
booleanW
,
dateW
,
errorW
,
functionW
,
NULL
,
mathW
,
numberW
,
objectW
,
regexpW
,
stringW
,
objectW
,
objectW
};
TRACE
(
"
\n
"
);
...
...
@@ -62,6 +64,7 @@ static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
}
else
if
(
names
[
jsdisp
->
builtin_info
->
class
])
{
str
=
names
[
jsdisp
->
builtin_info
->
class
];
}
else
{
assert
(
jsdisp
->
builtin_info
->
class
!=
JSCLASS_NONE
);
FIXME
(
"jdisp->builtin_info->class = %d
\n
"
,
jsdisp
->
builtin_info
->
class
);
return
E_FAIL
;
}
...
...
dlls/jscript/tests/lang.js
View file @
55f0663e
...
...
@@ -56,6 +56,9 @@ ok(0 == false, "0 == false is false");
ok
(
1
!=
2
,
"1 != 2 is false"
);
ok
(
false
!=
1
,
"false != 1 is false"
);
ok
(
this
===
test
,
"this !== test"
);
eval
(
'ok(this === test, "this !== test");'
);
var
trueVar
=
true
;
ok
(
trueVar
,
"trueVar is not true"
);
...
...
@@ -71,6 +74,9 @@ function testFunc1(x, y) {
ok
(
arguments
.
callee
===
testFunc1
,
"arguments.calee !== testFunc1"
);
ok
(
testFunc1
.
arguments
===
arguments
,
"testFunc1.arguments = "
+
testFunc1
.
arguments
);
ok
(
this
===
test
,
"this !== test"
);
eval
(
'ok(this === test, "this !== test");'
);
return
true
;
}
...
...
dlls/jscript/tests/run.c
View file @
55f0663e
...
...
@@ -1815,6 +1815,10 @@ static BOOL run_tests(void)
parse_script_a
(
"testThis(this);"
);
parse_script_a
(
"(function () { testThis(this); })();"
);
parse_script_a
(
"function x() { testThis(this); }; x();"
);
parse_script_a
(
"var t = {func: function () { ok(this === t, 'this !== t'); }}; with(t) { func(); }"
);
parse_script_a
(
"function x() { testThis(this); }; with({y: 1}) { x(); }"
);
parse_script_a
(
"(function () { function x() { testThis(this);} x(); })();"
);
SET_EXPECT
(
testobj_onlydispid_d
);
SET_EXPECT
(
testobj_onlydispid_i
);
...
...
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