jscript: Correctly throw an exception if instanceof expression is not used on function.
This commit is contained in:
parent
42c2bd7bd9
commit
a7cc9441e9
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue