Piotr Caban : jscript: Throw TypeError in call_expression_eval.

Alexandre Julliard julliard at winehq.org
Tue Jul 21 09:34:19 CDT 2009


Module: wine
Branch: master
Commit: f89fbb9b48817123419958d77f1fb621f2168f55
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f89fbb9b48817123419958d77f1fb621f2168f55

Author: Piotr Caban <piotr.caban at gmail.com>
Date:   Mon Jul 20 18:18:12 2009 +0200

jscript: Throw TypeError in call_expression_eval.

---

 dlls/jscript/engine.c      |    7 ++-----
 dlls/jscript/jscript_En.rc |    1 +
 dlls/jscript/resource.h    |    1 +
 dlls/jscript/tests/api.js  |    2 ++
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index f3ea33f..10004a7 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -1539,11 +1539,8 @@ 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) {
-                FIXME("throw TypeError\n");
-                hres = E_NOTIMPL;
-                break;
-            }
+            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*/);
diff --git a/dlls/jscript/jscript_En.rc b/dlls/jscript/jscript_En.rc
index f54cffb..40b64c9 100644
--- a/dlls/jscript/jscript_En.rc
+++ b/dlls/jscript/jscript_En.rc
@@ -22,6 +22,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
 
 STRINGTABLE DISCARDABLE
 {
+    IDS_NO_PROPERTY         "Object doesn't support this property or method"
     IDS_ARG_NOT_OPT         "Argument not optional"
     IDS_NOT_DATE            "'[object]' is not a date object"
     IDS_NOT_BOOL            "Boolean object expected"
diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h
index 05b693d..44c04a8 100644
--- a/dlls/jscript/resource.h
+++ b/dlls/jscript/resource.h
@@ -18,6 +18,7 @@
 
 #include <windef.h>
 
+#define IDS_NO_PROPERTY                     0x01B6
 #define IDS_ARG_NOT_OPT                     0x01c1
 #define IDS_NOT_DATE                        0x138E
 #define IDS_NOT_BOOL                        0x1392
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index cae853b..d0e5995 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -1300,5 +1300,7 @@ function exception_test(func, type) {
 exception_test(function() {arr.toString = Date.prototype.toString; arr.toString();}, "TypeError");
 exception_test(function() {Array(-3);}, "RangeError");
 exception_test(function() {arr.toString = Boolean.prototype.toString; arr.toString();}, "TypeError");
+exception_test(function() {date.setTime();}, "TypeError");
+exception_test(function() {arr.test();}, "TypeError");
 
 reportSuccess();




More information about the wine-cvs mailing list