Piotr Caban : jscript: Throw 'Object expected' error in call_expression_eval.
Alexandre Julliard
julliard at winehq.org
Wed Sep 2 09:31:02 CDT 2009
Module: wine
Branch: master
Commit: 2e97b1f07f1abd119bced7a1307684648f8b046c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2e97b1f07f1abd119bced7a1307684648f8b046c
Author: Piotr Caban <piotr.caban at gmail.com>
Date: Wed Sep 2 12:33:08 2009 +0200
jscript: Throw 'Object expected' error in call_expression_eval.
---
dlls/jscript/engine.c | 13 ++++++++-----
dlls/jscript/jscript_En.rc | 1 +
dlls/jscript/resource.h | 1 +
dlls/jscript/tests/api.js | 1 +
4 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index cbd2797..3931fff 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -1570,16 +1570,19 @@ HRESULT call_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags,
if(SUCCEEDED(hres)) {
switch(exprval.type) {
case EXPRVAL_VARIANT:
- 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,
- DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/);
+ if(V_VT(&exprval.u.var) == VT_DISPATCH)
+ 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*/);
+ else
+ hres = throw_type_error(ctx->var_disp->ctx, ei, IDS_NO_PROPERTY, NULL);
break;
case EXPRVAL_IDREF:
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*/);
break;
+ case EXPRVAL_INVALID:
+ hres = throw_type_error(ctx->var_disp->ctx, ei, IDS_OBJECT_EXPECTED, NULL);
+ break;
default:
FIXME("unimplemented type %d\n", exprval.type);
hres = E_NOTIMPL;
diff --git a/dlls/jscript/jscript_En.rc b/dlls/jscript/jscript_En.rc
index 697c1ab..eca9bc8 100644
--- a/dlls/jscript/jscript_En.rc
+++ b/dlls/jscript/jscript_En.rc
@@ -34,6 +34,7 @@ STRINGTABLE DISCARDABLE
IDS_NOT_FUNC "Function expected"
IDS_NOT_DATE "'[object]' is not a date object"
IDS_NOT_NUM "Number expected"
+ IDS_OBJECT_EXPECTED "Object expected"
IDS_ILLEGAL_ASSIGN "Illegal assignment"
IDS_UNDEFINED "'|' is undefined"
IDS_NOT_BOOL "Boolean object expected"
diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h
index f7e94b9..c3e58cb 100644
--- a/dlls/jscript/resource.h
+++ b/dlls/jscript/resource.h
@@ -30,6 +30,7 @@
#define IDS_NOT_FUNC 0x138A
#define IDS_NOT_DATE 0x138E
#define IDS_NOT_NUM 0x1389
+#define IDS_OBJECT_EXPECTED 0x128F
#define IDS_ILLEGAL_ASSIGN 0x1390
#define IDS_UNDEFINED 0x1391
#define IDS_NOT_BOOL 0x1392
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index 3b5e834..d6e8827 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -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("if(")}, "SyntaxError", -2146827286);
exception_test(function() {eval("'unterminated")}, "SyntaxError", -2146827273);
+exception_test(function() {eval("nonexistingfunc()")}, "TypeError", -2146823537);
function testObjectInherit(obj, constr, ts, tls, vo) {
ok(obj instanceof Object, "obj is not instance of Object");
More information about the wine-cvs
mailing list