From 40b7178ec81f36d2799c3f74af2f799e481f5070 Mon Sep 17 00:00:00 2001 From: "igor%mir2.org" Date: Thu, 11 Jul 2002 18:39:24 +0000 Subject: [PATCH] Fixing 136893: for(i in undefined), for(i in null) do not throw TypeError but treated as for(i in {}) --- js/rhino/src/org/mozilla/javascript/ScriptRuntime.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/rhino/src/org/mozilla/javascript/ScriptRuntime.java b/js/rhino/src/org/mozilla/javascript/ScriptRuntime.java index ed05f67643d..e4b61c70625 100644 --- a/js/rhino/src/org/mozilla/javascript/ScriptRuntime.java +++ b/js/rhino/src/org/mozilla/javascript/ScriptRuntime.java @@ -1145,6 +1145,10 @@ public class ScriptRuntime { } public static Object initEnum(Object value, Scriptable scope) { + if (value == null || value == Undefined.instance) { + // Empty enumeration + return new IdEnumeration(null); + } Scriptable m = toObject(scope, value); return new IdEnumeration(m); }