jscript: Fixed typeof implementation for null VT_DISPATCH.

This commit is contained in:
Jacek Caban 2009-09-06 19:09:30 +02:00 committed by Alexandre Julliard
parent d1f5fa65d0
commit dda957d87c
3 changed files with 24 additions and 2 deletions

View File

@ -2336,8 +2336,7 @@ static HRESULT typeof_exprval(exec_ctx_t *ctx, exprval_t *exprval, jsexcept_t *e
case VT_DISPATCH: {
DispatchEx *dispex;
dispex = iface_to_jsdisp((IUnknown*)V_DISPATCH(&val));
if(dispex) {
if(V_DISPATCH(&val) && (dispex = iface_to_jsdisp((IUnknown*)V_DISPATCH(&val)))) {
*ret = is_class(dispex, JSCLASS_FUNCTION) ? functionW : objectW;
jsdisp_release(dispex);
}else {

View File

@ -922,6 +922,9 @@ ok(re.source === "=(\\?|%3F)", "re.source = " + re.source);
ok(createNullBSTR() === '', "createNullBSTR() !== ''");
ok(getVT(nullDisp) === "VT_DISPATCH", "getVT(nullDisp) = " + typeof(nullDisp));
ok(typeof(nullDisp) === "object", "typeof(nullDisp) = " + typeof(nullDisp));
function do_test() {}
function nosemicolon() {} nosemicolon();
function () {} nosemicolon();

View File

@ -76,6 +76,7 @@ DEFINE_EXPECT(GetItemInfo_testVal);
#define DISPID_GLOBAL_GETVT 0x1005
#define DISPID_GLOBAL_TESTOBJ 0x1006
#define DISPID_GLOBAL_NULL_BSTR 0x1007
#define DISPID_GLOBAL_NULL_DISP 0x1008
static const WCHAR testW[] = {'t','e','s','t',0};
static const CHAR testA[] = "test";
@ -298,6 +299,10 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
*pid = DISPID_GLOBAL_NULL_BSTR;
return S_OK;
}
if(!strcmp_wa(bstrName, "nullDisp")) {
*pid = DISPID_GLOBAL_NULL_DISP;
return S_OK;
}
if(!strcmp_wa(bstrName, "notExists")) {
CHECK_EXPECT(global_notexists_d);
ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex);
@ -456,6 +461,21 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
V_BSTR(pvarRes) = NULL;
}
return S_OK;
case DISPID_GLOBAL_NULL_DISP:
ok(wFlags == INVOKE_PROPERTYGET, "wFlags = %x\n", wFlags);
ok(pdp != NULL, "pdp == NULL\n");
ok(!pdp->rgvarg, "rgvarg != NULL\n");
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
ok(!pdp->cArgs, "cArgs = %d\n", pdp->cArgs);
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
ok(pvarRes != NULL, "pvarRes == NULL\n");
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
ok(pei != NULL, "pei == NULL\n");
V_VT(pvarRes) = VT_DISPATCH;
V_DISPATCH(pvarRes) = NULL;
return S_OK;
}
ok(0, "unexpected call %x\n", id);