From 8462669d278b2cabe07648b3399c77834a3c485e Mon Sep 17 00:00:00 2001 From: Stijn Kliemesch Date: Fri, 8 Nov 2019 09:08:01 +0100 Subject: [PATCH 1/2] Fix for #616 Affects strict mode only. No longer prematurely throws a TypeError in ScriptableObject.putImpl(Object,int,Scriptable,Object) when instance member isExtensible is false. Instead, now it first queries the slotmap, so that if a GetterSlot instance is returned, any present setter may be called. All other outcomes of this method should be unaffected. --- src/org/mozilla/javascript/ScriptableObject.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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; } From 6bd5cf3446483e19f5059c8bda2eb620882ce5b5 Mon Sep 17 00:00:00 2001 From: Stijn Kliemesch Date: Tue, 12 Nov 2019 09:36:47 +0100 Subject: [PATCH 2/2] Removed exclusion for test262 tests that succeed since 8462669d278b2cabe07648b3399c77834a3c485e --- testsrc/test262.properties | 3 --- 1 file changed, 3 deletions(-) diff --git a/testsrc/test262.properties b/testsrc/test262.properties index c07c295d50..a54cfe3639 100644 --- a/testsrc/test262.properties +++ b/testsrc/test262.properties @@ -481,9 +481,6 @@ built-ins/Object ! entries/tamper-with-object-keys.js ! freeze/15.2.3.9-2-a-12.js ! freeze/15.2.3.9-2-a-8.js - ! freeze/15.2.3.9-2-c-2.js - ! freeze/15.2.3.9-2-c-3.js - ! freeze/15.2.3.9-2-c-4.js ! freeze/15.2.3.9-2-d-3.js ! freeze/frozen-object-contains-symbol-properties-non-strict.js ! getOwnPropertyDescriptor/15.2.3.3-3-14.js