Commit 73658a8b authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added SCRIPTSTATE_CONNECTED implementation.

parent 89327655
......@@ -264,6 +264,7 @@ static HRESULT WINAPI JScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE s
switch(ss) {
case SCRIPTSTATE_STARTED:
case SCRIPTSTATE_CONNECTED: /* FIXME */
if(This->ctx->state == SCRIPTSTATE_CLOSED)
return E_UNEXPECTED;
......@@ -308,9 +309,15 @@ static HRESULT WINAPI JScript_Close(IActiveScript *iface)
if(This->thread_id != GetCurrentThreadId())
return E_UNEXPECTED;
clear_script_queue(This);
if(This->ctx) {
if(This->ctx->state == SCRIPTSTATE_CONNECTED)
change_state(This, SCRIPTSTATE_DISCONNECTED);
clear_script_queue(This);
if(This->ctx->state == SCRIPTSTATE_DISCONNECTED)
change_state(This, SCRIPTSTATE_INITIALIZED);
if(This->ctx->named_items) {
named_item_t *iter, *iter2;
......
......@@ -61,6 +61,8 @@ static const CLSID CLSID_JScript =
DEFINE_EXPECT(GetLCID);
DEFINE_EXPECT(OnStateChange_STARTED);
DEFINE_EXPECT(OnStateChange_CONNECTED);
DEFINE_EXPECT(OnStateChange_DISCONNECTED);
DEFINE_EXPECT(OnStateChange_CLOSED);
DEFINE_EXPECT(OnStateChange_INITIALIZED);
DEFINE_EXPECT(OnEnterScript);
......@@ -134,6 +136,12 @@ static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface, S
case SCRIPTSTATE_STARTED:
CHECK_EXPECT(OnStateChange_STARTED);
return S_OK;
case SCRIPTSTATE_CONNECTED:
CHECK_EXPECT(OnStateChange_CONNECTED);
return S_OK;
case SCRIPTSTATE_DISCONNECTED:
CHECK_EXPECT(OnStateChange_DISCONNECTED);
return S_OK;
case SCRIPTSTATE_CLOSED:
CHECK_EXPECT(OnStateChange_CLOSED);
return S_OK;
......@@ -376,9 +384,20 @@ static void test_jscript2(void)
hres = IActiveScriptParse_InitNew(parse);
ok(hres == E_UNEXPECTED, "InitNew failed: %08x, expected E_UNEXPECTED\n", hres);
SET_EXPECT(OnStateChange_CONNECTED);
hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_CONNECTED);
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_CONNECTED) failed: %08x\n", hres);
CHECK_CALLED(OnStateChange_CONNECTED);
test_state(script, SCRIPTSTATE_CONNECTED);
SET_EXPECT(OnStateChange_DISCONNECTED);
SET_EXPECT(OnStateChange_INITIALIZED);
SET_EXPECT(OnStateChange_CLOSED);
hres = IActiveScript_Close(script);
ok(hres == S_OK, "Close failed: %08x\n", hres);
CHECK_CALLED(OnStateChange_DISCONNECTED);
CHECK_CALLED(OnStateChange_INITIALIZED);
CHECK_CALLED(OnStateChange_CLOSED);
test_state(script, SCRIPTSTATE_CLOSED);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment