jscript: Fixed to_object for NULL IDispatch.

This commit is contained in:
Jacek Caban 2009-09-24 00:44:30 +02:00 committed by Alexandre Julliard
parent 1a6aa96305
commit a8c7e97d0a
2 changed files with 17 additions and 2 deletions

View File

@ -603,8 +603,18 @@ HRESULT to_object(script_ctx_t *ctx, VARIANT *v, IDispatch **disp)
*disp = (IDispatch*)_IDispatchEx_(dispex);
break;
case VT_DISPATCH:
if(V_DISPATCH(v)) {
IDispatch_AddRef(V_DISPATCH(v));
*disp = V_DISPATCH(v);
}else {
DispatchEx *obj;
hres = create_object(ctx, NULL, &obj);
if(FAILED(hres))
return hres;
*disp = (IDispatch*)_IDispatchEx_(obj);
}
break;
case VT_BOOL:
hres = create_bool(ctx, V_BOOL(v), &dispex);

View File

@ -948,6 +948,11 @@ ok(!nullDisp === true, "!nullDisp = " + !nullDisp);
ok(String(nullDisp) === "null", "String(nullDisp) = " + String(nullDisp));
ok(nullDisp != new Object(), "nullDisp == new Object()");
ok(new Object() != nullDisp, "new Object() == nullDisp");
ok((typeof Object(nullDisp)) === "object", "typeof Object(nullDisp) !== 'object'");
tmp = getVT(Object(nullDisp));
ok(tmp === "VT_DISPATCH", "getVT(Object(nullDisp) = " + tmp);
tmp = Object(nullDisp).toString();
ok(tmp === "[object Object]", "Object(nullDisp).toString() = " + tmp);
function do_test() {}
function nosemicolon() {} nosemicolon();