Check for null and unwrap EcmaScript object to Java object in putProperty().

Especially the toJavaObject() may break something somewhere, not 100% sure,
but we should do this to avoid references from map values to the wrong
EcmaScript evaluator.
This commit is contained in:
hns 2002-09-25 15:17:33 +00:00
parent 8a598b3371
commit f3371c79f1

View file

@ -48,8 +48,10 @@ public class ESMapWrapper extends ESWrapper {
public void putProperty(String propertyName, ESValue propertyValue, int hash) throws EcmaScriptException {
if (data == null)
data = new HashMap ();
if (readonly==false)
data.put (propertyName, propertyValue);
if (propertyValue == ESNull.theNull)
deleteProperty(propertyName, hash);
else if (readonly==false)
data.put (propertyName, propertyValue.toJavaObject ());
else
throw new EcmaScriptException ("object is readonly");
}