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
4eb80d8d
Commit
4eb80d8d
authored
Dec 15, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 16, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Delay setting named info if SCRIPTITEM_GLOBALMEMBER flag is not set.
parent
dfe41770
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
3 deletions
+95
-3
engine.c
dlls/jscript/engine.c
+21
-0
jscript.c
dlls/jscript/jscript.c
+15
-2
jscript.h
dlls/jscript/jscript.h
+1
-0
run.c
dlls/jscript/tests/run.c
+58
-1
No files found.
dlls/jscript/engine.c
View file @
4eb80d8d
...
...
@@ -459,6 +459,27 @@ static HRESULT identifier_eval(exec_ctx_t *ctx, BSTR identifier, DWORD flags, ex
for
(
item
=
ctx
->
parser
->
script
->
named_items
;
item
;
item
=
item
->
next
)
{
if
((
item
->
flags
&
SCRIPTITEM_ISVISIBLE
)
&&
!
strcmpW
(
item
->
name
,
identifier
))
{
if
(
!
item
->
disp
)
{
IUnknown
*
unk
;
if
(
!
ctx
->
parser
->
script
->
site
)
break
;
hres
=
IActiveScriptSite_GetItemInfo
(
ctx
->
parser
->
script
->
site
,
identifier
,
SCRIPTINFO_IUNKNOWN
,
&
unk
,
NULL
);
if
(
FAILED
(
hres
))
{
WARN
(
"GetItemInfo failed: %08x
\n
"
,
hres
);
break
;
}
hres
=
IUnknown_QueryInterface
(
unk
,
&
IID_IDispatch
,
(
void
**
)
&
item
->
disp
);
IUnknown_Release
(
unk
);
if
(
FAILED
(
hres
))
{
WARN
(
"object does not implement IDispatch
\n
"
);
break
;
}
}
ret
->
type
=
EXPRVAL_VARIANT
;
V_VT
(
&
ret
->
u
.
var
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
ret
->
u
.
var
)
=
item
->
disp
;
...
...
dlls/jscript/jscript.c
View file @
4eb80d8d
...
...
@@ -144,6 +144,9 @@ static HRESULT set_ctx_site(JScript *This)
if
(
FAILED
(
hres
))
return
hres
;
IActiveScriptSite_AddRef
(
This
->
site
);
This
->
ctx
->
site
=
This
->
site
;
change_state
(
This
,
SCRIPTSTATE_INITIALIZED
);
return
S_OK
;
}
...
...
@@ -325,6 +328,7 @@ static HRESULT WINAPI JScript_Close(IActiveScript *iface)
while
(
iter
)
{
iter2
=
iter
->
next
;
if
(
iter
->
disp
)
IDispatch_Release
(
iter
->
disp
);
heap_free
(
iter
->
name
);
heap_free
(
iter
);
...
...
@@ -334,6 +338,11 @@ static HRESULT WINAPI JScript_Close(IActiveScript *iface)
This
->
ctx
->
named_items
=
NULL
;
}
if
(
This
->
ctx
->
site
)
{
IActiveScriptSite_Release
(
This
->
ctx
->
site
);
This
->
ctx
->
site
=
NULL
;
}
if
(
This
->
site
)
change_state
(
This
,
SCRIPTSTATE_CLOSED
);
...
...
@@ -361,8 +370,7 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface,
{
JScript
*
This
=
ACTSCRIPT_THIS
(
iface
);
named_item_t
*
item
;
IDispatch
*
disp
;
IUnknown
*
unk
;
IDispatch
*
disp
=
NULL
;
HRESULT
hres
;
TRACE
(
"(%p)->(%s %x)
\n
"
,
This
,
debugstr_w
(
pstrName
),
dwFlags
);
...
...
@@ -370,6 +378,9 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface,
if
(
This
->
thread_id
!=
GetCurrentThreadId
()
||
!
This
->
ctx
||
This
->
ctx
->
state
==
SCRIPTSTATE_CLOSED
)
return
E_UNEXPECTED
;
if
(
dwFlags
&
SCRIPTITEM_GLOBALMEMBERS
)
{
IUnknown
*
unk
;
hres
=
IActiveScriptSite_GetItemInfo
(
This
->
site
,
pstrName
,
SCRIPTINFO_IUNKNOWN
,
&
unk
,
NULL
);
if
(
FAILED
(
hres
))
{
WARN
(
"GetItemInfo failed: %08x
\n
"
,
hres
);
...
...
@@ -382,9 +393,11 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface,
WARN
(
"object does not implement IDispatch
\n
"
);
return
hres
;
}
}
item
=
heap_alloc
(
sizeof
(
*
item
));
if
(
!
item
)
{
if
(
disp
)
IDispatch_Release
(
disp
);
return
E_OUTOFMEMORY
;
}
...
...
dlls/jscript/jscript.h
View file @
4eb80d8d
...
...
@@ -165,6 +165,7 @@ struct _script_ctx_t {
SCRIPTSTATE
state
;
exec_ctx_t
*
exec_ctx
;
named_item_t
*
named_items
;
IActiveScriptSite
*
site
;
LCID
lcid
;
jsheap_t
tmp_heap
;
...
...
dlls/jscript/tests/run.c
View file @
4eb80d8d
...
...
@@ -64,6 +64,7 @@ DEFINE_EXPECT(global_propput_i);
DEFINE_EXPECT
(
global_success_d
);
DEFINE_EXPECT
(
global_success_i
);
DEFINE_EXPECT
(
testobj_delete
);
DEFINE_EXPECT
(
GetItemInfo_testVal
);
#define DISPID_GLOBAL_TESTPROPGET 0x1000
#define DISPID_GLOBAL_TESTPROPPUT 0x1001
...
...
@@ -74,6 +75,7 @@ DEFINE_EXPECT(testobj_delete);
#define DISPID_GLOBAL_TESTOBJ 0x1006
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
static
const
WCHAR
test_valW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
'V'
,
'a'
,
'l'
,
0
};
static
BOOL
strict_dispid_check
;
static
const
char
*
test_name
=
"(null)"
;
...
...
@@ -485,10 +487,14 @@ static HRESULT WINAPI ActiveScriptSite_GetLCID(IActiveScriptSite *iface, LCID *p
static
HRESULT
WINAPI
ActiveScriptSite_GetItemInfo
(
IActiveScriptSite
*
iface
,
LPCOLESTR
pstrName
,
DWORD
dwReturnMask
,
IUnknown
**
ppiunkItem
,
ITypeInfo
**
ppti
)
{
ok
(
!
lstrcmpW
(
pstrName
,
testW
),
"unexpected pstrName %s
\n
"
,
debugstr_w
(
pstrName
));
ok
(
dwReturnMask
==
SCRIPTINFO_IUNKNOWN
,
"unexpected dwReturnMask %x
\n
"
,
dwReturnMask
);
ok
(
!
ppti
,
"ppti != NULL
\n
"
);
if
(
!
lstrcmpW
(
pstrName
,
test_valW
))
CHECK_EXPECT
(
GetItemInfo_testVal
);
else
if
(
lstrcmpW
(
pstrName
,
testW
))
ok
(
0
,
"unexpected pstrName %s
\n
"
,
debugstr_w
(
pstrName
));
*
ppiunkItem
=
(
IUnknown
*
)
&
Global
;
return
S_OK
;
}
...
...
@@ -673,6 +679,54 @@ static void run_from_res(const char *name)
SysFreeString
(
str
);
}
static
void
test_isvisible
(
BOOL
global_members
)
{
IActiveScriptParse
*
parser
;
IActiveScript
*
engine
;
HRESULT
hres
;
static
const
WCHAR
script_textW
[]
=
{
'v'
,
'a'
,
'r'
,
' '
,
'v'
,
' '
,
'='
,
' '
,
't'
,
'e'
,
's'
,
't'
,
'V'
,
'a'
,
'l'
,
';'
,
0
};
engine
=
create_script
();
if
(
!
engine
)
return
;
hres
=
IActiveScript_QueryInterface
(
engine
,
&
IID_IActiveScriptParse
,
(
void
**
)
&
parser
);
ok
(
hres
==
S_OK
,
"Could not get IActiveScriptParse: %08x
\n
"
,
hres
);
hres
=
IActiveScriptParse_InitNew
(
parser
);
ok
(
hres
==
S_OK
,
"InitNew failed: %08x
\n
"
,
hres
);
hres
=
IActiveScript_SetScriptSite
(
engine
,
&
ActiveScriptSite
);
ok
(
hres
==
S_OK
,
"SetScriptSite failed: %08x
\n
"
,
hres
);
if
(
global_members
)
SET_EXPECT
(
GetItemInfo_testVal
);
hres
=
IActiveScript_AddNamedItem
(
engine
,
test_valW
,
SCRIPTITEM_ISVISIBLE
|
SCRIPTITEM_ISSOURCE
|
(
global_members
?
SCRIPTITEM_GLOBALMEMBERS
:
0
));
ok
(
hres
==
S_OK
,
"AddNamedItem failed: %08x
\n
"
,
hres
);
if
(
global_members
)
CHECK_CALLED
(
GetItemInfo_testVal
);
hres
=
IActiveScript_SetScriptState
(
engine
,
SCRIPTSTATE_STARTED
);
ok
(
hres
==
S_OK
,
"SetScriptState(SCRIPTSTATE_STARTED) failed: %08x
\n
"
,
hres
);
if
(
!
global_members
)
SET_EXPECT
(
GetItemInfo_testVal
);
hres
=
IActiveScriptParse_ParseScriptText
(
parser
,
script_textW
,
NULL
,
NULL
,
NULL
,
0
,
0
,
0
,
NULL
,
NULL
);
ok
(
hres
==
S_OK
,
"ParseScriptText failed: %08x
\n
"
,
hres
);
if
(
!
global_members
)
CHECK_CALLED
(
GetItemInfo_testVal
);
hres
=
IActiveScriptParse_ParseScriptText
(
parser
,
script_textW
,
NULL
,
NULL
,
NULL
,
0
,
0
,
0
,
NULL
,
NULL
);
ok
(
hres
==
S_OK
,
"ParseScriptText failed: %08x
\n
"
,
hres
);
IActiveScript_Release
(
engine
);
IActiveScriptParse_Release
(
parser
);
}
static
void
run_tests
(
void
)
{
strict_dispid_check
=
TRUE
;
...
...
@@ -707,6 +761,9 @@ static void run_tests(void)
run_from_res
(
"lang.js"
);
run_from_res
(
"api.js"
);
run_from_res
(
"regexp.js"
);
test_isvisible
(
FALSE
);
test_isvisible
(
TRUE
);
}
START_TEST
(
run
)
...
...
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