Piotr Caban : jscript: Throw TypeError in Function_toString.

Alexandre Julliard julliard at winehq.org
Wed Jul 22 09:35:01 CDT 2009


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

Author: Piotr Caban <piotr.caban at gmail.com>
Date:   Wed Jul 22 13:02:19 2009 +0200

jscript: Throw TypeError in Function_toString.

---

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

diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c
index dac8d3e..6ac668c 100644
--- a/dlls/jscript/function.c
+++ b/dlls/jscript/function.c
@@ -272,10 +272,8 @@ static HRESULT Function_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISP
 
     TRACE("\n");
 
-    if(!is_class(dispex, JSCLASS_FUNCTION)) {
-        FIXME("throw TypeError\n");
-        return E_FAIL;
-    }
+    if(!is_class(dispex, JSCLASS_FUNCTION))
+        return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL);
 
     function = (FunctionInstance*)dispex;
 
diff --git a/dlls/jscript/jscript_En.rc b/dlls/jscript/jscript_En.rc
index e0825e9..5e53f6d 100644
--- a/dlls/jscript/jscript_En.rc
+++ b/dlls/jscript/jscript_En.rc
@@ -25,6 +25,7 @@ STRINGTABLE DISCARDABLE
     IDS_INVALID_CALL_ARG    "Invalid procedure call or argument"
     IDS_NO_PROPERTY         "Object doesn't support this property or method"
     IDS_ARG_NOT_OPT         "Argument not optional"
+    IDS_NOT_FUNC            "Function expected"
     IDS_NOT_DATE            "'[object]' is not a date object"
     IDS_NOT_NUM             "Number expected"
     IDS_UNDEFINED           "'|' is undefined"
diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h
index 3aa014e..91d14d3 100644
--- a/dlls/jscript/resource.h
+++ b/dlls/jscript/resource.h
@@ -21,6 +21,7 @@
 #define IDS_INVALID_CALL_ARG                0x0005
 #define IDS_NO_PROPERTY                     0x01B6
 #define IDS_ARG_NOT_OPT                     0x01c1
+#define IDS_NOT_FUNC                        0x138A
 #define IDS_NOT_DATE                        0x138E
 #define IDS_NOT_NUM                         0x1389
 #define IDS_UNDEFINED                       0x1391
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index b663dad..2ed8bda 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -1314,5 +1314,6 @@ exception_test(function() {arr.test();}, "TypeError", -2146827850);
 exception_test(function() {arr.toString = Number.prototype.toString; arr.toString();}, "TypeError", -2146823287);
 exception_test(function() {(new Number(3)).toString(1);}, "TypeError", -2146828283);
 exception_test(function() {not_existing_variable.something();}, "TypeError", -2146823279);
+exception_test(function() {arr.toString = Function.prototype.toString; arr.toString();}, "TypeError", -2146823286);
 
 reportSuccess();




More information about the wine-cvs mailing list