Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
35968b97
Commit
35968b97
authored
Oct 14, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 14, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Don't lookup global variables on function invocation.
parent
95469309
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
23 deletions
+21
-23
engine.c
dlls/jscript/engine.c
+7
-10
engine.h
dlls/jscript/engine.h
+3
-8
function.c
dlls/jscript/function.c
+2
-2
global.c
dlls/jscript/global.c
+1
-1
jscript.c
dlls/jscript/jscript.c
+2
-2
run.c
dlls/jscript/tests/run.c
+6
-0
No files found.
dlls/jscript/engine.c
View file @
35968b97
...
...
@@ -179,7 +179,7 @@ void scope_release(scope_chain_t *scope)
}
HRESULT
create_exec_ctx
(
script_ctx_t
*
script_ctx
,
IDispatch
*
this_obj
,
jsdisp_t
*
var_disp
,
scope_chain_t
*
scope
,
exec_ctx_t
**
ret
)
scope_chain_t
*
scope
,
BOOL
is_global
,
exec_ctx_t
**
ret
)
{
exec_ctx_t
*
ctx
;
...
...
@@ -188,6 +188,7 @@ HRESULT create_exec_ctx(script_ctx_t *script_ctx, IDispatch *this_obj, jsdisp_t
return
E_OUTOFMEMORY
;
ctx
->
ref
=
1
;
ctx
->
is_global
=
is_global
;
if
(
this_obj
)
ctx
->
this_obj
=
this_obj
;
...
...
@@ -410,7 +411,7 @@ static BOOL lookup_global_members(script_ctx_t *ctx, BSTR identifier, exprval_t
return
FALSE
;
}
HRESULT
exec_source
(
exec_ctx_t
*
ctx
,
parser_ctx_t
*
parser
,
source_elements_t
*
source
,
exec_type_t
exec_type
,
HRESULT
exec_source
(
exec_ctx_t
*
ctx
,
parser_ctx_t
*
parser
,
source_elements_t
*
source
,
BOOL
from_eval
,
jsexcept_t
*
ei
,
VARIANT
*
retv
)
{
script_ctx_t
*
script
=
parser
->
script
;
...
...
@@ -447,7 +448,7 @@ HRESULT exec_source(exec_ctx_t *ctx, parser_ctx_t *parser, source_elements_t *so
if
(
!
name
)
return
E_OUTOFMEMORY
;
if
(
!
lookup_global_members
(
parser
->
script
,
name
,
NULL
))
if
(
!
ctx
->
is_global
||
!
lookup_global_members
(
parser
->
script
,
name
,
NULL
))
hres
=
jsdisp_get_id
(
ctx
->
var_disp
,
var
->
identifier
,
fdexNameEnsure
,
&
id
);
SysFreeString
(
name
);
if
(
FAILED
(
hres
))
...
...
@@ -489,14 +490,10 @@ HRESULT exec_source(exec_ctx_t *ctx, parser_ctx_t *parser, source_elements_t *so
return
hres
;
}
if
(
retv
&&
(
exec_type
==
EXECT_EVAL
||
rt
.
type
==
RT_RETURN
))
*
retv
=
val
;
else
{
if
(
retv
)
{
VariantInit
(
retv
);
}
if
(
!
retv
||
(
!
from_eval
&&
rt
.
type
!=
RT_RETURN
))
VariantClear
(
&
val
);
}
if
(
retv
)
*
retv
=
val
;
return
S_OK
;
}
...
...
dlls/jscript/engine.h
View file @
35968b97
...
...
@@ -102,6 +102,7 @@ struct _exec_ctx_t {
scope_chain_t
*
scope_chain
;
jsdisp_t
*
var_disp
;
IDispatch
*
this_obj
;
BOOL
is_global
;
};
static
inline
void
exec_addref
(
exec_ctx_t
*
ctx
)
...
...
@@ -109,15 +110,9 @@ static inline void exec_addref(exec_ctx_t *ctx)
ctx
->
ref
++
;
}
typedef
enum
{
EXECT_PROGRAM
,
EXECT_FUNCTION
,
EXECT_EVAL
}
exec_type_t
;
void
exec_release
(
exec_ctx_t
*
);
HRESULT
create_exec_ctx
(
script_ctx_t
*
,
IDispatch
*
,
jsdisp_t
*
,
scope_chain_t
*
,
exec_ctx_t
**
);
HRESULT
exec_source
(
exec_ctx_t
*
,
parser_ctx_t
*
,
source_elements_t
*
,
exec_type_t
,
jsexcept_t
*
,
VARIANT
*
);
HRESULT
create_exec_ctx
(
script_ctx_t
*
,
IDispatch
*
,
jsdisp_t
*
,
scope_chain_t
*
,
BOOL
,
exec_ctx_t
**
);
HRESULT
exec_source
(
exec_ctx_t
*
,
parser_ctx_t
*
,
source_elements_t
*
,
BOOL
,
jsexcept_t
*
,
VARIANT
*
);
typedef
struct
_statement_t
statement_t
;
typedef
struct
_expression_t
expression_t
;
...
...
dlls/jscript/function.c
View file @
35968b97
...
...
@@ -209,7 +209,7 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis
hres
=
scope_push
(
function
->
scope_chain
,
var_disp
,
&
scope
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
create_exec_ctx
(
ctx
,
this_obj
,
var_disp
,
scope
,
&
exec_ctx
);
hres
=
create_exec_ctx
(
ctx
,
this_obj
,
var_disp
,
scope
,
FALSE
,
&
exec_ctx
);
scope_release
(
scope
);
}
jsdisp_release
(
var_disp
);
...
...
@@ -218,7 +218,7 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis
prev_args
=
function
->
arguments
;
function
->
arguments
=
arg_disp
;
hres
=
exec_source
(
exec_ctx
,
function
->
parser
,
function
->
source
,
EXECT_FUNCTION
,
ei
,
retv
);
hres
=
exec_source
(
exec_ctx
,
function
->
parser
,
function
->
source
,
FALSE
,
ei
,
retv
);
function
->
arguments
=
prev_args
;
jsdisp_release
(
arg_disp
);
...
...
dlls/jscript/global.c
View file @
35968b97
...
...
@@ -371,7 +371,7 @@ static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS
return
throw_syntax_error
(
ctx
,
ei
,
hres
,
NULL
);
}
hres
=
exec_source
(
ctx
->
exec_ctx
,
parser_ctx
,
parser_ctx
->
source
,
EXECT_EVAL
,
ei
,
retv
);
hres
=
exec_source
(
ctx
->
exec_ctx
,
parser_ctx
,
parser_ctx
->
source
,
TRUE
,
ei
,
retv
);
parser_release
(
parser_ctx
);
return
hres
;
...
...
dlls/jscript/jscript.c
View file @
35968b97
...
...
@@ -97,14 +97,14 @@ static HRESULT exec_global_code(JScript *This, parser_ctx_t *parser_ctx)
jsexcept_t
jsexcept
;
HRESULT
hres
;
hres
=
create_exec_ctx
(
This
->
ctx
,
NULL
,
This
->
ctx
->
global
,
NULL
,
&
exec_ctx
);
hres
=
create_exec_ctx
(
This
->
ctx
,
NULL
,
This
->
ctx
->
global
,
NULL
,
TRUE
,
&
exec_ctx
);
if
(
FAILED
(
hres
))
return
hres
;
IActiveScriptSite_OnEnterScript
(
This
->
site
);
memset
(
&
jsexcept
,
0
,
sizeof
(
jsexcept
));
hres
=
exec_source
(
exec_ctx
,
parser_ctx
,
parser_ctx
->
source
,
EXECT_PROGRAM
,
&
jsexcept
,
NULL
);
hres
=
exec_source
(
exec_ctx
,
parser_ctx
,
parser_ctx
->
source
,
FALSE
,
&
jsexcept
,
NULL
);
VariantClear
(
&
jsexcept
.
var
);
exec_release
(
exec_ctx
);
...
...
dlls/jscript/tests/run.c
View file @
35968b97
...
...
@@ -1214,11 +1214,17 @@ static void run_tests(void)
parse_script_a
(
"var testPropGet"
);
CHECK_CALLED
(
global_propget_d
);
SET_EXPECT
(
global_propget_d
);
parse_script_a
(
"eval('var testPropGet;');"
);
CHECK_CALLED
(
global_propget_d
);
SET_EXPECT
(
global_notexists_d
);
parse_script_a
(
"var notExists; notExists = 1;"
);
CHECK_CALLED
(
global_notexists_d
);
parse_script_a
(
"function f() { var testPropGet; }"
);
parse_script_a
(
"(function () { var testPropGet; })();"
);
parse_script_a
(
"(function () { eval('var testPropGet;'); })();"
);
parse_script_a
(
"ok((testObj instanceof Object) === false, 'testObj is instance of Object');"
);
...
...
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