jscript: Use BSTR also for pure IDispatch call in Object.hasOwnProperty.

This commit is contained in:
Jacek Caban 2013-03-11 16:05:27 +01:00 committed by Alexandre Julliard
parent 67d86e630e
commit 52fc8b3d94
1 changed files with 13 additions and 13 deletions

View File

@ -113,6 +113,7 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
{ {
jsstr_t *name; jsstr_t *name;
DISPID id; DISPID id;
BSTR bstr;
HRESULT hres; HRESULT hres;
TRACE("\n"); TRACE("\n");
@ -131,6 +132,7 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
BOOL result; BOOL result;
hres = jsdisp_is_own_prop(jsthis->u.jsdisp, name->str, &result); hres = jsdisp_is_own_prop(jsthis->u.jsdisp, name->str, &result);
jsstr_release(name);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -139,22 +141,20 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
return S_OK; return S_OK;
} }
if(is_dispex(jsthis)) {
BSTR bstr;
bstr = SysAllocStringLen(name->str, jsstr_length(name)); bstr = SysAllocStringLen(NULL, jsstr_length(name));
if(bstr)
jsstr_flush(name, bstr);
jsstr_release(name);
if(!bstr) if(!bstr)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hres = IDispatchEx_GetDispID(jsthis->u.dispex, bstr, if(is_dispex(jsthis))
make_grfdex(ctx, fdexNameCaseSensitive), &id); hres = IDispatchEx_GetDispID(jsthis->u.dispex, bstr, make_grfdex(ctx, fdexNameCaseSensitive), &id);
SysFreeString(bstr); else
} else { hres = IDispatch_GetIDsOfNames(jsthis->u.disp, &IID_NULL, &bstr, 1, ctx->lcid, &id);
OLECHAR *names = name->str;
hres = IDispatch_GetIDsOfNames(jsthis->u.disp, &IID_NULL,
&names, 1, ctx->lcid, &id);
}
SysFreeString(bstr);
if(r) if(r)
*r = jsval_bool(SUCCEEDED(hres)); *r = jsval_bool(SUCCEEDED(hres));
return S_OK; return S_OK;