Module: wine Branch: master Commit: 7202f1a32f884838586c1b019b02401f22cafd7a URL: http://source.winehq.org/git/wine.git/?a=commit;h=7202f1a32f884838586c1b019b...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Dec 17 13:36:31 2012 +0100
jscript: Fixed deleting properties of pure dispatch interface.
---
dlls/jscript/dispex.c | 14 ++++++++++++-- dlls/jscript/tests/run.c | 8 ++++++++ 2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index dbb1c63..78809ee 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -1542,8 +1542,18 @@ HRESULT disp_delete_name(script_ctx_t *ctx, IDispatch *disp, jsstr_t *name, BOOL
IDispatchEx_Release(dispex); }else { - hres = S_OK; - ret = FALSE; + WCHAR *name_str = name->str; + DISPID id; + + hres = IDispatch_GetIDsOfNames(disp, &IID_NULL, &name_str, 1, 0, &id); + if(SUCCEEDED(hres)) { + /* Property exists and we can't delete it from pure IDispatch interface, so return false. */ + *ret = FALSE; + }else if(hres == DISP_E_UNKNOWNNAME) { + /* Property doesn't exist, so nothing to delete */ + *ret = TRUE; + hres = S_OK; + } }
return hres; diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index 55b1398..46f519a 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -1846,6 +1846,14 @@ static BOOL run_tests(void) CHECK_CALLED(global_propdelete_d); CHECK_CALLED(DeleteMemberByDispID);
+ 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); + + SET_EXPECT(puredisp_noprop_d); + parse_script_a("ok((delete pureDisp.noprop) === true, 'delete pureDisp.noprop did not return false');"); + CHECK_CALLED(puredisp_noprop_d); + parse_script_a("(function reportSuccess() {})()");
parse_script_a("ok(typeof(test) === 'object', "typeof(test) != 'object'");");