diff --git a/src/org/mozilla/javascript/ScriptableObject.java b/src/org/mozilla/javascript/ScriptableObject.java index bd23ccd1f6..e9be363686 100644 --- a/src/org/mozilla/javascript/ScriptableObject.java +++ b/src/org/mozilla/javascript/ScriptableObject.java @@ -2804,20 +2804,18 @@ private boolean putImpl(Object key, int index, Scriptable start, { // This method is very hot (basically called on each assignment) // so we inline the extensible/sealed checks below. - if (!isExtensible) { - Context cx = Context.getContext(); - if (cx.isStrictMode()) { - throw ScriptRuntime.typeError0("msg.not.extensible"); - } - } Slot slot; if (this != start) { slot = slotMap.query(key, index); + if(!isExtensible && Context.getContext().isStrictMode() && (slot == null || !(slot instanceof GetterSlot))) + throw ScriptRuntime.typeError0("msg.not.extensible"); if (slot == null) { return false; } } else if (!isExtensible) { slot = slotMap.query(key, index); + if(Context.getContext().isStrictMode() && (slot == null || !(slot instanceof GetterSlot))) + throw ScriptRuntime.typeError0("msg.not.extensible"); if (slot == null) { return true; }