8029003: setField in ScriptObject is incorrect for non extensible objects
Reviewed-by: lagergren, jlaskey
--- 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 {