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
89327655
Commit
89327655
authored
Nov 05, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 05, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Fixed SetScriptSite called before InitNew handling.
parent
d9f097ad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
19 deletions
+76
-19
jscript.c
dlls/jscript/jscript.c
+23
-19
jscript.c
dlls/jscript/tests/jscript.c
+53
-0
No files found.
dlls/jscript/jscript.c
View file @
89327655
...
...
@@ -36,6 +36,7 @@ typedef struct {
DWORD
safeopt
;
script_ctx_t
*
ctx
;
LONG
thread_id
;
LCID
lcid
;
IActiveScriptSite
*
site
;
...
...
@@ -127,6 +128,26 @@ static void exec_queued_code(JScript *This)
clear_script_queue
(
This
);
}
static
HRESULT
set_ctx_site
(
JScript
*
This
)
{
HRESULT
hres
;
This
->
ctx
->
lcid
=
This
->
lcid
;
if
(
!
This
->
ctx
->
script_disp
)
{
hres
=
create_dispex
(
This
->
ctx
,
NULL
,
NULL
,
&
This
->
ctx
->
script_disp
);
if
(
FAILED
(
hres
))
return
hres
;
}
hres
=
init_global
(
This
->
ctx
);
if
(
FAILED
(
hres
))
return
hres
;
change_state
(
This
,
SCRIPTSTATE_INITIALIZED
);
return
S_OK
;
}
#define ACTSCRIPT_THIS(iface) DEFINE_THIS(JScript, IActiveScript, iface)
static
HRESULT
WINAPI
JScript_QueryInterface
(
IActiveScript
*
iface
,
REFIID
riid
,
void
**
ppv
)
...
...
@@ -211,22 +232,6 @@ static HRESULT WINAPI JScript_SetScriptSite(IActiveScript *iface,
if
(
This
->
site
)
return
E_UNEXPECTED
;
if
(
!
This
->
ctx
)
{
hres
=
IActiveScriptParse_InitNew
(
ASPARSE
(
This
));
if
(
FAILED
(
hres
))
return
hres
;
}
if
(
!
This
->
ctx
->
script_disp
)
{
hres
=
create_dispex
(
This
->
ctx
,
NULL
,
NULL
,
&
This
->
ctx
->
script_disp
);
if
(
FAILED
(
hres
))
return
hres
;
}
hres
=
init_global
(
This
->
ctx
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
InterlockedCompareExchange
(
&
This
->
thread_id
,
GetCurrentThreadId
(),
0
))
return
E_UNEXPECTED
;
...
...
@@ -237,8 +242,7 @@ static HRESULT WINAPI JScript_SetScriptSite(IActiveScript *iface,
if
(
hres
==
S_OK
)
This
->
ctx
->
lcid
=
lcid
;
change_state
(
This
,
SCRIPTSTATE_INITIALIZED
);
return
S_OK
;
return
This
->
ctx
?
set_ctx_site
(
This
)
:
S_OK
;
}
static
HRESULT
WINAPI
JScript_GetScriptSite
(
IActiveScript
*
iface
,
REFIID
riid
,
...
...
@@ -517,7 +521,7 @@ static HRESULT WINAPI JScriptParse_InitNew(IActiveScriptParse *iface)
return
E_UNEXPECTED
;
}
return
S_OK
;
return
This
->
site
?
set_ctx_site
(
This
)
:
S_OK
;
}
static
HRESULT
WINAPI
JScriptParse_AddScriptlet
(
IActiveScriptParse
*
iface
,
...
...
dlls/jscript/tests/jscript.c
View file @
89327655
...
...
@@ -339,11 +339,64 @@ static void test_jscript(void)
ok
(
!
ref
,
"ref = %d
\n
"
,
ref
);
}
static
void
test_jscript2
(
void
)
{
IActiveScriptParse
*
parse
;
IActiveScript
*
script
;
IUnknown
*
unk
;
ULONG
ref
;
HRESULT
hres
;
hres
=
CoCreateInstance
(
&
CLSID_JScript
,
NULL
,
CLSCTX_INPROC_SERVER
|
CLSCTX_INPROC_HANDLER
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
ok
(
hres
==
S_OK
,
"CoCreateInstance failed: %08x
\n
"
,
hres
);
if
(
FAILED
(
hres
))
return
;
hres
=
IUnknown_QueryInterface
(
unk
,
&
IID_IActiveScript
,
(
void
**
)
&
script
);
ok
(
hres
==
S_OK
,
"Could not get IActiveScript: %08x
\n
"
,
hres
);
hres
=
IUnknown_QueryInterface
(
unk
,
&
IID_IActiveScriptParse
,
(
void
**
)
&
parse
);
ok
(
hres
==
S_OK
,
"Could not get IActiveScriptParse: %08x
\n
"
,
hres
);
test_state
(
script
,
SCRIPTSTATE_UNINITIALIZED
);
SET_EXPECT
(
GetLCID
);
hres
=
IActiveScript_SetScriptSite
(
script
,
&
ActiveScriptSite
);
ok
(
hres
==
S_OK
,
"SetScriptSite failed: %08x
\n
"
,
hres
);
CHECK_CALLED
(
GetLCID
);
test_state
(
script
,
SCRIPTSTATE_UNINITIALIZED
);
SET_EXPECT
(
OnStateChange_INITIALIZED
);
hres
=
IActiveScriptParse_InitNew
(
parse
);
ok
(
hres
==
S_OK
,
"InitNew failed: %08x
\n
"
,
hres
);
CHECK_CALLED
(
OnStateChange_INITIALIZED
);
hres
=
IActiveScriptParse_InitNew
(
parse
);
ok
(
hres
==
E_UNEXPECTED
,
"InitNew failed: %08x, expected E_UNEXPECTED
\n
"
,
hres
);
SET_EXPECT
(
OnStateChange_CLOSED
);
hres
=
IActiveScript_Close
(
script
);
ok
(
hres
==
S_OK
,
"Close failed: %08x
\n
"
,
hres
);
CHECK_CALLED
(
OnStateChange_CLOSED
);
test_state
(
script
,
SCRIPTSTATE_CLOSED
);
test_script_dispatch
(
script
,
FALSE
);
IActiveScriptParse_Release
(
parse
);
IActiveScript_Release
(
script
);
ref
=
IUnknown_Release
(
unk
);
ok
(
!
ref
,
"ref = %d
\n
"
,
ref
);
}
START_TEST
(
jscript
)
{
CoInitialize
(
NULL
);
test_jscript
();
test_jscript2
();
CoUninitialize
();
}
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