Commit 99d1a852 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added null and undefined values support to to_object.

parent c092d825
...@@ -820,6 +820,10 @@ HRESULT to_object(script_ctx_t *ctx, jsval_t val, IDispatch **disp) ...@@ -820,6 +820,10 @@ HRESULT to_object(script_ctx_t *ctx, jsval_t val, IDispatch **disp)
*disp = to_disp(dispex); *disp = to_disp(dispex);
break; break;
case JSV_UNDEFINED:
case JSV_NULL:
WARN("object expected\n");
return throw_type_error(ctx, JS_E_OBJECT_EXPECTED, NULL);
case JSV_VARIANT: case JSV_VARIANT:
switch(V_VT(get_variant(val))) { switch(V_VT(get_variant(val))) {
case VT_ARRAY|VT_VARIANT: case VT_ARRAY|VT_VARIANT:
...@@ -835,9 +839,6 @@ HRESULT to_object(script_ctx_t *ctx, jsval_t val, IDispatch **disp) ...@@ -835,9 +839,6 @@ HRESULT to_object(script_ctx_t *ctx, jsval_t val, IDispatch **disp)
return E_NOTIMPL; return E_NOTIMPL;
} }
break; break;
default:
FIXME("unsupported %s\n", debugstr_jsval(val));
return E_NOTIMPL;
} }
return S_OK; return S_OK;
......
...@@ -2300,6 +2300,8 @@ testException(function() {+nullDisp.prop;}, "E_OBJECT_REQUIRED"); ...@@ -2300,6 +2300,8 @@ testException(function() {+nullDisp.prop;}, "E_OBJECT_REQUIRED");
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 (new Object());}, "E_INVALID_DELETE");
testException(function() {delete false;}, "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 = new Object();
obj.prop = 1; obj.prop = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment