Jacek Caban : jscript: Throw TypeError in instanceof_expression_eval.
Alexandre Julliard
julliard at winehq.org
Mon Aug 16 12:25:05 CDT 2010
Module: wine
Branch: master
Commit: be3dc38183d235ad01141e6462cdd2850eb0a9c9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=be3dc38183d235ad01141e6462cdd2850eb0a9c9
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Aug 16 12:36:34 2010 +0200
jscript: Throw TypeError in instanceof_expression_eval.
---
dlls/jscript/engine.c | 6 ++----
dlls/jscript/jscript_En.rc | 1 +
dlls/jscript/resource.h | 1 +
dlls/jscript/tests/api.js | 3 +++
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index b40a88e..167b5d9 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -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) {
diff --git a/dlls/jscript/jscript_En.rc b/dlls/jscript/jscript_En.rc
index d98b0b6..b8c7ad1 100644
--- a/dlls/jscript/jscript_En.rc
+++ b/dlls/jscript/jscript_En.rc
@@ -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 ';'"
diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h
index b88621f..074bdcd 100644
--- a/dlls/jscript/resource.h
+++ b/dlls/jscript/resource.h
@@ -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
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index c57666d..9a253dc 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -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);
More information about the wine-cvs
mailing list