From f780ae0f86cb925e6fa149b901960536f50202d7 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 17 Dec 2012 13:36:55 +0100 Subject: [PATCH] jscript: Fixed deleting property by ID from IDispatchEx interface. --- dlls/jscript/dispex.c | 2 +- dlls/jscript/tests/run.c | 34 +++++++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 0ecd20ac515..9e2ba5bffa2 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -1501,7 +1501,7 @@ HRESULT disp_delete(IDispatch *disp, DISPID id, BOOL *ret) if(FAILED(hres)) return hres; - *ret = TRUE; + *ret = hres == S_OK; return S_OK; } diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index 52fee575b17..0b0215c4fb5 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -81,6 +81,7 @@ DEFINE_EXPECT(global_propget_i); DEFINE_EXPECT(global_propput_d); DEFINE_EXPECT(global_propput_i); DEFINE_EXPECT(global_propdelete_d); +DEFINE_EXPECT(global_nopropdelete_d); DEFINE_EXPECT(global_success_d); DEFINE_EXPECT(global_success_i); DEFINE_EXPECT(global_notexists_d); @@ -102,6 +103,7 @@ DEFINE_EXPECT(GetItemInfo_testVal); DEFINE_EXPECT(ActiveScriptSite_OnScriptError); DEFINE_EXPECT(invoke_func); DEFINE_EXPECT(DeleteMemberByDispID); +DEFINE_EXPECT(DeleteMemberByDispID_false); #define DISPID_GLOBAL_TESTPROPGET 0x1000 #define DISPID_GLOBAL_TESTPROPPUT 0x1001 @@ -130,7 +132,8 @@ DEFINE_EXPECT(DeleteMemberByDispID); #define DISPID_GLOBAL_TESTRES 0x1018 #define DISPID_GLOBAL_TESTNORES 0x1019 -#define DISPID_GLOBAL_TESTPROPDELETE 0x2000 +#define DISPID_GLOBAL_TESTPROPDELETE 0x2000 +#define DISPID_GLOBAL_TESTNOPROPDELETE 0x2001 #define DISPID_TESTOBJ_PROP 0x2000 #define DISPID_TESTOBJ_ONLYDISPID 0x2001 @@ -497,6 +500,12 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD *pid = DISPID_GLOBAL_TESTPROPDELETE; return S_OK; } + if(!strcmp_wa(bstrName, "testNoPropDelete")) { + CHECK_EXPECT(global_nopropdelete_d); + test_grfdex(grfdex, fdexNameCaseSensitive); + *pid = DISPID_GLOBAL_TESTNOPROPDELETE; + return S_OK; + } if(!strcmp_wa(bstrName, "getVT")) { test_grfdex(grfdex, fdexNameCaseSensitive); *pid = DISPID_GLOBAL_GETVT; @@ -1082,9 +1091,18 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, static HRESULT WINAPI Global_DeleteMemberByDispID(IDispatchEx *iface, DISPID id) { - CHECK_EXPECT(DeleteMemberByDispID); - ok(id == DISPID_GLOBAL_TESTPROPDELETE, "id = %d\n", id); - return S_OK; + switch(id) { + case DISPID_GLOBAL_TESTPROPDELETE: + CHECK_EXPECT(DeleteMemberByDispID); + return S_OK; + case DISPID_GLOBAL_TESTNOPROPDELETE: + CHECK_EXPECT(DeleteMemberByDispID_false); + return S_FALSE; + default: + ok(0, "id = %d\n", id); + } + + return E_FAIL; } static IDispatchExVtbl GlobalVtbl = { @@ -1855,10 +1873,16 @@ static BOOL run_tests(void) SET_EXPECT(global_propdelete_d); SET_EXPECT(DeleteMemberByDispID); - parse_script_a("delete testPropDelete;"); + parse_script_a("ok((delete testPropDelete) === true, 'delete testPropDelete did not return true');"); CHECK_CALLED(global_propdelete_d); CHECK_CALLED(DeleteMemberByDispID); + SET_EXPECT(global_nopropdelete_d); + SET_EXPECT(DeleteMemberByDispID_false); + parse_script_a("ok((delete testNoPropDelete) === false, 'delete testPropDelete did not return false');"); + CHECK_CALLED(global_nopropdelete_d); + CHECK_CALLED(DeleteMemberByDispID_false); + SET_EXPECT(puredisp_prop_d); parse_script_a("ok((delete pureDisp.prop) === false, 'delete pureDisp.prop did not return true');"); CHECK_CALLED(puredisp_prop_d);