jscript: Fixed deleting properties of pure dispatch interface.

This commit is contained in:
Jacek Caban 2012-12-17 13:36:31 +01:00 committed by Alexandre Julliard
parent 4dbd777de2
commit 7202f1a32f
2 changed files with 20 additions and 2 deletions

View File

@ -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;

View File

@ -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'\");");