Jacek Caban : jscript: for.. in is not error if in expression is not an object.

Alexandre Julliard julliard at winehq.org
Mon Sep 22 07:04:12 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Sep 21 15:40:04 2008 +0200

jscript: for..in is not error if in expression is not an object.

---

 dlls/jscript/engine.c      |    5 +++--
 dlls/jscript/tests/lang.js |    9 +++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 86ddbdd..5337b24 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -783,9 +783,10 @@ HRESULT forin_statement_eval(exec_ctx_t *ctx, statement_t *_stat, return_type_t
         return hres;
 
     if(V_VT(&val) != VT_DISPATCH) {
-        FIXME("in vt %d\n", V_VT(&val));
+        TRACE("in vt %d\n", V_VT(&val));
         VariantClear(&val);
-        return E_NOTIMPL;
+        V_VT(ret) = VT_EMPTY;
+        return S_OK;
     }
 
     hres = IDispatch_QueryInterface(V_DISPATCH(&val), &IID_IDispatchEx, (void**)&in_obj);
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index 5f13b05..2a6e04a 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -142,6 +142,15 @@ ok(obj2.pvar === 3, "obj2.pvar is not 3");
 var obj3 = new Object;
 ok(typeof(obj3) === "object", "typeof(obj3) is not object");
 
+for(var iter in "test")
+    ok(false, "unexpected forin call, test = " + iter);
+
+for(var iter in null)
+    ok(false, "unexpected forin call, test = " + iter);
+
+for(var iter in false)
+    ok(false, "unexpected forin call, test = " + iter);
+
 tmp = 0;
 if(true)
     tmp = 1;




More information about the wine-cvs mailing list