jscript: Added IActiveScript::GetScriptState implementation.
This commit is contained in:
parent
dfbb5b9530
commit
db21502d51
|
@ -188,8 +188,22 @@ static HRESULT WINAPI JScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE s
|
||||||
static HRESULT WINAPI JScript_GetScriptState(IActiveScript *iface, SCRIPTSTATE *pssState)
|
static HRESULT WINAPI JScript_GetScriptState(IActiveScript *iface, SCRIPTSTATE *pssState)
|
||||||
{
|
{
|
||||||
JScript *This = ACTSCRIPT_THIS(iface);
|
JScript *This = ACTSCRIPT_THIS(iface);
|
||||||
FIXME("(%p)->(%p)\n", This, pssState);
|
|
||||||
return E_NOTIMPL;
|
TRACE("(%p)->(%p)\n", This, pssState);
|
||||||
|
|
||||||
|
if(!pssState)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
if(!This->thread_id) {
|
||||||
|
*pssState = SCRIPTSTATE_UNINITIALIZED;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(This->thread_id != GetCurrentThreadId())
|
||||||
|
return E_UNEXPECTED;
|
||||||
|
|
||||||
|
*pssState = This->ctx ? This->ctx->state : SCRIPTSTATE_UNINITIALIZED;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI JScript_Close(IActiveScript *iface)
|
static HRESULT WINAPI JScript_Close(IActiveScript *iface)
|
||||||
|
|
|
@ -66,6 +66,17 @@ DEFINE_EXPECT(OnStateChange_INITIALIZED);
|
||||||
DEFINE_EXPECT(OnEnterScript);
|
DEFINE_EXPECT(OnEnterScript);
|
||||||
DEFINE_EXPECT(OnLeaveScript);
|
DEFINE_EXPECT(OnLeaveScript);
|
||||||
|
|
||||||
|
#define test_state(s,ss) _test_state(__LINE__,s,ss)
|
||||||
|
static void _test_state(unsigned line, IActiveScript *script, SCRIPTSTATE exstate)
|
||||||
|
{
|
||||||
|
SCRIPTSTATE state = -1;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = IActiveScript_GetScriptState(script, &state);
|
||||||
|
ok_(__FILE__,line) (hres == S_OK, "GetScriptState failed: %08x\n", hres);
|
||||||
|
ok_(__FILE__,line) (state == exstate, "state=%d, expected %d\n", state, exstate);
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, REFIID riid, void **ppv)
|
static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
*ppv = NULL;
|
*ppv = NULL;
|
||||||
|
@ -277,6 +288,7 @@ static void test_jscript(void)
|
||||||
hres = IUnknown_QueryInterface(unk, &IID_IActiveScriptParse, (void**)&parse);
|
hres = IUnknown_QueryInterface(unk, &IID_IActiveScriptParse, (void**)&parse);
|
||||||
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres);
|
||||||
|
|
||||||
|
test_state(script, SCRIPTSTATE_UNINITIALIZED);
|
||||||
test_safety(unk);
|
test_safety(unk);
|
||||||
|
|
||||||
hres = IActiveScriptParse_InitNew(parse);
|
hres = IActiveScriptParse_InitNew(parse);
|
||||||
|
@ -288,6 +300,7 @@ static void test_jscript(void)
|
||||||
hres = IActiveScript_SetScriptSite(script, NULL);
|
hres = IActiveScript_SetScriptSite(script, NULL);
|
||||||
ok(hres == E_POINTER, "SetScriptSite failed: %08x, expected E_POINTER\n", hres);
|
ok(hres == E_POINTER, "SetScriptSite failed: %08x, expected E_POINTER\n", hres);
|
||||||
|
|
||||||
|
test_state(script, SCRIPTSTATE_UNINITIALIZED);
|
||||||
test_script_dispatch(script, FALSE);
|
test_script_dispatch(script, FALSE);
|
||||||
|
|
||||||
SET_EXPECT(GetLCID);
|
SET_EXPECT(GetLCID);
|
||||||
|
@ -297,6 +310,8 @@ static void test_jscript(void)
|
||||||
CHECK_CALLED(GetLCID);
|
CHECK_CALLED(GetLCID);
|
||||||
CHECK_CALLED(OnStateChange_INITIALIZED);
|
CHECK_CALLED(OnStateChange_INITIALIZED);
|
||||||
|
|
||||||
|
test_state(script, SCRIPTSTATE_INITIALIZED);
|
||||||
|
|
||||||
hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite);
|
hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite);
|
||||||
ok(hres == E_UNEXPECTED, "SetScriptSite failed: %08x, expected E_UNEXPECTED\n", hres);
|
ok(hres == E_UNEXPECTED, "SetScriptSite failed: %08x, expected E_UNEXPECTED\n", hres);
|
||||||
|
|
||||||
|
@ -307,6 +322,7 @@ static void test_jscript(void)
|
||||||
ok(hres == S_OK, "Close failed: %08x\n", hres);
|
ok(hres == S_OK, "Close failed: %08x\n", hres);
|
||||||
CHECK_CALLED(OnStateChange_CLOSED);
|
CHECK_CALLED(OnStateChange_CLOSED);
|
||||||
|
|
||||||
|
test_state(script, SCRIPTSTATE_CLOSED);
|
||||||
test_script_dispatch(script, FALSE);
|
test_script_dispatch(script, FALSE);
|
||||||
|
|
||||||
IActiveScriptParse_Release(parse);
|
IActiveScriptParse_Release(parse);
|
||||||
|
|
Loading…
Reference in New Issue