jscript: Throw TypeError in instanceof_expression_eval.

This commit is contained in:
Jacek Caban 2010-08-16 12:36:34 +02:00 committed by Alexandre Julliard
parent 50ef3a2018
commit be3dc38183
4 changed files with 7 additions and 4 deletions

View File

@ -1999,10 +1999,8 @@ static HRESULT instanceof_eval(exec_ctx_t *ctx, VARIANT *inst, VARIANT *objv, js
static const WCHAR prototypeW[] = {'p','r','o','t','o','t', 'y', 'p','e',0};
if(V_VT(objv) != VT_DISPATCH) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(V_VT(objv) != VT_DISPATCH || !V_DISPATCH(objv))
return throw_type_error(ctx->parser->script, ei, IDS_NOT_FUNC, NULL);
obj = iface_to_jsdisp((IUnknown*)V_DISPATCH(objv));
if(!obj) {

View File

@ -26,6 +26,7 @@ STRINGTABLE
IDS_INVALID_CALL_ARG "Invalid procedure call or argument"
IDS_CREATE_OBJ_ERROR "Automation server can't create object"
IDS_NO_PROPERTY "Object doesn't support this property or method"
IDS_UNSUPPORTED_ACTION "Object doesn't support this action"
IDS_ARG_NOT_OPT "Argument not optional"
IDS_SYNTAX_ERROR "Syntax error"
IDS_SEMICOLON "Expected ';'"

View File

@ -22,6 +22,7 @@
#define IDS_INVALID_CALL_ARG 0x0005
#define IDS_CREATE_OBJ_ERROR 0x01AD
#define IDS_NO_PROPERTY 0x01B6
#define IDS_UNSUPPORTED_ACTION 0x01BD
#define IDS_ARG_NOT_OPT 0x01c1
#define IDS_SYNTAX_ERROR 0x03EA
#define IDS_SEMICOLON 0x03EC

View File

@ -1888,6 +1888,9 @@ exception_test(function() {eval("'unterminated")}, "SyntaxError", -2146827273);
exception_test(function() {eval("nonexistingfunc()")}, "TypeError", -2146823281);
exception_test(function() {RegExp(/a/, "g");}, "RegExpError", -2146823271);
exception_test(function() {encodeURI('\udcaa');}, "URIError", -2146823264);
exception_test(function() {(new Object()) instanceof 3;}, "TypeError", -2146823286);
exception_test(function() {(new Object()) instanceof null;}, "TypeError", -2146823286);
exception_test(function() {(new Object()) instanceof nullDisp;}, "TypeError", -2146823286);
function testThisExcept(func, number) {
exception_test(function() {func.call(new Object())}, "TypeError", number);