jscript: Added null and undefined values support to to_object.

This commit is contained in:
Jacek Caban 2012-12-21 16:21:03 +01:00 committed by Alexandre Julliard
parent c092d82500
commit 99d1a8529b
2 changed files with 6 additions and 3 deletions

View File

@ -820,6 +820,10 @@ HRESULT to_object(script_ctx_t *ctx, jsval_t val, IDispatch **disp)
*disp = to_disp(dispex);
break;
case JSV_UNDEFINED:
case JSV_NULL:
WARN("object expected\n");
return throw_type_error(ctx, JS_E_OBJECT_EXPECTED, NULL);
case JSV_VARIANT:
switch(V_VT(get_variant(val))) {
case VT_ARRAY|VT_VARIANT:
@ -835,9 +839,6 @@ HRESULT to_object(script_ctx_t *ctx, jsval_t val, IDispatch **disp)
return E_NOTIMPL;
}
break;
default:
FIXME("unsupported %s\n", debugstr_jsval(val));
return E_NOTIMPL;
}
return S_OK;

View File

@ -2300,6 +2300,8 @@ testException(function() {+nullDisp.prop;}, "E_OBJECT_REQUIRED");
testException(function() {+nullDisp["prop"];}, "E_OBJECT_REQUIRED");
testException(function() {delete (new Object());}, "E_INVALID_DELETE");
testException(function() {delete false;}, "E_INVALID_DELETE");
testException(function() {undefined.toString();}, "E_OBJECT_EXPECTED");
testException(function() {null.toString();}, "E_OBJECT_EXPECTED");
obj = new Object();
obj.prop = 1;