Commit 2e97b1f0 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

jscript: Throw 'Object expected' error in call_expression_eval.

parent c4bc5be2
...@@ -1570,16 +1570,19 @@ HRESULT call_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags, ...@@ -1570,16 +1570,19 @@ HRESULT call_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags,
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
switch(exprval.type) { switch(exprval.type) {
case EXPRVAL_VARIANT: case EXPRVAL_VARIANT:
if(V_VT(&exprval.u.var) != VT_DISPATCH) if(V_VT(&exprval.u.var) == VT_DISPATCH)
return throw_type_error(ctx->var_disp->ctx, ei, IDS_NO_PROPERTY, NULL);
hres = disp_call(V_DISPATCH(&exprval.u.var), DISPID_VALUE, ctx->parser->script->lcid, hres = disp_call(V_DISPATCH(&exprval.u.var), DISPID_VALUE, ctx->parser->script->lcid,
DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/); DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/);
else
hres = throw_type_error(ctx->var_disp->ctx, ei, IDS_NO_PROPERTY, NULL);
break; break;
case EXPRVAL_IDREF: case EXPRVAL_IDREF:
hres = disp_call(exprval.u.idref.disp, exprval.u.idref.id, ctx->parser->script->lcid, hres = disp_call(exprval.u.idref.disp, exprval.u.idref.id, ctx->parser->script->lcid,
DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/); DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/);
break; break;
case EXPRVAL_INVALID:
hres = throw_type_error(ctx->var_disp->ctx, ei, IDS_OBJECT_EXPECTED, NULL);
break;
default: default:
FIXME("unimplemented type %d\n", exprval.type); FIXME("unimplemented type %d\n", exprval.type);
hres = E_NOTIMPL; hres = E_NOTIMPL;
......
...@@ -34,6 +34,7 @@ STRINGTABLE DISCARDABLE ...@@ -34,6 +34,7 @@ STRINGTABLE DISCARDABLE
IDS_NOT_FUNC "Function expected" IDS_NOT_FUNC "Function expected"
IDS_NOT_DATE "'[object]' is not a date object" IDS_NOT_DATE "'[object]' is not a date object"
IDS_NOT_NUM "Number expected" IDS_NOT_NUM "Number expected"
IDS_OBJECT_EXPECTED "Object expected"
IDS_ILLEGAL_ASSIGN "Illegal assignment" IDS_ILLEGAL_ASSIGN "Illegal assignment"
IDS_UNDEFINED "'|' is undefined" IDS_UNDEFINED "'|' is undefined"
IDS_NOT_BOOL "Boolean object expected" IDS_NOT_BOOL "Boolean object expected"
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#define IDS_NOT_FUNC 0x138A #define IDS_NOT_FUNC 0x138A
#define IDS_NOT_DATE 0x138E #define IDS_NOT_DATE 0x138E
#define IDS_NOT_NUM 0x1389 #define IDS_NOT_NUM 0x1389
#define IDS_OBJECT_EXPECTED 0x128F
#define IDS_ILLEGAL_ASSIGN 0x1390 #define IDS_ILLEGAL_ASSIGN 0x1390
#define IDS_UNDEFINED 0x1391 #define IDS_UNDEFINED 0x1391
#define IDS_NOT_BOOL 0x1392 #define IDS_NOT_BOOL 0x1392
......
...@@ -1481,6 +1481,7 @@ exception_test(function() {eval("for(i=0;i<10")}, "SyntaxError", -2146827284); ...@@ -1481,6 +1481,7 @@ exception_test(function() {eval("for(i=0;i<10")}, "SyntaxError", -2146827284);
exception_test(function() {eval("while(")}, "SyntaxError", -2146827286); exception_test(function() {eval("while(")}, "SyntaxError", -2146827286);
exception_test(function() {eval("if(")}, "SyntaxError", -2146827286); exception_test(function() {eval("if(")}, "SyntaxError", -2146827286);
exception_test(function() {eval("'unterminated")}, "SyntaxError", -2146827273); exception_test(function() {eval("'unterminated")}, "SyntaxError", -2146827273);
exception_test(function() {eval("nonexistingfunc()")}, "TypeError", -2146823537);
function testObjectInherit(obj, constr, ts, tls, vo) { function testObjectInherit(obj, constr, ts, tls, vo) {
ok(obj instanceof Object, "obj is not instance of Object"); ok(obj instanceof Object, "obj is not instance of Object");
......
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