8029003: setField in ScriptObject is incorrect for non extensible objects
authorsundar
Tue, 07 Jan 2014 18:14:18 +0530
changeset 22376 841a5e2ffd3b
parent 22375 1b3398bac257
child 22377 d0c9a671c1fe
8029003: setField in ScriptObject is incorrect for non extensible objects Reviewed-by: lagergren, jlaskey
nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Fri Jan 03 10:09:48 2014 +0530
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Tue Jan 07 18:14:18 2014 +0530
@@ -1888,7 +1888,9 @@
         final ScriptObject obj = (ScriptObject)self;
         final boolean isStrict = NashornCallSiteDescriptor.isStrict(desc);
         if (!obj.isExtensible()) {
-            throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(obj));
+            if (isStrict) {
+                throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(obj));
+            }
         } else if (obj.compareAndSetMap(oldMap, newMap)) {
             setter.invokeExact(self, value);
         } else {