Module: wine Branch: master Commit: a7cc9441e9b1d8579ec67bc80e6eaf7a3b489b6f URL: http://source.winehq.org/git/wine.git/?a=commit;h=a7cc9441e9b1d8579ec67bc80e...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Jun 21 17:46:04 2011 +0200
jscript: Correctly throw an exception if instanceof expression is not used on function.
---
dlls/jscript/engine.c | 5 ++--- dlls/jscript/tests/api.js | 1 + 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 89523bb..160a67b 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -2001,15 +2001,14 @@ static HRESULT instanceof_eval(script_ctx_t *ctx, VARIANT *inst, VARIANT *objv,
obj = iface_to_jsdisp((IUnknown*)V_DISPATCH(objv)); if(!obj) { - FIXME("throw TypeError\n"); + FIXME("non-jsdisp objects not supported\n"); return E_FAIL; }
if(is_class(obj, JSCLASS_FUNCTION)) { hres = jsdisp_propget_name(obj, prototypeW, &var, ei, NULL/*FIXME*/); }else { - FIXME("throw TypeError\n"); - hres = E_FAIL; + hres = throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL); } jsdisp_release(obj); if(FAILED(hres)) diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 45d24b1..2d28179 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -1982,6 +1982,7 @@ testException(function() {(new Number(3)).toString(1);}, "E_INVALID_CALL_ARG"); testException(function() {not_existing_variable.something();}, "E_UNDEFINED"); testException(function() {date();}, "E_NOT_FUNC"); testException(function() {arr();}, "E_NOT_FUNC"); +testException(function() {(new Object) instanceof (new Object);}, "E_NOT_FUNC"); testException(function() {eval("nonexistingfunc()")}, "E_OBJECT_EXPECTED"); testException(function() {(new Object()) instanceof 3;}, "E_NOT_FUNC"); testException(function() {(new Object()) instanceof null;}, "E_NOT_FUNC");