Module: wine Branch: master Commit: 99d1a8529beb450aa1eaa46ecdb49ccb532549c6 URL: http://source.winehq.org/git/wine.git/?a=commit;h=99d1a8529beb450aa1eaa46ecd...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Dec 21 16:21:03 2012 +0100
jscript: Added null and undefined values support to to_object.
---
dlls/jscript/jsutils.c | 7 ++++--- dlls/jscript/tests/api.js | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c index 91e0397..5527724 100644 --- a/dlls/jscript/jsutils.c +++ b/dlls/jscript/jsutils.c @@ -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; diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 5d45777..eb16176 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -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;