Commit a7cc9441 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Correctly throw an exception if instanceof expression is not used on function.

parent 42c2bd7b
......@@ -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))
......
......@@ -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");
......
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