From f2e8a75cbab86bd6246aa6fd002f214d66617588 Mon Sep 17 00:00:00 2001 From: Ronald Brill Date: Sun, 25 Aug 2024 15:32:35 +0200 Subject: [PATCH 1/4] base implementation of proxy and reflect support --- .../AbstractEcmaObjectOperations.java | 165 +- .../org/mozilla/javascript/Arguments.java | 13 +- .../javascript/IdScriptableObject.java | 8 +- .../org/mozilla/javascript/Interpreter.java | 4 +- .../mozilla/javascript/LambdaConstructor.java | 4 + .../org/mozilla/javascript/NativeArray.java | 6 +- .../org/mozilla/javascript/NativeObject.java | 22 +- .../org/mozilla/javascript/NativeProxy.java | 1322 ++++++++++++++++ .../org/mozilla/javascript/NativeReflect.java | 419 +++++ .../org/mozilla/javascript/ScriptRuntime.java | 9 +- .../mozilla/javascript/ScriptableObject.java | 23 +- .../javascript/tests/Test262SuiteTest.java | 5 - .../javascript/tests/es6/NativeProxyTest.java | 918 +++++++++++ .../tests/es6/NativeReflectTest.java | 501 ++++++ tests/testsrc/test262.properties | 1393 +++++++++-------- 15 files changed, 4085 insertions(+), 727 deletions(-) create mode 100644 rhino/src/main/java/org/mozilla/javascript/NativeProxy.java create mode 100644 rhino/src/main/java/org/mozilla/javascript/NativeReflect.java create mode 100644 tests/src/test/java/org/mozilla/javascript/tests/es6/NativeProxyTest.java create mode 100644 tests/src/test/java/org/mozilla/javascript/tests/es6/NativeReflectTest.java diff --git a/rhino/src/main/java/org/mozilla/javascript/AbstractEcmaObjectOperations.java b/rhino/src/main/java/org/mozilla/javascript/AbstractEcmaObjectOperations.java index 26633b6428..c6a8643666 100644 --- a/rhino/src/main/java/org/mozilla/javascript/AbstractEcmaObjectOperations.java +++ b/rhino/src/main/java/org/mozilla/javascript/AbstractEcmaObjectOperations.java @@ -1,9 +1,12 @@ package org.mozilla.javascript; import java.util.ArrayList; +import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.function.Predicate; /** * Abstract Object Operations as defined by EcmaScript @@ -134,8 +137,9 @@ static boolean setIntegrityLevel(Context cx, Object o, INTEGRITY_LEVEL level) { */ ScriptableObject obj = ScriptableObject.ensureScriptableObject(o); - // TODO check .preventExtensions() return value once implemented and act accordingly to spec - obj.preventExtensions(); + if (!obj.preventExtensions()) { + return false; + } for (Object key : obj.getIds(true, true)) { ScriptableObject desc = obj.getOwnPropertyDescriptor(cx, key); @@ -303,4 +307,161 @@ static Map> groupBy( return groups; } + + /** + * CreateListFromArrayLike ( obj [ , elementTypes ] ) + * + *

https://262.ecma-international.org/12.0/#sec-createlistfromarraylike + */ + static List createListFromArrayLike( + Context cx, Scriptable o, Predicate elementTypesPredicate, String msg) { + ScriptableObject obj = ScriptableObject.ensureScriptableObject(o); + if (obj instanceof NativeArray) { + Object[] arr = ((NativeArray) obj).toArray(); + for (Object next : arr) { + if (!elementTypesPredicate.test(next)) { + throw ScriptRuntime.typeError(msg); + } + } + return Arrays.asList(arr); + } + + long len = lengthOfArrayLike(cx, obj); + List list = new ArrayList<>(); + long index = 0; + while (index < len) { + // String indexName = ScriptRuntime.toString(index); + Object next = ScriptableObject.getProperty(obj, (int) index); + if (!elementTypesPredicate.test(next)) { + throw ScriptRuntime.typeError(msg); + } + list.add(next); + index++; + } + return list; + } + + /** + * LengthOfArrayLike ( obj ) + * + *

https://262.ecma-international.org/12.0/#sec-lengthofarraylike + */ + static long lengthOfArrayLike(Context cx, Scriptable o) { + Object value = ScriptableObject.getProperty(o, "length"); + long len = ScriptRuntime.toLength(new Object[] {value}, 0); + return len; + } + + /** + * IsCompatiblePropertyDescriptor ( Extensible, Desc, Current ) + * + *

https://262.ecma-international.org/12.0/#sec-iscompatiblepropertydescriptor + */ + static boolean isCompatiblePropertyDescriptor( + boolean extensible, ScriptableObject desc, ScriptableObject current) { + return validateAndApplyPropertyDescriptor( + Undefined.SCRIPTABLE_UNDEFINED, + Undefined.SCRIPTABLE_UNDEFINED, + extensible, + desc, + current); + } + + /** + * ValidateAndApplyPropertyDescriptor ( O, P, extensible, Desc, current ) + * + *

https://262.ecma-international.org/12.0/#sec-validateandapplypropertydescriptor + */ + static boolean validateAndApplyPropertyDescriptor( + Scriptable o, + Scriptable p, + boolean extensible, + ScriptableObject desc, + ScriptableObject current) { + if (Undefined.isUndefined(current)) { + if (!extensible) { + return false; + } + + if (ScriptableObject.isGenericDescriptor(desc) + || ScriptableObject.isDataDescriptor(desc)) { + /* + i. i. If O is not undefined, create an own data property named P of object O whose [[Value]], [[Writable]], [[Enumerable]], and [[Configurable]] attribute values are described by Desc. + If the value of an attribute field of Desc is absent, the attribute of the newly created property is set to its default value. + */ + } else { + /* + ii. ii. If O is not undefined, create an own accessor property named P of object O whose [[Get]], [[Set]], [[Enumerable]], and [[Configurable]] attribute values are described by Desc. If the value of an attribute field of Desc is absent, the attribute of the newly created property is set to its default value. + */ + } + return true; + } + + if (desc.getIds().length == 0) { + return true; + } + + if (Boolean.FALSE.equals(current.get("configurable"))) { + if (Boolean.TRUE.equals(ScriptableObject.hasProperty(desc, "configurable")) + && Boolean.TRUE.equals(desc.get("configurable"))) { + return false; + } + + if (Boolean.TRUE.equals(ScriptableObject.hasProperty(desc, "enumerable")) + && !Objects.equals(desc.get("enumerable"), current.get("enumerable"))) { + return false; + } + } + + // if (!ScriptableObject.isGenericDescriptor(desc)) { + if (ScriptableObject.isGenericDescriptor(desc)) { + return true; + } else if (!Objects.equals( + ScriptableObject.isGenericDescriptor(current), + ScriptableObject.isGenericDescriptor(desc))) { + if (Boolean.FALSE.equals(current.get("configurable"))) { + return false; + } + if (ScriptableObject.isDataDescriptor(current)) { + if (Boolean.FALSE.equals(current.get("configurable"))) { + // i. i. If O is not undefined, convert the property named P of object O from a + // data property to an accessor property. Preserve the existing values of the + // converted property's [[Configurable]] and [[Enumerable]] attributes and set + // the rest of the property's attributes to their default values. + } else { + // i. i. If O is not undefined, convert the property named P of object O from an + // accessor property to a data property. Preserve the existing values of the + // converted property's [[Configurable]] and [[Enumerable]] attributes and set + // the rest of the property's attributes to their default values. + } + } + } else if (ScriptableObject.isDataDescriptor(current) + && ScriptableObject.isDataDescriptor(desc)) { + if (Boolean.FALSE.equals(current.get("configurable")) + && Boolean.FALSE.equals(current.get("writable"))) { + if (Boolean.TRUE.equals(ScriptableObject.hasProperty(desc, "writable")) + && Boolean.TRUE.equals(desc.get("writable"))) { + return false; + } + if (Boolean.TRUE.equals(ScriptableObject.hasProperty(desc, "value")) + && !Objects.equals(desc.get("value"), current.get("value"))) { + return false; + } + return true; + } + } else { + if (Boolean.FALSE.equals(current.get("configurable"))) { + if (Boolean.TRUE.equals(ScriptableObject.hasProperty(desc, "set")) + && !Objects.equals(desc.get("set"), current.get("set"))) { + return false; + } + if (Boolean.TRUE.equals(ScriptableObject.hasProperty(desc, "get")) + && !Objects.equals(desc.get("get"), current.get("get"))) { + return false; + } + return true; + } + } + return true; + } } diff --git a/rhino/src/main/java/org/mozilla/javascript/Arguments.java b/rhino/src/main/java/org/mozilla/javascript/Arguments.java index 7674b6f187..729e3953e4 100644 --- a/rhino/src/main/java/org/mozilla/javascript/Arguments.java +++ b/rhino/src/main/java/org/mozilla/javascript/Arguments.java @@ -353,33 +353,34 @@ protected ScriptableObject getOwnPropertyDescriptor(Context cx, Object id) { } @Override - protected void defineOwnProperty( + protected boolean defineOwnProperty( Context cx, Object id, ScriptableObject desc, boolean checkValid) { super.defineOwnProperty(cx, id, desc, checkValid); if (ScriptRuntime.isSymbol(id)) { - return; + return true; } double d = ScriptRuntime.toNumber(id); int index = (int) d; - if (d != index) return; + if (d != index) return true; Object value = arg(index); - if (value == NOT_FOUND) return; + if (value == NOT_FOUND) return true; if (isAccessorDescriptor(desc)) { removeArg(index); - return; + return true; } Object newValue = getProperty(desc, "value"); - if (newValue == NOT_FOUND) return; + if (newValue == NOT_FOUND) return true; replaceArg(index, newValue); if (isFalse(getProperty(desc, "writable"))) { removeArg(index); } + return true; } // ECMAScript2015 diff --git a/rhino/src/main/java/org/mozilla/javascript/IdScriptableObject.java b/rhino/src/main/java/org/mozilla/javascript/IdScriptableObject.java index d617123811..cf908ccb17 100644 --- a/rhino/src/main/java/org/mozilla/javascript/IdScriptableObject.java +++ b/rhino/src/main/java/org/mozilla/javascript/IdScriptableObject.java @@ -852,7 +852,7 @@ private IdFunctionObject newIdFunction( } @Override - protected void defineOwnProperty( + protected boolean defineOwnProperty( Context cx, Object key, ScriptableObject desc, boolean checkValid) { if (key instanceof CharSequence) { String name = key.toString(); @@ -875,7 +875,7 @@ protected void defineOwnProperty( } attr = applyDescriptorToAttributeBitset(attr, desc); setAttributes(name, attr); - return; + return true; } } if (prototypeValues != null) { @@ -905,12 +905,12 @@ protected void defineOwnProperty( super.delete(name); } - return; + return true; } } } } - super.defineOwnProperty(cx, key, desc, checkValid); + return super.defineOwnProperty(cx, key, desc, checkValid); } @Override diff --git a/rhino/src/main/java/org/mozilla/javascript/Interpreter.java b/rhino/src/main/java/org/mozilla/javascript/Interpreter.java index 7e0f6f74c0..d5ffc5be54 100644 --- a/rhino/src/main/java/org/mozilla/javascript/Interpreter.java +++ b/rhino/src/main/java/org/mozilla/javascript/Interpreter.java @@ -2030,12 +2030,12 @@ private static Object interpretLoop(Context cx, CallFrame frame, Object throwabl continue StateLoop; } } - if (!(lhs instanceof Function)) { + if (!(lhs instanceof Constructable)) { if (lhs == DBL_MRK) lhs = ScriptRuntime.wrapNumber(sDbl[stackTop]); throw ScriptRuntime.notFunctionError(lhs); } - Function fun = (Function) lhs; + Constructable fun = (Constructable) lhs; if (fun instanceof IdFunctionObject) { IdFunctionObject ifun = (IdFunctionObject) fun; diff --git a/rhino/src/main/java/org/mozilla/javascript/LambdaConstructor.java b/rhino/src/main/java/org/mozilla/javascript/LambdaConstructor.java index d0a8c0e86e..17ed9eca61 100644 --- a/rhino/src/main/java/org/mozilla/javascript/LambdaConstructor.java +++ b/rhino/src/main/java/org/mozilla/javascript/LambdaConstructor.java @@ -66,6 +66,10 @@ public LambdaConstructor( this.flags = flags; } + protected Constructable getTargetConstructor() { + return targetConstructor; + } + @Override public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if ((flags & CONSTRUCTOR_FUNCTION) == 0) { diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeArray.java b/rhino/src/main/java/org/mozilla/javascript/NativeArray.java index d0276715d7..367ef65b7c 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeArray.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeArray.java @@ -846,7 +846,7 @@ protected ScriptableObject getOwnPropertyDescriptor(Context cx, Object id) { } @Override - protected void defineOwnProperty( + protected boolean defineOwnProperty( Context cx, Object id, ScriptableObject desc, boolean checkValid) { long index = toArrayIndex(id); if (index >= length) { @@ -877,6 +877,7 @@ protected void defineOwnProperty( lengthAttr = getAttributes("length"); // Update cached attributes value for length property } + return true; } /** See ECMA 15.4.1,2 */ @@ -2198,6 +2199,9 @@ private static boolean js_isArray(Object o) { if (!(o instanceof Scriptable)) { return false; } + if (o instanceof NativeProxy) { + return js_isArray(((NativeProxy) o).getTargetThrowIfRevoked()); + } return "Array".equals(((Scriptable) o).getClassName()); } diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeObject.java b/rhino/src/main/java/org/mozilla/javascript/NativeObject.java index ce316bbe22..ddacca6ffc 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeObject.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeObject.java @@ -568,7 +568,10 @@ public Object execIdCall( } ScriptableObject obj = ensureScriptableObject(arg); - obj.preventExtensions(); + boolean status = obj.preventExtensions(); + if (!status) { + throw ScriptRuntime.typeError("Object.preventExtensions is not allowed"); + } return obj; } case ConstructorId_defineProperties: @@ -626,9 +629,12 @@ public Object execIdCall( return arg; } - AbstractEcmaObjectOperations.setIntegrityLevel( - cx, arg, AbstractEcmaObjectOperations.INTEGRITY_LEVEL.SEALED); - + boolean status = + AbstractEcmaObjectOperations.setIntegrityLevel( + cx, arg, AbstractEcmaObjectOperations.INTEGRITY_LEVEL.SEALED); + if (!status) { + throw ScriptRuntime.typeError("Object is not sealable"); + } return arg; } case ConstructorId_freeze: @@ -639,8 +645,12 @@ public Object execIdCall( return arg; } - AbstractEcmaObjectOperations.setIntegrityLevel( - cx, arg, AbstractEcmaObjectOperations.INTEGRITY_LEVEL.FROZEN); + boolean status = + AbstractEcmaObjectOperations.setIntegrityLevel( + cx, arg, AbstractEcmaObjectOperations.INTEGRITY_LEVEL.SEALED); + if (!status) { + throw ScriptRuntime.typeError("Object is not sealable"); + } return arg; } diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeProxy.java b/rhino/src/main/java/org/mozilla/javascript/NativeProxy.java new file mode 100644 index 0000000000..ea58df67b1 --- /dev/null +++ b/rhino/src/main/java/org/mozilla/javascript/NativeProxy.java @@ -0,0 +1,1322 @@ +/* -*- Mode: java; tab-width: 4; indent-tabs-mode: 1; c-basic-offset: 4 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.mozilla.javascript; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; + +/** + * This class implements the Proxy object. + * + * @author Ronald Brill + */ +final class NativeProxy extends ScriptableObject implements Callable, Constructable { + private static final long serialVersionUID = 6676871870513494844L; + + private static final String PROXY_TAG = "Proxy"; + + private static final String TRAP_GET_PROTOTYPE_OF = "getPrototypeOf"; + private static final String TRAP_SET_PROTOTYPE_OF = "setPrototypeOf"; + private static final String TRAP_IS_EXTENSIBLE = "isExtensible"; + private static final String TRAP_PREVENT_EXTENSIONS = "preventExtensions"; + private static final String TRAP_GET_OWN_PROPERTY_DESCRIPTOR = "getOwnPropertyDescriptor"; + private static final String TRAP_DEFINE_PROPERTY = "defineProperty"; + private static final String TRAP_HAS = "has"; + private static final String TRAP_GET = "get"; + private static final String TRAP_SET = "set"; + private static final String TRAP_DELETE_PROPERTY = "deleteProperty"; + private static final String TRAP_OWN_KEYS = "ownKeys"; + private static final String TRAP_APPLY = "apply"; + private static final String TRAP_CONSTRUCT = "construct"; + + private ScriptableObject targetObj; + private Scriptable handlerObj; + private final String typeOf; + + private static final class Revoker implements Callable { + private NativeProxy revocableProxy = null; + + public Revoker(NativeProxy proxy) { + revocableProxy = proxy; + } + + @Override + public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + if (revocableProxy != null) { + revocableProxy.handlerObj = null; + revocableProxy.targetObj = null; + revocableProxy = null; + } + return Undefined.instance; + } + } + + public static void init(Context cx, Scriptable scope, boolean sealed) { + LambdaConstructor constructor = + new LambdaConstructor( + scope, + PROXY_TAG, + 2, + LambdaConstructor.CONSTRUCTOR_NEW, + NativeProxy::constructor) { + + @Override + public Scriptable construct(Context cx, Scriptable scope, Object[] args) { + NativeProxy obj = + (NativeProxy) getTargetConstructor().construct(cx, scope, args); + // avoid getting trapped + obj.setPrototypeDirect(getClassPrototype()); + obj.setParentScope(scope); + return obj; + } + }; + constructor.setPrototypeProperty(null); + + constructor.defineConstructorMethod( + scope, "revocable", 2, NativeProxy::revocable, DONTENUM, DONTENUM | READONLY); + + ScriptableObject.defineProperty(scope, PROXY_TAG, constructor, DONTENUM); + if (sealed) { + constructor.sealObject(); + } + } + + private NativeProxy(ScriptableObject target, Scriptable handler) { + this.targetObj = target; + this.handlerObj = handler; + + if (target == null || !(target instanceof Callable)) { + typeOf = super.getTypeOf(); + } else { + typeOf = target.getTypeOf(); + } + } + + @Override + public String getClassName() { + ScriptableObject target = getTargetThrowIfRevoked(); + return target.getClassName(); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-construct-argumentslist-newtarget + */ + @Override + public Scriptable construct(Context cx, Scriptable scope, Object[] args) { + /* + * 1. Let handler be O.[[ProxyHandler]]. + * 2. If handler is null, throw a TypeError exception. + * 3. Assert: Type(handler) is Object. + * 4. Let target be O.[[ProxyTarget]]. + * 5. Assert: IsConstructor(target) is true. + * 6. Let trap be ? GetMethod(handler, "construct"). + * 7. If trap is undefined, then + * a. Return ? Construct(target, argumentsList, newTarget). + * 8. Let argArray be ! CreateArrayFromList(argumentsList). + * 9. Let newObj be ? Call(trap, handler, « target, argArray, newTarget »). + * 10. If Type(newObj) is not Object, throw a TypeError exception. + * 11. Return newObj. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_CONSTRUCT); + if (trap != null) { + Object result = callTrap(trap, new Object[] {target, args, this}); + if (!(result instanceof Scriptable) || ScriptRuntime.isSymbol(result)) { + throw ScriptRuntime.typeError("Constructor trap has to return a scriptable."); + } + return (ScriptableObject) result; + } + + return ((Constructable) target).construct(cx, scope, args); + } + + /** + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p + */ + @Override + public boolean has(String name, Scriptable start) { + /* + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "has"). + * 7. If trap is undefined, then + * a. Return ? target.[[HasProperty]](P). + * 8. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target, P »)). + * 9. If booleanTrapResult is false, then + * a. Let targetDesc be ? target.[[GetOwnProperty]](P). + * b. If targetDesc is not undefined, then + * i. If targetDesc.[[Configurable]] is false, throw a TypeError exception. + * ii. Let extensibleTarget be ? IsExtensible(target). + * iii. If extensibleTarget is false, throw a TypeError exception. + * 10. Return booleanTrapResult. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_HAS); + if (trap != null) { + + boolean booleanTrapResult = + ScriptRuntime.toBoolean(callTrap(trap, new Object[] {target, name})); + if (!booleanTrapResult) { + ScriptableObject targetDesc = + target.getOwnPropertyDescriptor(Context.getContext(), name); + if (targetDesc != null) { + if (Boolean.FALSE.equals(targetDesc.get("configurable")) + || !target.isExtensible()) { + throw ScriptRuntime.typeError( + "proxy can't report an existing own property '" + + name + + "' as non-existent on a non-extensible object"); + } + } + } + return booleanTrapResult; + } + + return ScriptableObject.hasProperty(target, name); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p + */ + @Override + public boolean has(int index, Scriptable start) { + /* + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "has"). + * 7. If trap is undefined, then + * a. Return ? target.[[HasProperty]](P). + * 8. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target, P »)). + * 9. If booleanTrapResult is false, then + * a. Let targetDesc be ? target.[[GetOwnProperty]](P). + * b. If targetDesc is not undefined, then + * i. If targetDesc.[[Configurable]] is false, throw a TypeError exception. + * ii. Let extensibleTarget be ? IsExtensible(target). + * iii. If extensibleTarget is false, throw a TypeError exception. + * 10. Return booleanTrapResult. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_HAS); + if (trap != null) { + boolean booleanTrapResult = + ScriptRuntime.toBoolean( + callTrap(trap, new Object[] {target, ScriptRuntime.toString(index)})); + if (!booleanTrapResult) { + ScriptableObject targetDesc = + target.getOwnPropertyDescriptor(Context.getContext(), index); + if (targetDesc != null) { + if (Boolean.FALSE.equals(targetDesc.get("configurable")) + || !target.isExtensible()) { + throw ScriptRuntime.typeError( + "proxy can't check an existing property ' + name + ' existance on an not configurable or not extensible object"); + } + } + } + + return booleanTrapResult; + } + + return ScriptableObject.hasProperty(target, index); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p + */ + @Override + public boolean has(Symbol key, Scriptable start) { + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_HAS); + if (trap != null) { + boolean booleanTrapResult = + ScriptRuntime.toBoolean(callTrap(trap, new Object[] {target, key})); + if (!booleanTrapResult) { + ScriptableObject targetDesc = + target.getOwnPropertyDescriptor(Context.getContext(), key); + if (targetDesc != null) { + if (Boolean.FALSE.equals(targetDesc.get("configurable")) + || !target.isExtensible()) { + throw ScriptRuntime.typeError( + "proxy can't check an existing property ' + name + ' existance on an not configurable or not extensible object"); + } + } + } + + return booleanTrapResult; + } + + return ScriptableObject.hasProperty(target, key); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys + */ + @Override + Object[] getIds(boolean getNonEnumerable, boolean getSymbols) { + /* + * 1. Let handler be O.[[ProxyHandler]]. + * 2. If handler is null, throw a TypeError exception. + * 3. Assert: Type(handler) is Object. + * 4. Let target be O.[[ProxyTarget]]. + * 5. Let trap be ? GetMethod(handler, "ownKeys"). + * 6. If trap is undefined, then + * a. Return ? target.[[OwnPropertyKeys]](). + * 7. Let trapResultArray be ? Call(trap, handler, « target »). + * 8. Let trapResult be ? CreateListFromArrayLike(trapResultArray, « String, Symbol »). + * 9. If trapResult contains any duplicate entries, throw a TypeError exception. + * 10. Let extensibleTarget be ? IsExtensible(target). + * 11. Let targetKeys be ? target.[[OwnPropertyKeys]](). + * 12. Assert: targetKeys is a List whose elements are only String and Symbol values. + * 13. Assert: targetKeys contains no duplicate entries. + * 14. Let targetConfigurableKeys be a new empty List. + * 15. Let targetNonconfigurableKeys be a new empty List. + * 16. For each element key of targetKeys, do + * a. Let desc be ? target.[[GetOwnProperty]](key). + * b. If desc is not undefined and desc.[[Configurable]] is false, then + * i. i. Append key as an element of targetNonconfigurableKeys. + * c. Else, + i. i. Append key as an element of targetConfigurableKeys. + * 17. If extensibleTarget is true and targetNonconfigurableKeys is empty, then + * a. Return trapResult. + * 18. Let uncheckedResultKeys be a List whose elements are the elements of trapResult. + * 19. For each element key of targetNonconfigurableKeys, do + * a. a. If key is not an element of uncheckedResultKeys, throw a TypeError exception. + * b. Remove key from uncheckedResultKeys. + * 20. If extensibleTarget is true, return trapResult. + * 21. For each element key of targetConfigurableKeys, do + * a. a. If key is not an element of uncheckedResultKeys, throw a TypeError exception. + * b. Remove key from uncheckedResultKeys. + * 22. If uncheckedResultKeys is not empty, throw a TypeError exception. + * 23. Return trapResult. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_OWN_KEYS); + if (trap != null) { + Object res = callTrap(trap, new Object[] {target}); + if (!(res instanceof Scriptable)) { + throw ScriptRuntime.typeError("ownKeys trap must be an object"); + } + if (!ScriptRuntime.isArrayLike((Scriptable) res)) { + throw ScriptRuntime.typeError("ownKeys trap must be an array like object"); + } + + Context cx = Context.getContext(); + + List trapResult = + AbstractEcmaObjectOperations.createListFromArrayLike( + cx, + (Scriptable) res, + (o) -> + o instanceof CharSequence + || o instanceof NativeString + || ScriptRuntime.isSymbol(o), + "proxy [[OwnPropertyKeys]] must return an array with only string and symbol elements"); + + boolean extensibleTarget = target.isExtensible(); + Object[] targetKeys = target.getIds(getNonEnumerable, getSymbols); + + HashSet uncheckedResultKeys = new HashSet(trapResult); + if (uncheckedResultKeys.size() != trapResult.size()) { + throw ScriptRuntime.typeError("ownKeys trap result must not contain duplicates"); + } + + ArrayList targetConfigurableKeys = new ArrayList<>(); + ArrayList targetNonconfigurableKeys = new ArrayList<>(); + for (Object targetKey : targetKeys) { + ScriptableObject desc = target.getOwnPropertyDescriptor(cx, targetKey); + if (desc != null && Boolean.FALSE.equals(desc.get("configurable"))) { + targetNonconfigurableKeys.add(targetKey); + } else { + targetConfigurableKeys.add(targetKey); + } + } + + if (extensibleTarget && targetNonconfigurableKeys.size() == 0) { + return trapResult.toArray(); + } + + for (Object key : targetNonconfigurableKeys) { + if (!uncheckedResultKeys.contains(key)) { + throw ScriptRuntime.typeError( + "proxy can't skip a non-configurable property " + key); + } + uncheckedResultKeys.remove(key); + } + if (extensibleTarget) { + return trapResult.toArray(); + } + + for (Object key : targetConfigurableKeys) { + if (!uncheckedResultKeys.contains(key)) { + throw ScriptRuntime.typeError( + "proxy can't skip a configurable property " + key); + } + uncheckedResultKeys.remove(key); + } + + if (uncheckedResultKeys.size() > 0) { + throw ScriptRuntime.typeError("proxy can't skip properties"); + } + + return trapResult.toArray(); + } + + return target.getIds(getNonEnumerable, getSymbols); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver + */ + @Override + public Object get(String name, Scriptable start) { + /* + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "get"). + * 7. If trap is undefined, then + * a. Return ? target.[[Get]](P, Receiver). + * 8. Let trapResult be ? Call(trap, handler, « target, P, Receiver »). + * 9. Let targetDesc be ? target.[[GetOwnProperty]](P). + * 10. If targetDesc is not undefined and targetDesc.[[Configurable]] is false, then + * a. If IsDataDescriptor(targetDesc) is true and targetDesc.[[Writable]] is false, then + * i. If SameValue(trapResult, targetDesc.[[Value]]) is false, throw a TypeError exception. + * b. If IsAccessorDescriptor(targetDesc) is true and targetDesc.[[Get]] is undefined, then + * i. If trapResult is not undefined, throw a TypeError exception. + * 11. Return trapResult. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_GET); + if (trap != null) { + Object trapResult = callTrap(trap, new Object[] {target, name, this}); + + ScriptableObject targetDesc = + target.getOwnPropertyDescriptor(Context.getContext(), name); + if (targetDesc != null + && !Undefined.isUndefined(targetDesc) + && Boolean.FALSE.equals(targetDesc.get("configurable"))) { + if (ScriptableObject.isDataDescriptor(targetDesc) + && Boolean.FALSE.equals(targetDesc.get("writable"))) { + if (!Objects.equals(trapResult, targetDesc.get("value"))) { + throw ScriptRuntime.typeError( + "proxy get has to return the same value as the plain call"); + } + } + if (ScriptableObject.isAccessorDescriptor(targetDesc) + && Undefined.isUndefined(targetDesc.get("get"))) { + if (!Undefined.isUndefined(trapResult)) { + throw ScriptRuntime.typeError( + "proxy get has to return the same value as the plain call"); + } + } + } + return trapResult; + } + + return ScriptRuntime.getObjectProp(target, name, Context.getContext()); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver + */ + @Override + public Object get(int index, Scriptable start) { + /* + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "get"). + * 7. If trap is undefined, then + * a. Return ? target.[[Get]](P, Receiver). + * 8. Let trapResult be ? Call(trap, handler, « target, P, Receiver »). + * 9. Let targetDesc be ? target.[[GetOwnProperty]](P). + * 10. If targetDesc is not undefined and targetDesc.[[Configurable]] is false, then + * a. If IsDataDescriptor(targetDesc) is true and targetDesc.[[Writable]] is false, then + * i. If SameValue(trapResult, targetDesc.[[Value]]) is false, throw a TypeError exception. + * b. If IsAccessorDescriptor(targetDesc) is true and targetDesc.[[Get]] is undefined, then + * i. If trapResult is not undefined, throw a TypeError exception. + * 11. Return trapResult. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_GET); + if (trap != null) { + Object trapResult = + callTrap(trap, new Object[] {target, ScriptRuntime.toString(index), this}); + + ScriptableObject targetDesc = + target.getOwnPropertyDescriptor(Context.getContext(), index); + if (targetDesc != null + && !Undefined.isUndefined(targetDesc) + && Boolean.FALSE.equals(targetDesc.get("configurable"))) { + if (ScriptableObject.isDataDescriptor(targetDesc) + && Boolean.FALSE.equals(targetDesc.get("writable"))) { + if (!Objects.equals(trapResult, targetDesc.get("value"))) { + throw ScriptRuntime.typeError( + "proxy get has to return the same value as the plain call"); + } + } + if (ScriptableObject.isAccessorDescriptor(targetDesc) + && Undefined.isUndefined(targetDesc.get("get"))) { + if (!Undefined.isUndefined(trapResult)) { + throw ScriptRuntime.typeError( + "proxy get has to return the same value as the plain call"); + } + } + } + return trapResult; + } + + return ScriptRuntime.getObjectIndex(target, index, Context.getContext()); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver + */ + @Override + public Object get(Symbol key, Scriptable start) { + /* + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "get"). + * 7. If trap is undefined, then + * a. Return ? target.[[Get]](P, Receiver). + * 8. Let trapResult be ? Call(trap, handler, « target, P, Receiver »). + * 9. Let targetDesc be ? target.[[GetOwnProperty]](P). + * 10. If targetDesc is not undefined and targetDesc.[[Configurable]] is false, then + * a. If IsDataDescriptor(targetDesc) is true and targetDesc.[[Writable]] is false, then + * i. If SameValue(trapResult, targetDesc.[[Value]]) is false, throw a TypeError exception. + * b. If IsAccessorDescriptor(targetDesc) is true and targetDesc.[[Get]] is undefined, then + * i. If trapResult is not undefined, throw a TypeError exception. + * 11. Return trapResult. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_GET); + if (trap != null) { + Object trapResult = callTrap(trap, new Object[] {target, key, this}); + + ScriptableObject targetDesc = + target.getOwnPropertyDescriptor(Context.getContext(), key); + if (targetDesc != null + && !Undefined.isUndefined(targetDesc) + && Boolean.FALSE.equals(targetDesc.get("configurable"))) { + if (ScriptableObject.isDataDescriptor(targetDesc) + && Boolean.FALSE.equals(targetDesc.get("writable"))) { + if (!Objects.equals(trapResult, targetDesc.get("value"))) { + throw ScriptRuntime.typeError( + "proxy get has to return the same value as the plain call"); + } + } + if (ScriptableObject.isAccessorDescriptor(targetDesc) + && Undefined.isUndefined(targetDesc.get("get"))) { + if (!Undefined.isUndefined(trapResult)) { + throw ScriptRuntime.typeError( + "proxy get has to return the same value as the plain call"); + } + } + } + return trapResult; + } + + if (start == this) { + start = target; + } + SymbolScriptable symbolScriptableTarget = ensureSymbolScriptable(target); + return symbolScriptableTarget.get(key, start); + } + + /** + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver + */ + @Override + public void put(String name, Scriptable start, Object value) { + /* + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "set"). + * 7. If trap is undefined, then + * a. Return ? target.[[Set]](P, V, Receiver). + * 8. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target, P, V, Receiver »)). + * 9. If booleanTrapResult is false, return false. + * 10. Let targetDesc be ? target.[[GetOwnProperty]](P). + * 11. If targetDesc is not undefined and targetDesc.[[Configurable]] is false, then + * a. If IsDataDescriptor(targetDesc) is true and targetDesc.[[Writable]] is false, then + * i. If SameValue(V, targetDesc.[[Value]]) is false, throw a TypeError exception. + * b. If IsAccessorDescriptor(targetDesc) is true, then + * i. If targetDesc.[[Set]] is undefined, throw a TypeError exception. + * 12. Return true. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_SET); + if (trap != null) { + boolean booleanTrapResult = + ScriptRuntime.toBoolean(callTrap(trap, new Object[] {target, name, value})); + if (!booleanTrapResult) { + return; // false + } + + ScriptableObject targetDesc = + target.getOwnPropertyDescriptor(Context.getContext(), name); + if (targetDesc != null + && !Undefined.isUndefined(targetDesc) + && Boolean.FALSE.equals(targetDesc.get("configurable"))) { + if (ScriptableObject.isDataDescriptor(targetDesc) + && Boolean.FALSE.equals(targetDesc.get("writable"))) { + if (!Objects.equals(value, targetDesc.get("value"))) { + throw ScriptRuntime.typeError( + "proxy set has to use the same value as the plain call"); + } + } + if (ScriptableObject.isAccessorDescriptor(targetDesc) + && Undefined.isUndefined(targetDesc.get("set"))) { + throw ScriptRuntime.typeError("proxy set has to be available"); + } + } + return; // true + } + + ScriptableObject.putProperty(target, name, value); + } + + /** + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver + */ + @Override + public void put(int index, Scriptable start, Object value) { + /* + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "set"). + * 7. If trap is undefined, then + * a. Return ? target.[[Set]](P, V, Receiver). + * 8. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target, P, V, Receiver »)). + * 9. If booleanTrapResult is false, return false. + * 10. Let targetDesc be ? target.[[GetOwnProperty]](P). + * 11. If targetDesc is not undefined and targetDesc.[[Configurable]] is false, then + * a. If IsDataDescriptor(targetDesc) is true and targetDesc.[[Writable]] is false, then + * i. If SameValue(V, targetDesc.[[Value]]) is false, throw a TypeError exception. + * b. If IsAccessorDescriptor(targetDesc) is true, then + * i. If targetDesc.[[Set]] is undefined, throw a TypeError exception. + * 12. Return true. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_SET); + if (trap != null) { + boolean booleanTrapResult = + ScriptRuntime.toBoolean( + callTrap( + trap, + new Object[] {target, ScriptRuntime.toString(index), value})); + if (!booleanTrapResult) { + return; // false + } + + ScriptableObject targetDesc = + target.getOwnPropertyDescriptor(Context.getContext(), index); + if (targetDesc != null + && !Undefined.isUndefined(targetDesc) + && Boolean.FALSE.equals(targetDesc.get("configurable"))) { + if (ScriptableObject.isDataDescriptor(targetDesc) + && Boolean.FALSE.equals(targetDesc.get("writable"))) { + if (!Objects.equals(value, targetDesc.get("value"))) { + throw ScriptRuntime.typeError( + "proxy set has to use the same value as the plain call"); + } + } + if (ScriptableObject.isAccessorDescriptor(targetDesc) + && Undefined.isUndefined(targetDesc.get("set"))) { + throw ScriptRuntime.typeError("proxy set has to be available"); + } + } + return; // true + } + + ScriptableObject.putProperty(target, index, value); + } + + /** + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver + */ + @Override + public void put(Symbol key, Scriptable start, Object value) { + /* + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "set"). + * 7. If trap is undefined, then + * a. Return ? target.[[Set]](P, V, Receiver). + * 8. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target, P, V, Receiver »)). + * 9. If booleanTrapResult is false, return false. + * 10. Let targetDesc be ? target.[[GetOwnProperty]](P). + * 11. If targetDesc is not undefined and targetDesc.[[Configurable]] is false, then + * a. If IsDataDescriptor(targetDesc) is true and targetDesc.[[Writable]] is false, then + * i. If SameValue(V, targetDesc.[[Value]]) is false, throw a TypeError exception. + * b. If IsAccessorDescriptor(targetDesc) is true, then + * i. If targetDesc.[[Set]] is undefined, throw a TypeError exception. + * 12. Return true. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_SET); + if (trap != null) { + boolean booleanTrapResult = + ScriptRuntime.toBoolean(callTrap(trap, new Object[] {target, key, value})); + if (!booleanTrapResult) { + return; // false + } + + ScriptableObject targetDesc = + target.getOwnPropertyDescriptor(Context.getContext(), key); + if (targetDesc != null + && !Undefined.isUndefined(targetDesc) + && Boolean.FALSE.equals(targetDesc.get("configurable"))) { + if (ScriptableObject.isDataDescriptor(targetDesc) + && Boolean.FALSE.equals(targetDesc.get("writable"))) { + if (!Objects.equals(value, targetDesc.get("value"))) { + throw ScriptRuntime.typeError( + "proxy set has to use the same value as the plain call"); + } + } + if (ScriptableObject.isAccessorDescriptor(targetDesc) + && Undefined.isUndefined(targetDesc.get("set"))) { + throw ScriptRuntime.typeError("proxy set has to be available"); + } + } + return; // true + } + + if (start == this) { + start = target; + } + SymbolScriptable symbolScriptableTarget = ensureSymbolScriptable(target); + symbolScriptableTarget.put(key, start, value); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-p + */ + @Override + public void delete(String name) { + /* + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "deleteProperty"). + * 7. If trap is undefined, then + * a. Return ? target.[[Delete]](P). + * 8. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target, P »)). + * 9. If booleanTrapResult is false, return false. + * 10. Let targetDesc be ? target.[[GetOwnProperty]](P). + * 11. If targetDesc is undefined, return true. + * 12. If targetDesc.[[Configurable]] is false, throw a TypeError exception. + * 13. Let extensibleTarget be ? IsExtensible(target). + * 14. If extensibleTarget is false, throw a TypeError exception. + * 15. Return true. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_DELETE_PROPERTY); + if (trap != null) { + boolean booleanTrapResult = + ScriptRuntime.toBoolean(callTrap(trap, new Object[] {target, name})); + if (!booleanTrapResult) { + return; // false + } + + ScriptableObject targetDesc = + target.getOwnPropertyDescriptor(Context.getContext(), name); + if (targetDesc == null) { + return; // true + } + if (Boolean.FALSE.equals(targetDesc.get("configurable")) || !target.isExtensible()) { + throw ScriptRuntime.typeError( + "proxy can't delete an existing own property ' + name + ' on an not configurable or not extensible object"); + } + + return; // true + } + + target.delete(name); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-p + */ + @Override + public void delete(int index) { + /* + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "deleteProperty"). + * 7. If trap is undefined, then + * a. Return ? target.[[Delete]](P). + * 8. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target, P »)). + * 9. If booleanTrapResult is false, return false. + * 10. Let targetDesc be ? target.[[GetOwnProperty]](P). + * 11. If targetDesc is undefined, return true. + * 12. If targetDesc.[[Configurable]] is false, throw a TypeError exception. + * 13. Let extensibleTarget be ? IsExtensible(target). + * 14. If extensibleTarget is false, throw a TypeError exception. + * 15. Return true. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_DELETE_PROPERTY); + if (trap != null) { + boolean booleanTrapResult = + ScriptRuntime.toBoolean( + callTrap(trap, new Object[] {target, ScriptRuntime.toString(index)})); + if (!booleanTrapResult) { + return; // false + } + + ScriptableObject targetDesc = + target.getOwnPropertyDescriptor(Context.getContext(), index); + if (targetDesc == null) { + return; // true + } + if (Boolean.FALSE.equals(targetDesc.get("configurable")) || !target.isExtensible()) { + throw ScriptRuntime.typeError( + "proxy can't delete an existing own property ' + name + ' on an not configurable or not extensible object"); + } + + return; // true + } + + target.delete(index); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-p + */ + @Override + public void delete(Symbol key) { + /* + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "deleteProperty"). + * 7. If trap is undefined, then + * a. Return ? target.[[Delete]](P). + * 8. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target, P »)). + * 9. If booleanTrapResult is false, return false. + * 10. Let targetDesc be ? target.[[GetOwnProperty]](P). + * 11. If targetDesc is undefined, return true. + * 12. If targetDesc.[[Configurable]] is false, throw a TypeError exception. + * 13. Let extensibleTarget be ? IsExtensible(target). + * 14. If extensibleTarget is false, throw a TypeError exception. + * 15. Return true. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_DELETE_PROPERTY); + if (trap != null) { + boolean booleanTrapResult = + ScriptRuntime.toBoolean(callTrap(trap, new Object[] {target, key})); + if (!booleanTrapResult) { + return; // false + } + + ScriptableObject targetDesc = + target.getOwnPropertyDescriptor(Context.getContext(), key); + if (targetDesc == null) { + return; // true + } + if (Boolean.FALSE.equals(targetDesc.get("configurable")) || !target.isExtensible()) { + throw ScriptRuntime.typeError( + "proxy can't delete an existing own property ' + name + ' on an not configurable or not extensible object"); + } + + return; // true + } + + SymbolScriptable symbolScriptableTarget = ensureSymbolScriptable(target); + symbolScriptableTarget.delete(key); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p + */ + @Override + protected ScriptableObject getOwnPropertyDescriptor(Context cx, Object id) { + /* + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "getOwnPropertyDescriptor"). + * 7. If trap is undefined, then + * a. Return ? target.[[GetOwnProperty]](P). + * 8. Let trapResultObj be ? Call(trap, handler, « target, P »). + * 9. If Type(trapResultObj) is neither Object nor Undefined, throw a TypeError exception. + * 10. Let targetDesc be ? target.[[GetOwnProperty]](P). + * 11. If trapResultObj is undefined, then + * a. If targetDesc is undefined, return undefined. + * b. If targetDesc.[[Configurable]] is false, throw a TypeError exception. + * c. Let extensibleTarget be ? IsExtensible(target). + * d. If extensibleTarget is false, throw a TypeError exception. + * e. Return undefined. + * 12. Let extensibleTarget be ? IsExtensible(target). + * 13. Let resultDesc be ? ToPropertyDescriptor(trapResultObj). + * 14. Call CompletePropertyDescriptor(resultDesc). + * 15. Let valid be IsCompatiblePropertyDescriptor(extensibleTarget, resultDesc, targetDesc). + * 16. If valid is false, throw a TypeError exception. + * 17. If resultDesc.[[Configurable]] is false, then + * a. If targetDesc is undefined or targetDesc.[[Configurable]] is true, then + * i. Throw a TypeError exception. + * b. If resultDesc has a [[Writable]] field and resultDesc.[[Writable]] is false, then + * i. If targetDesc.[[Writable]] is true, throw a TypeError exception. + * 18. Return resultDesc. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_GET_OWN_PROPERTY_DESCRIPTOR); + if (trap != null) { + Object trapResultObj = callTrap(trap, new Object[] {target, id}); + if (!Undefined.isUndefined(trapResultObj) + && !(trapResultObj instanceof Scriptable + && !ScriptRuntime.isSymbol(trapResultObj))) { + throw ScriptRuntime.typeError( + "getOwnPropertyDescriptor trap has to return undefined or an object"); + } + + ScriptableObject targetDesc; + if (ScriptRuntime.isSymbol(id)) { + targetDesc = target.getOwnPropertyDescriptor(cx, id); + } else { + targetDesc = target.getOwnPropertyDescriptor(cx, ScriptRuntime.toString(id)); + } + + if (Undefined.isUndefined(trapResultObj)) { + if (Undefined.isUndefined(targetDesc)) { + return null; + } + + if (Boolean.FALSE.equals(targetDesc.get("configurable")) + || !target.isExtensible()) { + throw ScriptRuntime.typeError( + "proxy can't report an existing own property '" + + id + + "' as non-existent on a non-extensible object"); + } + return null; + } + + Scriptable trapResult = (Scriptable) trapResultObj; + if (trapResultObj != null) { + Object value = ScriptableObject.getProperty(trapResult, "value"); + int attributes = + applyDescriptorToAttributeBitset( + DONTENUM | READONLY | PERMANENT, trapResult); + + ScriptableObject desc = + ScriptableObject.buildDataDescriptor(target, value, attributes); + return desc; + } + return null; + } + + if (ScriptRuntime.isSymbol(id)) { + return target.getOwnPropertyDescriptor(cx, id); + } + + return target.getOwnPropertyDescriptor(cx, ScriptRuntime.toString(id)); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc + */ + @Override + public boolean defineOwnProperty(Context cx, Object id, ScriptableObject desc) { + /* + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "defineProperty"). + * 7. If trap is undefined, then + * a. Return ? target.[[DefineOwnProperty]](P, Desc). + * 8. Let descObj be FromPropertyDescriptor(Desc). + * 9. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target, P, descObj »)). + * 10. If booleanTrapResult is false, return false. + * 11. Let targetDesc be ? target.[[GetOwnProperty]](P). + * 12. Let extensibleTarget be ? IsExtensible(target). + * 13. If Desc has a [[Configurable]] field and if Desc.[[Configurable]] is false, then + * a. Let settingConfigFalse be true. + * 14. Else, let settingConfigFalse be false. + * 15. If targetDesc is undefined, then + * a. If extensibleTarget is false, throw a TypeError exception. + * b. If settingConfigFalse is true, throw a TypeError exception. + * 16. Else, + * a. If IsCompatiblePropertyDescriptor(extensibleTarget, Desc, targetDesc) is false, throw a TypeError exception. + * b. If settingConfigFalse is true and targetDesc.[[Configurable]] is true, throw a TypeError exception. + * c. If IsDataDescriptor(targetDesc) is true, targetDesc.[[Configurable]] is false, and targetDesc.[[Writable]] is true, then + * i. If Desc has a [[Writable]] field and Desc.[[Writable]] is false, throw a TypeError exception. + * 17. Return true. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_DEFINE_PROPERTY); + if (trap != null) { + boolean booleanTrapResult = + ScriptRuntime.toBoolean(callTrap(trap, new Object[] {target, id, desc})); + if (!booleanTrapResult) { + return false; + } + + ScriptableObject targetDesc = target.getOwnPropertyDescriptor(Context.getContext(), id); + boolean extensibleTarget = target.isExtensible(); + + boolean settingConfigFalse = + Boolean.TRUE.equals(ScriptableObject.hasProperty(desc, "configurable")) + && Boolean.FALSE.equals(desc.get("configurable")); + + if (targetDesc == null) { + if (!extensibleTarget || settingConfigFalse) { + throw ScriptRuntime.typeError( + "proxy can't define an incompatible property descriptor"); + } + } else { + if (!AbstractEcmaObjectOperations.isCompatiblePropertyDescriptor( + extensibleTarget, desc, targetDesc)) { + throw ScriptRuntime.typeError( + "proxy can't define an incompatible property descriptor"); + } + + if (settingConfigFalse && Boolean.TRUE.equals(targetDesc.get("configurable"))) { + throw ScriptRuntime.typeError( + "proxy can't define an incompatible property descriptor"); + } + + if (ScriptableObject.isDataDescriptor(targetDesc) + && Boolean.FALSE.equals(targetDesc.get("configurable")) + && Boolean.TRUE.equals(targetDesc.get("writable"))) { + if (Boolean.TRUE.equals(ScriptableObject.hasProperty(desc, "writable")) + && Boolean.FALSE.equals(desc.get("writable"))) { + throw ScriptRuntime.typeError( + "proxy can't define an incompatible property descriptor"); + } + } + } + return true; + } + + return target.defineOwnProperty(cx, id, desc); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-isextensible + */ + @Override + public boolean isExtensible() { + /* + * 1. Let handler be O.[[ProxyHandler]]. + * 2. If handler is null, throw a TypeError exception. + * 3. Assert: Type(handler) is Object. + * 4. Let target be O.[[ProxyTarget]]. + * 5. Let trap be ? GetMethod(handler, "isExtensible"). + * 6. If trap is undefined, then + * a. a. Return ? IsExtensible(target). + * 7. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target »)). + * 8. Let targetResult be ? IsExtensible(target). + * 9. If SameValue(booleanTrapResult, targetResult) is false, throw a TypeError exception. + * 10. Return booleanTrapResult. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_IS_EXTENSIBLE); + if (trap == null) { + return target.isExtensible(); + } + + boolean booleanTrapResult = ScriptRuntime.toBoolean(callTrap(trap, new Object[] {target})); + if (booleanTrapResult != target.isExtensible()) { + throw ScriptRuntime.typeError( + "IsExtensible trap has to return the same value as the target"); + } + return booleanTrapResult; + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-preventextensions + */ + @Override + public boolean preventExtensions() { + /* + * 1. Let handler be O.[[ProxyHandler]]. + * 2. If handler is null, throw a TypeError exception. + * 3. Assert: Type(handler) is Object. + * 4. Let target be O.[[ProxyTarget]]. + * 5. Let trap be ? GetMethod(handler, "preventExtensions"). + * 6. If trap is undefined, then + * a. Return ? target.[[PreventExtensions]](). + * 7. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target »)). + * 8. If booleanTrapResult is true, then + * a. Let extensibleTarget be ? IsExtensible(target). + * b. If extensibleTarget is true, throw a TypeError exception. + * 9. Return booleanTrapResult. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_PREVENT_EXTENSIONS); + if (trap == null) { + return target.preventExtensions(); + } + boolean booleanTrapResult = ScriptRuntime.toBoolean(callTrap(trap, new Object[] {target})); + if (booleanTrapResult && target.isExtensible()) { + throw ScriptRuntime.typeError("target is extensible but trap returned true"); + } + + return booleanTrapResult; + } + + @Override + public String getTypeOf() { + return typeOf; + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-getprototypeof + */ + @Override + public Scriptable getPrototype() { + /* + * 1. Let handler be O.[[ProxyHandler]]. + * 2. If handler is null, throw a TypeError exception. + * 3. Assert: Type(handler) is Object. + * 4. Let target be O.[[ProxyTarget]]. + * 5. Let trap be ? GetMethod(handler, "getPrototypeOf"). + * 6. If trap is undefined, then + * a. Return ? target.[[GetPrototypeOf]](). + * 7. Let handlerProto be ? Call(trap, handler, « target »). + * 8. If Type(handlerProto) is neither Object nor Null, throw a TypeError exception. + * 9. Let extensibleTarget be ? IsExtensible(target). + * 10. If extensibleTarget is true, return handlerProto. + * 11. Let targetProto be ? target.[[GetPrototypeOf]](). + * 12. If SameValue(handlerProto, targetProto) is false, throw a TypeError exception. + * 13. Return handlerProto. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_GET_PROTOTYPE_OF); + if (trap != null) { + Object handlerProto = callTrap(trap, new Object[] {target}); + + Scriptable handlerProtoScriptable = Undefined.SCRIPTABLE_UNDEFINED; + if (handlerProtoScriptable == null + || Undefined.isUndefined(handlerProto) + || ScriptRuntime.isSymbol(handlerProto)) { + throw ScriptRuntime.typeErrorById( + "msg.arg.not.object", ScriptRuntime.typeof(handlerProto)); + } + + handlerProtoScriptable = ensureScriptable(handlerProto); + + if (target.isExtensible()) { + return handlerProtoScriptable; + } + if (handlerProto != target.getPrototype()) { + throw ScriptRuntime.typeError( + "getPrototypeOf trap has to return the original prototype"); + } + return handlerProtoScriptable; + } + + return target.getPrototype(); + } + + private void setPrototypeDirect(Scriptable prototype) { + super.setPrototype(prototype); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v + */ + @Override + public void setPrototype(Scriptable prototype) { + /* + * 1. Assert: Either Type(V) is Object or Type(V) is Null. + * 2. Let handler be O.[[ProxyHandler]]. + * 3. If handler is null, throw a TypeError exception. + * 4. Assert: Type(handler) is Object. + * 5. Let target be O.[[ProxyTarget]]. + * 6. Let trap be ? GetMethod(handler, "setPrototypeOf"). + * 7. If trap is undefined, then + * a. Return ? target.[[SetPrototypeOf]](V). + * 8. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target, V »)). + * 9. If booleanTrapResult is false, return false. + * 10. Let extensibleTarget be ? IsExtensible(target). + * 11. If extensibleTarget is true, return true. + * 12. Let targetProto be ? target.[[SetPrototypeOf]](). + * 13. If SameValue(V, targetProto) is false, throw a TypeError exception. + * 14. Return true. + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Callable trap = getTrap(TRAP_SET_PROTOTYPE_OF); + if (trap != null) { + boolean booleanTrapResult = + ScriptRuntime.toBoolean(callTrap(trap, new Object[] {target, prototype})); + if (!booleanTrapResult) { + return; // false + } + if (target.isExtensible()) { + return; // true + } + + return; + } + + target.setPrototype(prototype); + } + + /** + * see + * https://262.ecma-international.org/12.0/#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist + */ + @Override + public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + /* + * 1. Let handler be O.[[ProxyHandler]]. + * 2. If handler is null, throw a TypeError exception. + * 3. Assert: Type(handler) is Object. + * 4. Let target be O.[[ProxyTarget]]. + * 5. Let trap be ? GetMethod(handler, "apply"). + * 6. If trap is undefined, then + * a. Return ? Call(target, thisArgument, argumentsList). + * 7. Let argArray be ! CreateArrayFromList(argumentsList). + * 8. Return ? Call(trap, handler, « target, thisArgument, argArray »). + */ + ScriptableObject target = getTargetThrowIfRevoked(); + + Scriptable argumentsList = cx.newArray(scope, args); + + Callable trap = getTrap(TRAP_APPLY); + if (trap != null) { + return callTrap(trap, new Object[] {target, thisObj, argumentsList}); + } + + return ScriptRuntime.applyOrCall( + true, cx, scope, target, new Object[] {thisObj, argumentsList}); + } + + private static NativeProxy constructor(Context cx, Scriptable scope, Object[] args) { + if (args.length < 2) { + throw ScriptRuntime.typeErrorById( + "msg.method.missing.parameter", + "Proxy.ctor", + "2", + Integer.toString(args.length)); + } + ScriptableObject trgt = ensureScriptableObject(args[0]); + + ScriptableObject hndlr = ensureScriptableObject(args[1]); + + NativeProxy proxy = new NativeProxy(trgt, hndlr); + proxy.setPrototypeDirect(ScriptableObject.getClassPrototype(scope, PROXY_TAG)); + proxy.setParentScope(scope); + return proxy; + } + + // Proxy.revocable + private static Object revocable( + Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + if (!ScriptRuntime.isObject(thisObj)) { + throw ScriptRuntime.typeErrorById("msg.arg.not.object", ScriptRuntime.typeof(thisObj)); + } + NativeProxy proxy = constructor(cx, scope, args); + + NativeObject revocable = (NativeObject) cx.newObject(scope); + + revocable.put("proxy", revocable, proxy); + revocable.put("revoke", revocable, new LambdaFunction(scope, "", 0, new Revoker(proxy))); + return revocable; + } + + private Callable getTrap(String trapName) { + Object handlerProp = ScriptableObject.getProperty(handlerObj, trapName); + if (Scriptable.NOT_FOUND == handlerProp) { + return null; + } + if (handlerProp == null || Undefined.isUndefined(handlerProp)) { + return null; + } + if (!(handlerProp instanceof Callable)) { + throw ScriptRuntime.notFunctionError(handlerProp, trapName); + } + + return (Callable) handlerProp; + } + + private Object callTrap(Callable trap, Object[] args) { + return trap.call(Context.getContext(), handlerObj, handlerObj, args); + } + + ScriptableObject getTargetThrowIfRevoked() { + if (targetObj == null) { + throw ScriptRuntime.typeError("Illegal operation attempted on a revoked proxy"); + } + return targetObj; + } +} diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeReflect.java b/rhino/src/main/java/org/mozilla/javascript/NativeReflect.java new file mode 100644 index 0000000000..7ae6a13e7b --- /dev/null +++ b/rhino/src/main/java/org/mozilla/javascript/NativeReflect.java @@ -0,0 +1,419 @@ +/* -*- Mode: java; tab-width: 4; indent-tabs-mode: 1; c-basic-offset: 4 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.mozilla.javascript; + +import java.util.ArrayList; +import java.util.List; + +/** + * This class implements the Reflect object. + * + * @author Ronald Brill + */ +final class NativeReflect extends ScriptableObject { + private static final long serialVersionUID = 2920773905356325445L; + + private static final String REFLECT_TAG = "Reflect"; + + public static void init(Context cx, Scriptable scope, boolean sealed) { + NativeReflect reflect = new NativeReflect(); + reflect.setPrototype(getObjectPrototype(scope)); + reflect.setParentScope(scope); + + reflect.defineProperty( + scope, "apply", 3, NativeReflect::apply, DONTENUM, DONTENUM | READONLY); + reflect.defineProperty( + scope, "construct", 2, NativeReflect::construct, DONTENUM, DONTENUM | READONLY); + reflect.defineProperty( + scope, + "defineProperty", + 3, + NativeReflect::defineProperty, + DONTENUM, + DONTENUM | READONLY); + reflect.defineProperty( + scope, + "deleteProperty", + 2, + NativeReflect::deleteProperty, + DONTENUM, + DONTENUM | READONLY); + reflect.defineProperty(scope, "get", 2, NativeReflect::get, DONTENUM, DONTENUM | READONLY); + reflect.defineProperty( + scope, + "getOwnPropertyDescriptor", + 2, + NativeReflect::getOwnPropertyDescriptor, + DONTENUM, + DONTENUM | READONLY); + reflect.defineProperty( + scope, + "getPrototypeOf", + 1, + NativeReflect::getPrototypeOf, + DONTENUM, + DONTENUM | READONLY); + reflect.defineProperty(scope, "has", 2, NativeReflect::has, DONTENUM, DONTENUM | READONLY); + reflect.defineProperty( + scope, + "isExtensible", + 1, + NativeReflect::isExtensible, + DONTENUM, + DONTENUM | READONLY); + reflect.defineProperty( + scope, "ownKeys", 1, NativeReflect::ownKeys, DONTENUM, DONTENUM | READONLY); + reflect.defineProperty( + scope, + "preventExtensions", + 1, + NativeReflect::preventExtensions, + DONTENUM, + DONTENUM | READONLY); + reflect.defineProperty(scope, "set", 3, NativeReflect::set, DONTENUM, DONTENUM | READONLY); + reflect.defineProperty( + scope, + "setPrototypeOf", + 2, + NativeReflect::setPrototypeOf, + DONTENUM, + DONTENUM | READONLY); + + reflect.defineProperty(SymbolKey.TO_STRING_TAG, REFLECT_TAG, DONTENUM | READONLY); + + ScriptableObject.defineProperty(scope, REFLECT_TAG, reflect, DONTENUM); + if (sealed) { + reflect.sealObject(); + } + } + + private NativeReflect() {} + + @Override + public String getClassName() { + return "Reflect"; + } + + private static Object apply(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + if (args.length < 3) { + throw ScriptRuntime.typeErrorById( + "msg.method.missing.parameter", + "Reflect.apply", + "3", + Integer.toString(args.length)); + } + + Scriptable callable = ScriptableObject.ensureScriptable(args[0]); + + if (args[1] instanceof Scriptable) { + thisObj = (Scriptable) args[1]; + } else if (ScriptRuntime.isPrimitive(args[1])) { + thisObj = cx.newObject(scope, "Object", new Object[] {args[1]}); + } + + if (ScriptRuntime.isSymbol(args[2])) { + throw ScriptRuntime.typeErrorById("msg.arg.not.object", ScriptRuntime.typeof(args[2])); + } + ScriptableObject argumentsList = ScriptableObject.ensureScriptableObject(args[2]); + + return ScriptRuntime.applyOrCall( + true, cx, scope, callable, new Object[] {thisObj, argumentsList}); + } + + /** see https://262.ecma-international.org/12.0/#sec-reflect.construct */ + private static Scriptable construct( + Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + /* + * 1. If IsConstructor(target) is false, throw a TypeError exception. + * 2. If newTarget is not present, set newTarget to target. + * 3. Else if IsConstructor(newTarget) is false, throw a TypeError exception. + * 4. Let args be ? CreateListFromArrayLike(argumentsList). + * 5. Return ? Construct(target, args, newTarget). + */ + if (args.length < 1) { + throw ScriptRuntime.typeErrorById( + "msg.method.missing.parameter", + "Reflect.construct", + "3", + Integer.toString(args.length)); + } + + if (!(args[0] instanceof Constructable)) { + throw ScriptRuntime.typeErrorById("msg.not.ctor", ScriptRuntime.typeof(args[0])); + } + + Constructable ctor = (Constructable) args[0]; + if (args.length < 2) { + return ctor.construct(cx, scope, ScriptRuntime.emptyArgs); + } + + if (args.length > 2 && !(args[2] instanceof Constructable)) { + throw ScriptRuntime.typeErrorById("msg.not.ctor", ScriptRuntime.typeof(args[2])); + } + + Object[] callArgs = ScriptRuntime.getApplyArguments(cx, args[1]); + + Object newTargetPrototype = null; + if (args.length > 2) { + Scriptable newTarget = ScriptableObject.ensureScriptable(args[2]); + + if (newTarget instanceof BaseFunction) { + newTargetPrototype = ((BaseFunction) newTarget).getPrototypeProperty(); + } else { + newTargetPrototype = newTarget.get("prototype", newTarget); + } + + if (!(newTargetPrototype instanceof Scriptable) + || ScriptRuntime.isSymbol(newTargetPrototype) + || Undefined.isUndefined(newTargetPrototype)) { + newTargetPrototype = null; + } + } + + // hack to set the right prototype before calling the ctor + if (ctor instanceof BaseFunction && newTargetPrototype != null) { + BaseFunction ctorBaseFunction = (BaseFunction) ctor; + Scriptable result = ctorBaseFunction.createObject(cx, scope); + if (result != null) { + result.setPrototype((Scriptable) newTargetPrototype); + + Object val = ctorBaseFunction.call(cx, scope, result, callArgs); + if (val instanceof Scriptable) { + return (Scriptable) val; + } + + return result; + } + } + + Scriptable newScriptable = ctor.construct(cx, scope, callArgs); + if (newTargetPrototype != null) { + newScriptable.setPrototype((Scriptable) newTargetPrototype); + } + + return newScriptable; + } + + private static Object defineProperty( + Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + if (args.length < 3) { + throw ScriptRuntime.typeErrorById( + "msg.method.missing.parameter", + "Reflect.defineProperty", + "3", + Integer.toString(args.length)); + } + + ScriptableObject target = checkTarget(args); + ScriptableObject desc = ScriptableObject.ensureScriptableObject(args[2]); + + try { + return target.defineOwnProperty(cx, args[1], desc); + } catch (EcmaError e) { + return false; + } + } + + private static Object deleteProperty( + Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + ScriptableObject target = checkTarget(args); + + if (args.length > 1) { + if (ScriptRuntime.isSymbol(args[1])) { + return ScriptableObject.deleteProperty(target, (Symbol) args[1]); + } + return ScriptableObject.deleteProperty(target, ScriptRuntime.toString(args[1])); + } + + return false; + } + + private static Object get(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + ScriptableObject target = checkTarget(args); + + if (args.length > 1) { + if (ScriptRuntime.isSymbol(args[1])) { + Object prop = ScriptableObject.getProperty(target, (Symbol) args[1]); + return prop == Scriptable.NOT_FOUND ? Undefined.SCRIPTABLE_UNDEFINED : prop; + } + if (args[1] instanceof Double) { + Object prop = ScriptableObject.getProperty(target, ScriptRuntime.toIndex(args[1])); + return prop == Scriptable.NOT_FOUND ? Undefined.SCRIPTABLE_UNDEFINED : prop; + } + + Object prop = ScriptableObject.getProperty(target, ScriptRuntime.toString(args[1])); + return prop == Scriptable.NOT_FOUND ? Undefined.SCRIPTABLE_UNDEFINED : prop; + } + return Undefined.SCRIPTABLE_UNDEFINED; + } + + private static Scriptable getOwnPropertyDescriptor( + Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + ScriptableObject target = checkTarget(args); + + if (args.length > 1) { + if (ScriptRuntime.isSymbol(args[1])) { + ScriptableObject desc = target.getOwnPropertyDescriptor(cx, args[1]); + return desc == null ? Undefined.SCRIPTABLE_UNDEFINED : desc; + } + + ScriptableObject desc = + target.getOwnPropertyDescriptor(cx, ScriptRuntime.toString(args[1])); + return desc == null ? Undefined.SCRIPTABLE_UNDEFINED : desc; + } + return Undefined.SCRIPTABLE_UNDEFINED; + } + + private static Scriptable getPrototypeOf( + Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + ScriptableObject target = checkTarget(args); + + return target.getPrototype(); + } + + private static Object has(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + ScriptableObject target = checkTarget(args); + + if (args.length > 1) { + if (ScriptRuntime.isSymbol(args[1])) { + return ScriptableObject.hasProperty(target, (Symbol) args[1]); + } + + return ScriptableObject.hasProperty(target, ScriptRuntime.toString(args[1])); + } + return false; + } + + private static Object isExtensible( + Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + ScriptableObject target = checkTarget(args); + return target.isExtensible(); + } + + private static Scriptable ownKeys( + Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + ScriptableObject target = checkTarget(args); + + final List strings = new ArrayList<>(); + final List symbols = new ArrayList<>(); + + for (Object o : target.getIds(true, true)) { + if (o instanceof Symbol) { + symbols.add(o); + } else { + strings.add(ScriptRuntime.toString(o)); + } + } + + Object[] keys = new Object[strings.size() + symbols.size()]; + System.arraycopy(strings.toArray(), 0, keys, 0, strings.size()); + System.arraycopy(symbols.toArray(), 0, keys, strings.size(), symbols.size()); + + return cx.newArray(scope, keys); + } + + private static Object preventExtensions( + Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + ScriptableObject target = checkTarget(args); + + return target.preventExtensions(); + } + + private static Object set(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + ScriptableObject target = checkTarget(args); + if (args.length < 2) { + return true; + } + + ScriptableObject receiver = + args.length > 3 ? ScriptableObject.ensureScriptableObject(args[3]) : target; + if (receiver != target) { + ScriptableObject descriptor = target.getOwnPropertyDescriptor(cx, args[1]); + if (descriptor != null) { + Object setter = descriptor.get("set"); + if (setter != null && setter != NOT_FOUND) { + ((Function) setter).call(cx, scope, receiver, new Object[] {args[2]}); + return true; + } + + if (Boolean.FALSE.equals(descriptor.get("configurable"))) { + return false; + } + } + } + + if (ScriptRuntime.isSymbol(args[1])) { + receiver.put((Symbol) args[1], receiver, args[2]); + } else if (args[1] instanceof Double) { + receiver.put(ScriptRuntime.toIndex(args[1]), receiver, args[2]); + } else { + receiver.put(ScriptRuntime.toString(args[1]), receiver, args[2]); + } + + return true; + } + + private static Object setPrototypeOf( + Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + if (args.length < 2) { + throw ScriptRuntime.typeErrorById( + "msg.method.missing.parameter", + "Reflect.js_setPrototypeOf", + "2", + Integer.toString(args.length)); + } + + ScriptableObject target = checkTarget(args); + + if (target.getPrototype() == args[1]) { + return true; + } + + if (!target.isExtensible()) { + return false; + } + + if (args[1] == null) { + target.setPrototype(null); + return true; + } + + if (ScriptRuntime.isSymbol(args[1])) { + throw ScriptRuntime.typeErrorById("msg.arg.not.object", ScriptRuntime.typeof(args[0])); + } + + ScriptableObject proto = ScriptableObject.ensureScriptableObject(args[1]); + if (target.getPrototype() == proto) { + return true; + } + + // avoid cycles + Scriptable p = proto; + while (p != null) { + if (target == p) { + return false; + } + p = p.getPrototype(); + } + + target.setPrototype(proto); + return true; + } + + private static ScriptableObject checkTarget(Object[] args) { + if (args.length == 0 || args[0] == null || args[0] == Undefined.instance) { + Object argument = args.length == 0 ? Undefined.instance : args[0]; + throw ScriptRuntime.typeErrorById( + "msg.no.properties", ScriptRuntime.toString(argument)); + } + + if (ScriptRuntime.isSymbol(args[0])) { + throw ScriptRuntime.typeErrorById("msg.arg.not.object", ScriptRuntime.typeof(args[0])); + } + return ScriptableObject.ensureScriptableObject(args[0]); + } +} diff --git a/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java b/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java index 337f7e0bba..c6661bfce1 100644 --- a/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java +++ b/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java @@ -290,6 +290,9 @@ public static ScriptableObject initSafeStandardObjects( NativeWeakMap.init(scope, sealed); NativeWeakSet.init(scope, sealed); NativeBigInt.init(scope, sealed); + + NativeProxy.init(cx, scope, sealed); + NativeReflect.init(cx, scope, sealed); } if (scope instanceof TopLevel) { @@ -2846,7 +2849,7 @@ static Scriptable getApplyOrCallThis(Context cx, Scriptable scope, Object arg0, } /** @return true if the passed in Scriptable looks like an array */ - private static boolean isArrayLike(Scriptable obj) { + public static boolean isArrayLike(Scriptable obj) { return obj != null && (obj instanceof NativeArray || obj instanceof Arguments @@ -3526,6 +3529,10 @@ public static boolean eq(Object x, Object y) { } } return eqNumber(b ? 1.0 : 0.0, y); + } else if (x instanceof SymbolKey) { + return x.equals(y); + } else if (y instanceof SymbolKey) { + return y.equals(x); } else if (x instanceof Scriptable) { if (x instanceof Delegator) { x = ((Delegator) x).getDelegee(); diff --git a/rhino/src/main/java/org/mozilla/javascript/ScriptableObject.java b/rhino/src/main/java/org/mozilla/javascript/ScriptableObject.java index c871c56b07..578e1350db 100644 --- a/rhino/src/main/java/org/mozilla/javascript/ScriptableObject.java +++ b/rhino/src/main/java/org/mozilla/javascript/ScriptableObject.java @@ -1575,9 +1575,9 @@ public void defineOwnProperties(Context cx, ScriptableObject props) { * @param id the name/index of the property * @param desc the new property descriptor, as described in 8.6.1 */ - public void defineOwnProperty(Context cx, Object id, ScriptableObject desc) { + public boolean defineOwnProperty(Context cx, Object id, ScriptableObject desc) { checkPropertyDefinition(desc); - defineOwnProperty(cx, id, desc, true); + return defineOwnProperty(cx, id, desc, true); } /** @@ -1590,7 +1590,7 @@ public void defineOwnProperty(Context cx, Object id, ScriptableObject desc) { * @param desc the new property descriptor, as described in 8.6.1 * @param checkValid whether to perform validity checks */ - protected void defineOwnProperty( + protected boolean defineOwnProperty( Context cx, Object id, ScriptableObject desc, boolean checkValid) { Object key = null; @@ -1667,6 +1667,7 @@ protected void defineOwnProperty( slot.setAttributes(attributes); return slot; }); + return true; } /** @@ -1844,7 +1845,7 @@ protected boolean sameValue(Object newValue, Object currentValue) { return ScriptRuntime.shallowEq(currentValue, newValue); } - protected int applyDescriptorToAttributeBitset(int attributes, ScriptableObject desc) { + protected int applyDescriptorToAttributeBitset(int attributes, Scriptable desc) { Object enumerable = getProperty(desc, "enumerable"); if (enumerable != NOT_FOUND) { attributes = @@ -1898,7 +1899,7 @@ protected static boolean isAccessorDescriptor(ScriptableObject desc) { * @param desc a property descriptor * @return true if this is a generic descriptor. */ - protected boolean isGenericDescriptor(ScriptableObject desc) { + protected static boolean isGenericDescriptor(ScriptableObject desc) { return !isDataDescriptor(desc) && !isAccessorDescriptor(desc); } @@ -2029,8 +2030,9 @@ public boolean isExtensible() { return isExtensible; } - public void preventExtensions() { + public boolean preventExtensions() { isExtensible = false; + return true; } /** @@ -2377,6 +2379,15 @@ public static boolean deleteProperty(Scriptable obj, int index) { return !base.has(index, obj); } + /** A version of deleteProperty for properties with Symbol keys. */ + public static boolean deleteProperty(Scriptable obj, Symbol key) { + Scriptable base = getBase(obj, key); + if (base == null) return true; + SymbolScriptable scriptable = ensureSymbolScriptable(base); + scriptable.delete(key); + return !scriptable.has(key, obj); + } + /** * Returns an array of all ids from an object and its prototypes. * diff --git a/tests/src/test/java/org/mozilla/javascript/tests/Test262SuiteTest.java b/tests/src/test/java/org/mozilla/javascript/tests/Test262SuiteTest.java index a92e71bb11..45eb06a72e 100644 --- a/tests/src/test/java/org/mozilla/javascript/tests/Test262SuiteTest.java +++ b/tests/src/test/java/org/mozilla/javascript/tests/Test262SuiteTest.java @@ -91,11 +91,6 @@ public class Test262SuiteTest { Arrays.asList( "Atomics", "IsHTMLDDA", - "Proxy", - "Reflect", - "Reflect.construct", - "Reflect.set", - "Reflect.setPrototypeOf", "SharedArrayBuffer", "async-functions", "async-iteration", diff --git a/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeProxyTest.java b/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeProxyTest.java new file mode 100644 index 0000000000..1cb3531e61 --- /dev/null +++ b/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeProxyTest.java @@ -0,0 +1,918 @@ +package org.mozilla.javascript.tests.es6; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.mozilla.javascript.Context; +import org.mozilla.javascript.Scriptable; +import org.mozilla.javascript.tests.Utils; + +public class NativeProxyTest { + + @Test + public void testToString() { + testString("function Proxy() {\n\t[native code, arity=2]\n}\n", "Proxy.toString()"); + + testString("[object Object]", "Object.prototype.toString.call(new Proxy({}, {}))"); + testString("[object Array]", "Object.prototype.toString.call(new Proxy([], {}))"); + testString( + "[object Array]", + "Object.prototype.toString.call(new Proxy(new Proxy([], {}), {}))"); + } + + @Test + public void testToStringRevoke() { + String js = + "var rev = Proxy.revocable(%s, {});\n" + + "rev.revoke();\n" + + "try {" + + " Object.prototype.toString.call(%s);\n" + + "} catch(e) {\n" + + " '' + e;\n" + + "}"; + + testString( + "TypeError: Illegal operation attempted on a revoked proxy", + String.format(js, "{}", "rev.proxy")); + testString( + "TypeError: Illegal operation attempted on a revoked proxy", + String.format(js, "[]", "rev.proxy")); + } + + @Test + public void prototype() { + testString("false", "'' + Object.hasOwnProperty.call(Proxy, 'prototype')"); + + testString("2", "'' + Proxy.length"); + } + + @Test + public void ctorMissingArgs() { + testString( + "TypeError: Proxy.ctor: At least 2 arguments required, but only 0 passed", + "try { new Proxy() } catch(e) { '' + e }"); + testString( + "TypeError: Proxy.ctor: At least 2 arguments required, but only 1 passed", + "try { new Proxy({}) } catch(e) { '' + e }"); + + testString( + "TypeError: Expected argument of type object, but instead had type undefined", + "try { new Proxy(undefined, {}) } catch(e) { '' + e }"); + testString( + "TypeError: Expected argument of type object, but instead had type object", + "try { new Proxy(null, {}) } catch(e) { '' + e }"); + } + + @Test + public void ctorAsFunction() { + testString( + "TypeError: The constructor for Proxy may not be invoked as a function", + "try { Proxy() } catch(e) { '' + e }"); + } + + @Test + public void construct() { + String js = + "var _target, _handler, _args, _P;\n" + + "function Target() {}\n" + + "var handler = {\n" + + " construct: function(t, args, newTarget) {\n" + + " _handler = this;\n" + + " _target = t;\n" + + " _args = args;\n" + + " _P = newTarget;\n" + + " return new t(args[0], args[1]);\n" + + " }\n" + + "};\n" + + "var P = new Proxy(Target, handler);\n" + + "new P(1, 4);\n" + + "'' + (_handler === handler)\n" + + "+ ' ' + (_target === Target)" + + "+ ' ' + (_P === P)" + + "+ ' ' + _args.length + ' ' + _args[0] + ' ' + _args[1]"; + + testString("true true true 2 1 4", js); + } + + @Test + public void apply() { + String js = + "function sum(a, b) {\n" + + " return a + b;\n" + + "}\n" + + "var res = '';\n" + + "var handler = {\n" + + " apply: function (target, thisArg, argumentsList) {\n" + + " res += ' ' + `Calculate sum: ${argumentsList}`;\n" + + " return target(argumentsList[0], argumentsList[1]) * 7;\n" + + " },\n" + + "};\n" + + "var proxy1 = new Proxy(sum, handler);\n" + + "var x = ' ' + proxy1(1, 2);\n" + + "res + x"; + + testString(" Calculate sum: 1,2 21", js); + } + + @Test + public void applyParameters() { + String js = + "var _target, _args, _handler, _context;\n" + + "var target = function() {\n" + + " throw new Error('target should not be called');\n" + + "};\n" + + "var handler = {\n" + + " apply: function(t, c, args) {\n" + + " _handler = this;\n" + + " _target = t;\n" + + " _context = c;\n" + + " _args = args;\n" + + " }\n" + + "};\n" + + "var p = new Proxy(target, handler);\n" + + "var context = {};\n" + + "p.call(context, 1, 4);\n" + + "'' + (_handler === handler)\n" + + "+ ' ' + (_target === target)" + + "+ ' ' + (_context === context)" + + "+ ' ' + _args.length + ' ' + _args[0] + ' ' + _args[1]"; + + testString("true true true 2 1 4", js); + } + + @Test + public void applyTrapIsNull() { + String js = + "var calls = 0;\n" + + "var _context;\n" + + "var target = new Proxy(function() {}, {\n" + + " apply: function(_target, context, args) {\n" + + " calls++;\n" + + " _context = context;\n" + + " return args[0] + args[1];\n" + + " }\n" + + "})\n" + + "var p = new Proxy(target, {\n" + + " apply: null\n" + + "});\n" + + "var context = {};\n" + + "var res = p.call(context, 1, 2);\n" + + "'' + calls\n" + + "+ ' ' + (_context === context)" + + "+ ' ' + res"; + + testString("1 true 3", js); + } + + @Test + public void applyWithoutHandler() { + String js = + "function sum(a, b) {\n" + + " return a + b;\n" + + "}\n" + + "var proxy1 = new Proxy(sum, {});\n" + + "proxy1(1, 2);"; + + testDouble(3.0, js); + } + + @Test + public void defineProperty() { + String js = + "var o = {};\n" + + "var res = '';\n" + + "var handler = {\n" + + " defineProperty(target, key, desc) {\n" + + " res = res + target + ' ' + key + ' '\n" + + " + desc.writable + ' ' + desc.configurable + ' ' + desc.enumerable;\n" + + " return true;\n" + + " }\n" + + " };\n" + + "var proxy1 = new Proxy(o, handler);\n" + + "Object.defineProperty(proxy1, 'p', { value: 42, writable: false });\n" + + "res;"; + testString("[object Object] p false undefined undefined", js); + } + + @Test + public void definePropertyTrapReturnsFalse() { + String js = + "var target = {};\n" + + "var p = new Proxy(target, {\n" + + " defineProperty: function(t, prop, desc) {\n" + + " return 0;\n" + + " }\n" + + "});\n" + + "'' + Reflect.defineProperty(p, 'attr', {})" + + "+ ' ' + Object.getOwnPropertyDescriptor(target, 'attr')"; + testString("false undefined", js); + } + + @Test + public void + definePropertyDescNotConfigurableAndTargetPropertyDescriptorConfigurableAndTrapResultIsTrue() { + String js = + "var target = {};\n" + + "var p = new Proxy(target, {\n" + + " defineProperty: function(t, prop, desc) {\n" + + " return true;\n" + + " }\n" + + "});\n" + + "Object.defineProperty(target, \"foo\", {\n" + + " value: 1,\n" + + " configurable: true\n" + + "});\n" + + "try {\n" + + " Object.defineProperty(p, \"foo\", {\n" + + " value: 1,\n" + + " configurable: false\n" + + " });\n" + + "} catch(e) {\n" + + " '' + e;\n" + + "}\n"; + testString("TypeError: proxy can't define an incompatible property descriptor", js); + } + + @Test + public void definePropertyDescAndTargetPropertyDescriptorNotCompatibleAndTrapResultIsTrue() { + String js = + "var target = {};\n" + + "var p = new Proxy(target, {\n" + + " defineProperty: function(t, prop, desc) {\n" + + " return true;\n" + + " }\n" + + "});\n" + + "Object.defineProperty(target, \"foo\", {\n" + + " value: 1\n" + + "});\n" + + "try {\n" + + " Object.defineProperty(p, \"foo\", {\n" + + " value: 2\n" + + " });\n" + + "} catch(e) {\n" + + " '' + e;\n" + + "}\n"; + testString("TypeError: proxy can't define an incompatible property descriptor", js); + } + + @Test + public void definePropertyDescAndTargetPropertyDescriptorNotCompatibleAndTrapResultIsTrue2() { + String js = + "var target = Object.create(null);\n" + + "var p = new Proxy(target, {\n" + + " defineProperty: function() {\r\n" + + " return true;\r\n" + + " }\n" + + "});\n" + + "Object.defineProperty(target, 'prop', {\n" + + " value: 1,\n" + + " configurable: false\n" + + "});\n" + + "try {\n" + + " Object.defineProperty(p, 'prop', {\n" + + " value: 1,\n" + + " configurable: true\n" + + " });\n" + + "} catch(e) {\n" + + " '' + e;\n" + + "}\n"; + testString("TypeError: proxy can't define an incompatible property descriptor", js); + } + + @Test + public void definePropertyWithoutHandler() { + String js = + "var o = {};\n" + + "var proxy1 = new Proxy(o, {});\n" + + "proxy1.p = 42;\n" + + "'' + o.p;"; + testString("42", js); + } + + @Test + public void definePropertyFreezedWithoutHandler() { + String js = + "var o = {};\n" + + "Object.freeze(o);\n" + + "var proxy1 = new Proxy(o, {});\n" + + "try {\n" + + " Object.defineProperty(proxy1, 'p', { value: 42, writable: false });\n" + + " '' + o.p;\n" + + "} catch(e) {\n" + + " '' + e;" + + "}\n"; + testString( + "TypeError: Cannot add properties to this object because extensible is false.", js); + } + + @Test + public void definePropertyHandlerNotFunction() { + String js = + "var o = {};\n" + + "var proxy1 = new Proxy(o, { defineProperty: 7 });\n" + + "try {\n" + + " Object.defineProperty(proxy1, 'p', { value: 42, writable: false });\n" + + " '' + o.p;\n" + + "} catch(e) {\n" + + " '' + e;" + + "}\n"; + testString("TypeError: defineProperty is not a function, it is number.", js); + } + + @Test + public void definePropertyHandlerNull() { + String js = + "var o = {};\n" + + "var proxy1 = new Proxy(o, { defineProperty: null });\n" + + "try {\n" + + " Object.defineProperty(proxy1, 'p', { value: 42, writable: false });\n" + + " '' + o.p;\n" + + "} catch(e) {\n" + + " '' + e;" + + "}\n"; + testString("42", js); + } + + @Test + public void definePropertyHandlerUndefined() { + String js = + "var o = {};\n" + + "var proxy1 = new Proxy(o, { defineProperty: undefined });\n" + + "try {\n" + + " Object.defineProperty(proxy1, 'p', { value: 42, writable: false });\n" + + " '' + o.p;\n" + + "} catch(e) {\n" + + " '' + e;" + + "}\n"; + testString("42", js); + } + + @Test + public void deletePropertyWithoutHandler() { + String js = + "var o = { p: 42 };\n" + + "var proxy1 = new Proxy(o, {});\n" + + "delete proxy1.p;\n" + + "'' + o.p;"; + testString("undefined", js); + } + + @Test + public void getOwnPropertyDescriptor() { + String js = + "var o1 = {};\n" + + "var fn = function() {};\n" + + "Object.defineProperty(o1, 'p', {\n" + + " get: fn,\n" + + " configurable: true\n" + + "});\n" + + "var proxy1 = new Proxy(o1, {\n" + + " getOwnPropertyDescriptor(target, prop) {\n" + + " return { configurable: true, enumerable: true, value: 7 };\n" + + " }});\n" + + "var result = Object.getOwnPropertyDescriptor(proxy1, 'p');\n" + + "'' + o1.p + ' ' + result.value \n" + + "+ ' [' + Object.getOwnPropertyNames(result) + ']' " + + "+ ' ' + result.enumerable " + + "+ ' ' + result.configurable " + + "+ ' ' + result.writable " + + "+ ' ' + (result.get === fn) " + + "+ ' ' + (result.set === undefined)"; + testString( + "undefined 7 [value,writable,enumerable,configurable] true true false false true", + js); + } + + @Test + public void getOwnPropertyDescriptorResultUndefined() { + String js = + "var target = {attr: 1};\n" + + "var p = new Proxy(target, {\n" + + " getOwnPropertyDescriptor: function(t, prop) {\n" + + " return;\n" + + " }\n" + + " });\n" + + "'' + Object.getOwnPropertyDescriptor(p, 'attr');"; + testString("undefined", js); + } + + @Test + public void getOwnPropertyDescriptorWithoutHandler() { + String js = + "var o1 = {};\n" + + "var fn = function() {};\n" + + "Object.defineProperty(o1, 'p', {\n" + + " get: fn,\n" + + " configurable: true\n" + + "});\n" + + "var proxy1 = new Proxy(o1, {});\n" + + "var result = Object.getOwnPropertyDescriptor(proxy1, 'p');\n" + + "'[' + Object.getOwnPropertyNames(result) + ']'" + + "+ ' ' + result.enumerable" + + "+ ' ' + result.configurable" + + "+ ' ' + (result.get === fn)" + + "+ ' ' + (result.set === undefined)"; + testString("[get,set,enumerable,configurable] false true true true", js); + } + + @Test + public void isExtensible() { + String js = + "var o = {};\n" + + "var res = '';\n" + + "var handler = {\n" + + " isExtensible(target) {\n" + + " res += ' a ' + (target == o);\n" + + " return Reflect.isExtensible(target);" + + " },\n" + + " preventExtensions(target) {\n" + + " res += ' o ' + (target == o);\n" + + " }\n" + + " };\n" + + "var proxy1 = new Proxy(o, handler);\n" + + "var x = Object.isExtensible(proxy1);\n" + + "res += ' ' + x;\n" + + "res += ' ' + x;\n"; + testString(" a true true true", js); + } + + @Test + public void isExtensibleWithoutHandler() { + String js = + "var o1 = {};\n" + + "var proxy1 = new Proxy(o1, {});\n" + + "var result = '' + Object.isExtensible(o1) + '-' + Object.isExtensible(proxy1);\n" + + "Object.preventExtensions(proxy1);\n" + + "result += ' ' + Object.isExtensible(o1) + '-' + Object.isExtensible(proxy1);\n" + + "var o2 = Object.seal({});\n" + + "var proxy2 = new Proxy(o2, {});\n" + + "result += ' ' + Object.isExtensible(o2) + '-' + Object.isExtensible(proxy2);\n"; + + testString("true-true false-false false-false", js); + } + + @Test + public void preventExtensionsTrapReturnsNoBoolean() { + String js = + "var target = {};\n" + + "var p = new Proxy({}, {\n" + + " preventExtensions: function(t) {\n" + + " return 0;\n" + + " }\n" + + "});\n" + + "var res = '' + Reflect.preventExtensions(p);\n" + + "Object.preventExtensions(target);\n" + + "res += ' ' + Reflect.preventExtensions(p);\n"; + testString("false false", js); + } + + @Test + public void preventExtensionsTrapIsUndefined() { + String js = + "var target = {};\n" + + "var p = new Proxy(target, {});\n" + + "'' + Reflect.preventExtensions(p);"; + testString("true", js); + } + + @Test + public void ownKeys() { + String js = + "var o = { d: 42 };\n" + + "var res = '';\n" + + "var handler = {\n" + + " ownKeys(target) {\n" + + " res += (target == o);\n" + + " return Reflect.ownKeys(target);" + + " }\n" + + " };\n" + + "var proxy1 = new Proxy(o, handler);\n" + + "var x = Object.keys(proxy1);\n" + + "res += ' ' + x;\n"; + testString("true d", js); + } + + @Test + public void ownKeysTrapUndefined() { + String js = + "var target = {\n" + + " foo: 1,\n" + + " bar: 2\n" + + "};\n" + + "var p = new Proxy(target, {});\n" + + "var keys = Object.getOwnPropertyNames(p);\n" + + "'' + keys[0] + ' ' + keys[1] + ' ' + keys.length"; + testString("foo bar 2", js); + } + + @Test + public void ownKeysArrayInTrapResult() { + String js = + "var p = new Proxy({}, {\n" + + " ownKeys: function() {\n" + + " return [ [] ];\n" + + " }\n" + + "});\n" + + "try { Object.keys(p); } catch(e) { '' + e }\n"; + testString( + "TypeError: proxy [[OwnPropertyKeys]] must return an array with only string and symbol elements", + js); + } + + @Test + public void ownKeysWithoutHandler() { + String js = + "var o1 = {\n" + + " p1: 42,\n" + + " p2: 'one'\n" + + "};\n" + + "var a1 = [];\n" + + "var proxy1 = new Proxy(o1, {});\n" + + "var proxy2 = new Proxy(a1, {});\n" + + "'' + Object.keys(proxy1)" + + "+ ' ' + Object.keys(proxy2)"; + testString("p1,p2 ", js); + } + + @Test + public void ownKeysWithoutHandler2() { + String js = + "let s1 = Symbol.for('foo');\n" + + "let s2 = Symbol.for('bar');\n" + + "var o1 = {\n" + + " s1: 0,\n" + + " 'str': 0,\n" + + " 773: 0,\n" + + " '55': 0,\n" + + " 0: 0,\n" + + " '-1': 0,\n" + + " 8: 0,\n" + + " '6': 8,\n" + + " s2: 0,\n" + + " 'str2': 0\n" + + "};\n" + + "var a1 = [];\n" + + "var proxy1 = new Proxy(o1, {});\n" + + "'' + Object.keys(proxy1)"; + testString("0,6,8,55,773,s1,str,-1,s2,str2", js); + } + + @Test + public void ownKeysWithoutHandlerEmptyObj() { + String js = "var proxy1 = new Proxy({}, {});\n" + "'' + Object.keys(proxy1).length"; + testString("0", js); + } + + @Test + public void ownKeysWithoutHandlerDeleteObj() { + String js = + "var o = { d: 42 };\n" + + "delete o.d;\n" + + "var proxy1 = new Proxy(o, {});\n" + + "'' + Object.keys(proxy1).length"; + testString("0", js); + } + + @Test + public void ownKeysWithoutHandlerEmptyArray() { + String js = "var proxy1 = new Proxy([], {});\n" + "'' + Object.keys(proxy1)"; + testString("", js); + } + + @Test + public void ownKeysWithoutHandlerArray() { + String js = "var proxy1 = new Proxy([, , 2], {});\n" + "'' + Object.keys(proxy1)"; + testString("2", js); + } + + @Test + public void ownKeysWithoutHandlerNotEnumerable() { + String js = + "var o = {};\n" + + "Object.defineProperty(o, 'p1', { value: 42, enumerable: false });\n" + + "Object.defineProperty(o, 'p2', { get: function() {}, enumerable: false });\n" + + "var proxy1 = new Proxy(o, {});\n" + + "'' + Object.keys(proxy1)"; + testString("", js); + } + + @Test + public void hasTargetNotExtensible() { + String js = + "var target = {};\n" + + "var handler = {\n" + + " has: function(t, prop) {\n" + + " return 0;\n" + + " }\n" + + "};\n" + + "var p = new Proxy(target, handler);\n" + + "Object.defineProperty(target, 'attr', {\n" + + " configurable: true,\n" + + " extensible: false,\n" + + " value: 1\n" + + "});\n" + + "Object.preventExtensions(target);\n" + + "try { 'attr' in p; } catch(e) { '' + e }\n"; + + testString( + "TypeError: proxy can't report an existing own property 'attr' as non-existent on a non-extensible object", + js); + } + + @Test + public void hasHandlerCallsIn() { + String js = + "var _handler, _target, _prop;\n" + + "var target = {};\n" + + "var handler = {\n" + + " has: function(t, prop) {\n" + + " _handler = this;\n" + + " _target = t;\n" + + " _prop = prop;\n" + + " return prop in t;\n" + + " }\n" + + "};\n" + + "var p = new Proxy(target, handler);\n" + + "'' + (_handler === handler)\n" + + "+ ' ' + (_target === target)" + + "+ ' ' + ('attr' === _prop)" + + "+ ' ' + ('attr' in p)"; + + testString("false false false false", js); + } + + @Test + public void hasWithoutHandler() { + String js = + "var o1 = { p: 42 }\n" + + "var proxy1 = new Proxy(o1, {});\n" + + "'' + ('p' in proxy1)" + + "+ ' ' + ('p2' in proxy1)" + + "+ ' ' + ('toString' in proxy1)"; + testString("true false true", js); + } + + @Test + public void hasSymbolWithoutHandler() { + String js = + "var s1 = Symbol('1');\n" + + "var s2 = Symbol('1');\n" + + "var o = {};\n" + + "o[s1] = 42;\n" + + "var proxy1 = new Proxy(o, {});\n" + + "'' + (s1 in proxy1)" + + "+ ' ' + (2 in proxy1)"; + testString("true false", js); + } + + @Test + public void getTrapIsNullTargetIsProxy() { + String js = + "var stringTarget = new Proxy(new String('str'), {});\n" + + "var stringProxy = new Proxy(stringTarget, {\n" + + " get: null,\n" + + "});\n" + + "'' + stringProxy.length" + + " + ' ' + stringProxy[0]" + + " + ' ' + stringProxy[4];"; + testString("3 s undefined", js); + } + + @Test + public void getTrapIsNullTargetIsProxy2() { + String js = + "var sym = Symbol();\n" + + "var target = new Proxy({}, {\n" + + " get: function(_target, key) {\n" + + " switch (key) {\n" + + " case sym: return 1;\n" + + " case \"10\": return 2;\n" + + " case \"foo\": return 3;\n" + + " }\n" + + " },\n" + + "});\n" + + "var proxy = new Proxy(target, {\n" + + " get: null,\n" + + "});\n" + + "'' + proxy[sym]" + + " + ' ' + proxy[10]" + + " + ' ' + Object.create(proxy).foo" + + " + ' ' + proxy.bar;"; + testString("1 2 3 undefined", js); + } + + @Test + public void setTrap() { + String js = + "var res = '';\n" + + "var proxy = new Proxy({}, {\n" + + " set(obj, prop, value) {\n" + + " res += value + ' ' + (value instanceof Array);\n" + + " obj[prop] = value;\n" + + " return true;\n" + + " },\n" + + "});\n" + + "proxy.foo = [1, 2, 3];\n" + + "res"; + + testString("1,2,3 true", js); + } + + @Test + public void getPropertyByIntWithoutHandler() { + String js = "var a = ['zero', 'one'];" + "var proxy1 = new Proxy(a, {});\n" + "proxy1[1];"; + testString("one", js); + } + + @Test + public void getProperty() { + String js = + "var o = {};\n" + + "o.p1 = 'value 1';\n" + + "var proxy1 = new Proxy(o, { get: function(t, prop) {\n" + + " return t[prop] + '!';\n" + + " }});\n" + + "var result = ''\n;" + + "result += proxy1.p1;\n" + + "Object.defineProperty(o, 'p3', { get: function() { return 'foo'; } });\n" + + "result += ', ' + proxy1.p3;\n" + + "var o2 = Object.create({ p: 42 });\n" + + "var proxy2 = new Proxy(o2, {});\n" + + "result += ', ' + proxy2.p;\n" + + "result += ', ' + proxy2.u;\n"; + + testString("value 1!, foo!, 42, undefined", js); + } + + @Test + public void getPropertyParameters() { + String js = + "var _target, _handler, _prop, _receiver;\n" + + "var target = {\n" + + " attr: 1\n" + + "};\n" + + "var handler = {\n" + + " get: function(t, prop, receiver) {\n" + + " _handler = this;\n" + + " _target = t;\n" + + " _prop = prop;\n" + + " _receiver = receiver;\n" + + " }\n" + + "};\n" + + "var p = new Proxy(target, handler);\r\n" + + "p.attr;\n" + + "var res = '' + (_handler === handler)\n" + + "+ ' ' + (_target === target)" + + "+ ' ' + (_prop == 'attr')" + + "+ ' ' + (_receiver === p);" + + "_prop = null;\n" + + "p['attr'];\n" + + "res + ' ' + (_prop == 'attr')"; + + testString("true true true true true", js); + } + + @Test + public void getPropertyWithoutHandler() { + String js = + "var o = {};\n" + + "o.p1 = 'value 1';\n" + + "var proxy1 = new Proxy(o, {});\n" + + "var result = ''\n;" + + "result += proxy1.p1;\n" + + "Object.defineProperty(o, 'p2', { get: undefined });\n" + + "result += ', ' + proxy1.p2;\n" + + "Object.defineProperty(o, 'p3', { get: function() { return 'foo'; } });\n" + + "result += ', ' + proxy1.p3;\n" + + "var o2 = Object.create({ p: 42 });\n" + + "var proxy2 = new Proxy(o2, {});\n" + + "result += ', ' + proxy2.p;\n" + + "result += ', ' + proxy2.u;\n"; + + testString("value 1, undefined, foo, 42, undefined", js); + } + + @Test + public void getPrototypeOfNull() { + String js = + "var plainObjectTarget = new Proxy(Object.create(null), {});\n" + + "var plainObjectProxy = new Proxy(plainObjectTarget, {\n" + + " getPrototypeOf: null,\n" + + "});\n" + + "'' + Object.getPrototypeOf(plainObjectProxy);\n"; + testString("null", js); + } + + @Test + public void setPrototypeOfWithoutHandler() { + String js = + "var o1 = {};\n" + + "var result = '';\n" + + "result += Reflect.setPrototypeOf(o1, Object.prototype);\n" + + "result += ' ' + Reflect.setPrototypeOf(o1, null);\n" + + "var o2 = {};\n" + + "result += ' ' + Reflect.setPrototypeOf(Object.freeze(o2), null);\n"; + testString("true true false", js); + } + + @Test + public void setPrototypeOfCycleWithoutHandler() { + String js = "var o1 = {};\n" + "'' + Reflect.setPrototypeOf(o1, o1);\n"; + testString("false", js); + } + + @Test + public void setPrototypeOfCycleComplexWithoutHandler() { + String js = + "var o1 = {};\n" + + "var o2 = {};\n" + + "var o3 = {};\n" + + "'' + Reflect.setPrototypeOf(o1, o2)" + + "+ ' ' + Reflect.setPrototypeOf(o2, o3)" + + "+ ' ' + Reflect.setPrototypeOf(o3, o1)"; + testString("true true false", js); + } + + @Test + public void setPrototypeOfSameWithoutHandler() { + String js = + "var o1 = {};\n" + + "Object.preventExtensions(o1);\n" + + "var o2 = Object.create(null);\n" + + "Object.preventExtensions(o2);\n" + + "var proto = {};\n" + + "var o3 = Object.create(proto);\n" + + "Object.preventExtensions(o3);\n" + + "'' + Reflect.setPrototypeOf(o1, Object.prototype)" + + "+ ' ' + Reflect.setPrototypeOf(o2, null)" + + "+ ' ' + Reflect.setPrototypeOf(o3, proto)"; + testString("true true true", js); + } + + @Test + public void typeof() { + testString("object", "typeof new Proxy({}, {})"); + testString("function", "typeof new Proxy(function() {}, {})"); + } + + @Test + public void typeofRevocable() { + testString("object", "var rev = Proxy.revocable({}, {}); rev.revoke(); typeof rev.proxy"); + testString( + "function", + "var rev = Proxy.revocable(function() {}, {}); rev.revoke(); typeof rev.proxy"); + + String js = + "var revocableTarget = Proxy.revocable(function() {}, {});\n" + + "revocableTarget.revoke();\n" + + "var revocable = Proxy.revocable(revocableTarget.proxy, {});\n" + + "'' + typeof revocable.proxy;\n"; + testString("function", js); + } + + @Test + public void revocableFunctionIsAnonymous() { + String js = + "var rev = Proxy.revocable({}, {}).revoke;\n" + + "var desc = Object.getOwnPropertyDescriptor(rev, 'name');\n" + + "'' + desc.name + ' ' + desc.value " + + "+ ' ' + desc.writable " + + "+ ' ' + desc.enumerable " + + "+ ' ' + desc.configurable"; + testString("undefined false false true", js); + } + + @Test + public void revocableGetPrototypeOf() { + testString( + "TypeError: Illegal operation attempted on a revoked proxy", + "var rev = Proxy.revocable({}, {}); rev.revoke(); " + + "try { Object.getPrototypeOf(rev.proxy); } catch(e) { '' + e }"); + } + + private static void testString(String expected, String js) { + Utils.runWithAllOptimizationLevels( + cx -> { + cx.setLanguageVersion(Context.VERSION_ES6); + final Scriptable scope = cx.initStandardObjects(); + + Object result = cx.evaluateString(scope, js, "test", 1, null); + assertEquals(expected, result); + + return null; + }); + } + + private static void testDouble(double expected, String js) { + Utils.runWithAllOptimizationLevels( + cx -> { + cx.setLanguageVersion(Context.VERSION_ES6); + final Scriptable scope = cx.initStandardObjects(); + + Object result = cx.evaluateString(scope, js, "test", 1, null); + assertEquals(expected, ((Double) result).doubleValue(), 0.00001); + + return null; + }); + } +} diff --git a/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeReflectTest.java b/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeReflectTest.java new file mode 100644 index 0000000000..619cd4186b --- /dev/null +++ b/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeReflectTest.java @@ -0,0 +1,501 @@ +package org.mozilla.javascript.tests.es6; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.mozilla.javascript.Context; +import org.mozilla.javascript.Scriptable; +import org.mozilla.javascript.tests.Utils; + +public class NativeReflectTest { + + @Test + public void testToString() { + testString("[object Reflect]", "Reflect.toString()"); + } + + @Test + public void apply() { + testDouble(1.0, "Reflect.apply(Math.floor, undefined, [1.75])"); + testString( + "hello", + "Reflect.apply(String.fromCharCode, undefined, [104, 101, 108, 108, 111])"); + testInt(4, "Reflect.apply(RegExp.prototype.exec, /ab/, ['confabulation']).index"); + testString("i", "Reflect.apply(''.charAt, 'ponies', [3])"); + } + + @Test + public void applyString() { + testString("foo", "Reflect.apply(String.prototype.toString, 'foo', [])"); + testString("oo", "Reflect.apply(String.prototype.substring, 'foo', [1])"); + } + + @Test + public void applyNumber() { + testString("1.234567e+3", "Reflect.apply(Number.prototype.toExponential, 1234.567, [])"); + testString("1.23e+3", "Reflect.apply(Number.prototype.toExponential, 1234.567, [2])"); + } + + @Test + public void applyBoolean() { + testString("true", "Reflect.apply(Boolean.prototype.toString, true, [])"); + testString("false", "Reflect.apply(Boolean.prototype.toString, false, [])"); + } + + @Test + public void applyDetails() { + String js = + "var o = {};\n" + + "var count = 0;\n" + + "var results, args;\n" + + "function fn() {\n" + + " count++;\n" + + " results = {\n" + + " thisArg: this,\n" + + " args: arguments\n" + + " };\n" + + "}\n" + + "Reflect.apply(fn, o, ['arg1', 2, , null]);\n" + + "'' + count " + + "+ ' ' + (results.thisArg === o)" + + "+ ' ' + results.args.length" + + "+ ' ' + results.args[0]" + + "+ ' ' + results.args[1]" + + "+ ' ' + results.args[2]" + + "+ ' ' + results.args[3]"; + testString("1 true 4 arg1 2 undefined null", js); + } + + @Test + public void applyMissingArgs() { + String js = "try {\n" + " Reflect.apply();\n" + "} catch(e) {\n" + " '' + e;\n" + "}"; + testString( + "TypeError: Reflect.apply: At least 3 arguments required, but only 0 passed", js); + } + + @Test + public void applyTargetNotFunction() { + String js = + "try {\n" + + " Reflect.apply({}, undefined, [1.75]);\n" + + "} catch(e) {\n" + + " '' + e;\n" + + "}"; + testString("TypeError: [object Object] is not a function, it is object.", js); + } + + @Test + public void applyArgumentsListNotFunction() { + String js = + "var s1 = Symbol('1');" + + "try {\n" + + " Reflect.apply(Math.floor, undefined, s1);\n" + + "} catch(e) {\n" + + " '' + e;\n" + + "}"; + testString("TypeError: Expected argument of type object, but instead had type symbol", js); + } + + @Test + public void construct() { + String js = + "var d = Reflect.construct(Date, [1776, 6, 4]);\n" + + "'' + (d instanceof Date) + ' ' + d.getFullYear();"; + testString("true 1776", js); + } + + @Test + public void constructNewTarget() { + String js = + "var o = {};\n" + + "var internPrototype;\n" + + "function fn() {\n" + + " this.o = o;\n" + + " internPrototype = Object.getPrototypeOf(this);\n" + + "}\n" + + "var result = Reflect.construct(fn, [], Array);\n" + + "'' + (Object.getPrototypeOf(result) === Array.prototype)" + + " + ' ' + (internPrototype === Array.prototype)" + + " + ' ' + (result.o === o)"; + testString("true true true", js); + } + + @Test + public void constructNoConstructorNumber() { + String js = + "try {\n" + + " Reflect.construct(function() {}, [], 1);\n" + + "} catch(e) {\n" + + " '' + e;\n" + + "}"; + testString("TypeError: \"number\" is not a constructor.", js); + } + + @Test + public void constructNoConstructorNull() { + String js = + "try {\n" + + " Reflect.construct(function() {}, [], null);\n" + + "} catch(e) {\n" + + " '' + e;\n" + + "}"; + testString("TypeError: \"object\" is not a constructor.", js); + } + + @Test + public void constructNoConstructorObject() { + String js = + "try {\n" + + " Reflect.construct(function() {}, [], {});\n" + + "} catch(e) {\n" + + " '' + e;\n" + + "}"; + testString("TypeError: \"object\" is not a constructor.", js); + } + + @Test + public void constructNoConstructorFunction() { + String js = + "try {\n" + + " Reflect.construct(function() {}, [], Date.now);\n" + + "} catch(e) {\n" + + " '' + e;\n" + + "}"; + // testString("TypeError: \"object\" is not a constructor.", js); + // found no way to check a function for constructor + } + + @Test + public void constructorArgs() { + final String script = + " var res = '';\n" + + "function foo(a, b) {\n" + + " res += 'foo - ';\n" + + " for (let i = 0; i < arguments.length; i++) {\n" + + " res += arguments[i] + ' ';\n" + + " }\n" + + "}\n" + + "Reflect.construct(foo, [1, 2]);\n" + + "res;"; + + testString("foo - 1 2 ", script); + } + + @Test + public void constructorArgsWithTarget() { + final String script = + " var res = '';\n" + + "function foo(a, b) {\n" + + " res += 'foo - ';\n" + + " for (let i = 0; i < arguments.length; i++) {\n" + + " res += arguments[i] + ' ';\n" + + " }\n" + + "}\n" + + "function bar(a, b) {\n" + + " res += 'bar - ';\n" + + " for (let i = 0; i < arguments.length; i++) {\n" + + " res += arguments[i] + ' ';\n" + + " }\n" + + "}\n" + + "Reflect.construct(foo, [6, 7, 8], bar);\n" + + "res;"; + + testString("foo - 6 7 8 ", script); + } + + @Test + public void defineProperty() { + String js = + "var o = {};\n" + "'' + Reflect.defineProperty(o, 'p', { value: 42 }) + ' ' + o.p;"; + testString("true 42", js); + } + + @Test + public void definePropertyWithoutValue() { + String js = + "var o = {};\n" + + "'' + Reflect.defineProperty(o, 'p', {})" + + "+ ' ' + Reflect.has(o, 'p')" + + "+ ' ' + o.p;"; + testString("true true undefined", js); + } + + @Test + public void definePropertyFreezed() { + String js = + "var o = {};\n" + + "Object.freeze(o);\n" + + "'' + Reflect.defineProperty(o, 'p', { value: 42 }) + ' ' + o.p;"; + testString("false undefined", js); + } + + @Test + public void deleteProperty() { + String js = + "var o = { p: 42 };\n" + + "'' + Reflect.deleteProperty(o, 'p')" + + "+ ' ' + Reflect.has(o, 'p')" + + "+ ' ' + o.p;"; + testString("true false undefined", js); + } + + @Test + public void getOwnPropertyDescriptor() { + String js = + "var o1 = {};\n" + + "var fn = function() {};\n" + + "Object.defineProperty(o1, 'p', {\n" + + " get: fn,\n" + + " configurable: true\n" + + "});\n" + + "var result = Reflect.getOwnPropertyDescriptor(o1, 'p');\n" + + "'[' + Object.getOwnPropertyNames(result) + ']'" + + "+ ' ' + result.enumerable" + + "+ ' ' + result.configurable" + + "+ ' ' + (result.get === fn)" + + "+ ' ' + (result.set === undefined)"; + testString("[get,set,enumerable,configurable] false true true true", js); + } + + @Test + public void isExtensible() { + String js = + "var o1 = {};\n" + + "var result = '' + Reflect.isExtensible(o1);\n" + + "Reflect.preventExtensions(o1);\n" + + "result += ' ' + Reflect.isExtensible(o1);\n" + + "var o2 = Object.seal({});\n" + + "result += ' ' + Reflect.isExtensible(o2);\n"; + + testString("true false false", js); + } + + @Test + public void ownKeys() { + String js = + "var o1 = {\n" + + " p1: 42,\n" + + " p2: 'one'\n" + + "};\n" + + "var a1 = [];\n" + + "'' + Reflect.ownKeys(o1)" + + "+ ' ' + Reflect.ownKeys(a1)"; + testString("p1,p2 length", js); + } + + @Test + public void ownKeys2() { + String js = + "let s1 = Symbol.for('foo');\n" + + "let s2 = Symbol.for('bar');\n" + + "var o1 = {\n" + + " s1: 0,\n" + + " 'str': 0,\n" + + " 773: 0,\n" + + " '55': 0,\n" + + " 0: 0,\n" + + " '-1': 0,\n" + + " 8: 0,\n" + + " '6': 8,\n" + + " s2: 0,\n" + + " 'str2': 0\n" + + "};\n" + + "var a1 = [];\n" + + "'' + Reflect.ownKeys(o1)"; + testString("0,6,8,55,773,s1,str,-1,s2,str2", js); + } + + @Test + public void ownKeysEmptyObj() { + String js = "'' + Reflect.ownKeys({}).length"; + testString("0", js); + } + + @Test + public void ownKeysDeleteObj() { + String js = "var o = { d: 42 };\n" + "delete o.d;\n" + "'' + Reflect.ownKeys(o).length"; + testString("0", js); + } + + @Test + public void ownKeysEmptyArray() { + String js = "'' + Reflect.ownKeys([])"; + testString("length", js); + } + + @Test + public void ownKeysArray() { + String js = "'' + Reflect.ownKeys([, , 2])"; + testString("2,length", js); + } + + @Test + public void ownKeysNotEnumerable() { + String js = + "var o = {};\n" + + "Object.defineProperty(o, 'p1', { value: 42, enumerable: false });\n" + + "Object.defineProperty(o, 'p2', { get: function() {}, enumerable: false });\n" + + "'' + Reflect.ownKeys(o)"; + testString("p1,p2", js); + } + + @Test + public void has() { + String js = + "var o1 = { p: 42 }\n" + + "'' + Reflect.has(o1, 'p')" + + "+ ' ' + Reflect.has(o1, 'p2')" + + "+ ' ' + Reflect.has(o1, 'toString')"; + testString("true false true", js); + } + + @Test + public void hasSymbol() { + String js = + "var s1 = Symbol('1');\n" + + "var s2 = Symbol('1');\n" + + "var o = {};\n" + + "o[s1] = 42;\n" + + "'' + Reflect.has(o, s1)" + + "+ ' ' + Reflect.has(o, 2)"; + testString("true false", js); + } + + @Test + public void hasProto() { + String js = "var o1 = { p: 42 }\n" + "'' + typeof Reflect.has.__proto__"; + testString("function", js); + } + + @Test + public void getOwnPropertyDescriptorSymbol() { + String js = + "var s = Symbol('sym');\n" + + "var o = {};\n" + + "o[s] = 42;\n" + + "var result = Reflect.getOwnPropertyDescriptor(o, s);\n" + + "'' + result.value" + + "+ ' ' + result.enumerable" + + "+ ' ' + result.configurable" + + "+ ' ' + result.writable"; + testString("42 true true true", js); + } + + @Test + public void getOwnPropertyDescriptorUndefinedProperty() { + String js = + "var o = Object.create({p: 1});\n" + + "var result = Reflect.getOwnPropertyDescriptor(o, 'p');\n" + + "'' + (result === undefined)"; + testString("true", js); + } + + @Test + public void getPropertyByInt() { + String js = "var a = ['zero', 'one']\n" + "Reflect.get(a, 1);"; + testString("one", js); + } + + @Test + public void getProperty() { + String js = + "var o = {};\n" + + "o.p1 = 'value 1';\n" + + "var result = '';" + + "result += Reflect.get(o, 'p1');\n" + + "Object.defineProperty(o, 'p2', { get: undefined });\n" + + "result += ', ' + Reflect.get(o, 'p2');\n" + + "Object.defineProperty(o, 'p3', { get: function() { return 'foo'; } });\n" + + "result += ', ' + Reflect.get(o, 'p3');\n" + + "var o2 = Object.create({ p: 42 });\n" + + "result += ', ' + Reflect.get(o2, 'p');\n" + + "result += ', ' + Reflect.get(o2, 'u');\n"; + + testString("value 1, undefined, foo, 42, undefined", js); + } + + @Test + public void setPrototypeOf() { + String js = + "var o1 = {};\n" + + "var result = '';\n" + + "result += Reflect.setPrototypeOf(o1, Object.prototype);\n" + + "result += ' ' + Reflect.setPrototypeOf(o1, null);\n" + + "var o2 = {};\n" + + "result += ' ' + Reflect.setPrototypeOf(Object.freeze(o2), null);\n"; + testString("true true false", js); + } + + @Test + public void setPrototypeOfCycle() { + String js = "var o1 = {};\n" + "'' + Reflect.setPrototypeOf(o1, o1);\n"; + testString("false", js); + } + + @Test + public void setPrototypeOfCycleComplex() { + String js = + "var o1 = {};\n" + + "var o2 = {};\n" + + "var o3 = {};\n" + + "'' + Reflect.setPrototypeOf(o1, o2)" + + "+ ' ' + Reflect.setPrototypeOf(o2, o3)" + + "+ ' ' + Reflect.setPrototypeOf(o3, o1)"; + testString("true true false", js); + } + + @Test + public void setPrototypeOfSame() { + String js = + "var o1 = {};\n" + + "Object.preventExtensions(o1);\n" + + "var o2 = Object.create(null);\n" + + "Object.preventExtensions(o2);\n" + + "var proto = {};\n" + + "var o3 = Object.create(proto);\n" + + "Object.preventExtensions(o3);\n" + + "'' + Reflect.setPrototypeOf(o1, Object.prototype)" + + "+ ' ' + Reflect.setPrototypeOf(o2, null)" + + "+ ' ' + Reflect.setPrototypeOf(o3, proto)"; + testString("true true true", js); + } + + private static void testString(String expected, String js) { + Utils.runWithAllOptimizationLevels( + cx -> { + cx.setLanguageVersion(Context.VERSION_ES6); + final Scriptable scope = cx.initStandardObjects(); + + Object result = cx.evaluateString(scope, js, "test", 1, null); + assertEquals(expected, result); + + return null; + }); + } + + private static void testDouble(double expected, String js) { + Utils.runWithAllOptimizationLevels( + cx -> { + cx.setLanguageVersion(Context.VERSION_ES6); + final Scriptable scope = cx.initStandardObjects(); + + Object result = cx.evaluateString(scope, js, "test", 1, null); + assertEquals(expected, ((Double) result).doubleValue(), 0.00001); + + return null; + }); + } + + private static void testInt(int expected, String js) { + Utils.runWithAllOptimizationLevels( + cx -> { + cx.setLanguageVersion(Context.VERSION_ES6); + final Scriptable scope = cx.initStandardObjects(); + + Object result = cx.evaluateString(scope, js, "test", 1, null); + assertEquals(expected, ((Integer) result).intValue()); + + return null; + }); + } +} diff --git a/tests/testsrc/test262.properties b/tests/testsrc/test262.properties index 5e9ffee1f3..109d018fff 100644 --- a/tests/testsrc/test262.properties +++ b/tests/testsrc/test262.properties @@ -24,74 +24,65 @@ harness 23/115 (20.0%) asyncHelpers-throwsAsync-same-realm.js {unsupported: [async]} asyncHelpers-throwsAsync-single-arg.js {unsupported: [async]} compare-array-arguments.js - isConstructor.js {unsupported: [Reflect.construct]} + isConstructor.js nativeFunctionMatcher.js -built-ins/Array 383/3074 (12.46%) +built-ins/Array 365/3074 (11.87%) fromAsync 94/94 (100.0%) from/calling-from-valid-1-noStrict.js non-strict Spec pretty clearly says this should be undefined from/elements-deleted-after.js Checking to see if length changed, but spec says it should not from/iter-map-fn-this-non-strict.js non-strict Error propagation needs work in general from/iter-set-elem-prop-err.js Error propagation needs work in general from/iter-set-elem-prop-non-writable.js - from/not-a-constructor.js {unsupported: [Reflect.construct]} + from/not-a-constructor.js from/proto-from-ctor-realm.js from/source-object-constructor.js Error propagation needs work in general from/source-object-length-set-elem-prop-err.js from/source-object-length-set-elem-prop-non-writable.js - isArray/not-a-constructor.js {unsupported: [Reflect.construct]} - isArray/proxy.js {unsupported: [Proxy]} - isArray/proxy-revoked.js {unsupported: [Proxy]} - length/define-own-prop-length-coercion-order.js {unsupported: [Reflect]} - length/define-own-prop-length-coercion-order-set.js {unsupported: [Reflect, Reflect.set]} + isArray/not-a-constructor.js + length/define-own-prop-length-coercion-order.js + length/define-own-prop-length-coercion-order-set.js length/define-own-prop-length-error.js - length/define-own-prop-length-no-value-order.js {unsupported: [Reflect]} + length/define-own-prop-length-no-value-order.js length/define-own-prop-length-overflow-order.js - of/not-a-constructor.js {unsupported: [Reflect.construct]} + of/not-a-constructor.js of/proto-from-ctor-realm.js - of/return-abrupt-from-data-property-using-proxy.js {unsupported: [Proxy]} prototype/at/coerced-index-resize.js {unsupported: [resizable-arraybuffer]} prototype/at/typed-array-resizable-buffer.js {unsupported: [resizable-arraybuffer]} - prototype/concat/arg-length-exceeding-integer-limit.js {unsupported: [Proxy]} prototype/concat/Array.prototype.concat_large-typed-array.js new prototype/concat/Array.prototype.concat_non-array.js prototype/concat/Array.prototype.concat_small-typed-array.js prototype/concat/create-ctor-non-object.js prototype/concat/create-ctor-poisoned.js prototype/concat/create-proto-from-ctor-realm-non-array.js - prototype/concat/create-proxy.js {unsupported: [Proxy]} - prototype/concat/create-revoked-proxy.js {unsupported: [Proxy]} + prototype/concat/create-proxy.js prototype/concat/create-species.js prototype/concat/create-species-abrupt.js - prototype/concat/create-species-non-ctor.js {unsupported: [Reflect.construct]} + prototype/concat/create-species-non-ctor.js prototype/concat/create-species-non-extensible.js prototype/concat/create-species-non-extensible-spreadable.js prototype/concat/create-species-poisoned.js prototype/concat/create-species-with-non-configurable-property.js prototype/concat/create-species-with-non-configurable-property-spreadable.js prototype/concat/is-concat-spreadable-get-order.js - prototype/concat/is-concat-spreadable-is-array-proxy-revoked.js {unsupported: [Proxy]} - prototype/concat/is-concat-spreadable-proxy.js {unsupported: [Proxy]} - prototype/concat/is-concat-spreadable-proxy-revoked.js {unsupported: [Proxy]} - prototype/concat/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/concat/is-concat-spreadable-is-array-proxy-revoked.js + prototype/concat/not-a-constructor.js prototype/copyWithin/coerced-values-start-change-start.js prototype/copyWithin/coerced-values-start-change-target.js - prototype/copyWithin/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/copyWithin/not-a-constructor.js prototype/copyWithin/resizable-buffer.js {unsupported: [resizable-arraybuffer]} - prototype/copyWithin/return-abrupt-from-delete-proxy-target.js {unsupported: [Proxy]} prototype/copyWithin/return-abrupt-from-delete-target.js non-strict Not throwing properly on unwritable - prototype/copyWithin/return-abrupt-from-has-start.js {unsupported: [Proxy]} - prototype/entries/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/entries/not-a-constructor.js prototype/entries/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/entries/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/entries/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/every/15.4.4.16-5-1-s.js non-strict prototype/every/callbackfn-resize-arraybuffer.js {unsupported: [resizable-arraybuffer]} - prototype/every/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/every/not-a-constructor.js prototype/every/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/every/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/every/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} - prototype/fill/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/fill/not-a-constructor.js prototype/fill/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/fill/typed-array-resize.js {unsupported: [resizable-arraybuffer]} prototype/filter/15.4.4.20-5-1-s.js non-strict @@ -99,44 +90,43 @@ built-ins/Array 383/3074 (12.46%) prototype/filter/create-ctor-non-object.js prototype/filter/create-ctor-poisoned.js prototype/filter/create-proto-from-ctor-realm-non-array.js - prototype/filter/create-proxy.js {unsupported: [Proxy]} - prototype/filter/create-revoked-proxy.js {unsupported: [Proxy]} + prototype/filter/create-proxy.js prototype/filter/create-species.js prototype/filter/create-species-abrupt.js - prototype/filter/create-species-non-ctor.js {unsupported: [Reflect.construct]} + prototype/filter/create-species-non-ctor.js prototype/filter/create-species-poisoned.js - prototype/filter/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/filter/not-a-constructor.js prototype/filter/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/filter/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/filter/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/filter/target-array-non-extensible.js prototype/filter/target-array-with-non-configurable-property.js prototype/findIndex/callbackfn-resize-arraybuffer.js {unsupported: [resizable-arraybuffer]} - prototype/findIndex/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/findIndex/not-a-constructor.js prototype/findIndex/predicate-call-this-strict.js strict prototype/findIndex/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/findIndex/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/findIndex/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/findLastIndex/callbackfn-resize-arraybuffer.js {unsupported: [resizable-arraybuffer]} - prototype/findLastIndex/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/findLastIndex/not-a-constructor.js prototype/findLastIndex/predicate-call-this-strict.js strict prototype/findLastIndex/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/findLastIndex/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/findLastIndex/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/findLast/callbackfn-resize-arraybuffer.js {unsupported: [resizable-arraybuffer]} - prototype/findLast/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/findLast/not-a-constructor.js prototype/findLast/predicate-call-this-strict.js strict prototype/findLast/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/findLast/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/findLast/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/find/callbackfn-resize-arraybuffer.js {unsupported: [resizable-arraybuffer]} - prototype/find/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/find/not-a-constructor.js prototype/find/predicate-call-this-strict.js strict prototype/find/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/find/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/find/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/flatMap/array-like-objects-poisoned-length.js - prototype/flatMap/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/flatMap/not-a-constructor.js prototype/flatMap/proxy-access-count.js prototype/flatMap/target-array-non-extensible.js prototype/flatMap/target-array-with-non-configurable-property.js @@ -147,68 +137,65 @@ built-ins/Array 383/3074 (12.46%) prototype/flatMap/this-value-ctor-object-species-custom-ctor-poisoned-throws.js prototype/flatMap/thisArg-argument.js strict prototype/flat/non-object-ctor-throws.js - prototype/flat/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/flat/not-a-constructor.js prototype/flat/proxy-access-count.js prototype/flat/target-array-non-extensible.js prototype/flat/target-array-with-non-configurable-property.js prototype/forEach/15.4.4.18-5-1-s.js non-strict prototype/forEach/callbackfn-resize-arraybuffer.js {unsupported: [resizable-arraybuffer]} - prototype/forEach/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/forEach/not-a-constructor.js prototype/forEach/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/forEach/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/forEach/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/includes/coerced-searchelement-fromindex-resize.js {unsupported: [resizable-arraybuffer]} - prototype/includes/get-prop.js {unsupported: [Proxy]} - prototype/includes/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/includes/not-a-constructor.js prototype/includes/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/includes/resizable-buffer-special-float-values.js {unsupported: [resizable-arraybuffer]} - prototype/indexOf/calls-only-has-on-prototype-after-length-zeroed.js {unsupported: [Proxy]} + prototype/indexOf/calls-only-has-on-prototype-after-length-zeroed.js prototype/indexOf/coerced-searchelement-fromindex-grow.js {unsupported: [resizable-arraybuffer]} prototype/indexOf/coerced-searchelement-fromindex-shrink.js {unsupported: [resizable-arraybuffer]} prototype/indexOf/length-zero-returns-minus-one.js - prototype/indexOf/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/indexOf/not-a-constructor.js prototype/indexOf/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/indexOf/resizable-buffer-special-float-values.js {unsupported: [resizable-arraybuffer]} prototype/join/coerced-separator-grow.js {unsupported: [resizable-arraybuffer]} prototype/join/coerced-separator-shrink.js {unsupported: [resizable-arraybuffer]} - prototype/join/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/join/not-a-constructor.js prototype/join/resizable-buffer.js {unsupported: [resizable-arraybuffer]} - prototype/keys/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/keys/not-a-constructor.js prototype/keys/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/keys/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/keys/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} - prototype/lastIndexOf/calls-only-has-on-prototype-after-length-zeroed.js {unsupported: [Proxy]} + prototype/lastIndexOf/calls-only-has-on-prototype-after-length-zeroed.js prototype/lastIndexOf/coerced-position-grow.js {unsupported: [resizable-arraybuffer]} prototype/lastIndexOf/coerced-position-shrink.js {unsupported: [resizable-arraybuffer]} prototype/lastIndexOf/length-zero-returns-minus-one.js - prototype/lastIndexOf/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/lastIndexOf/not-a-constructor.js prototype/lastIndexOf/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/map/15.4.4.19-5-1-s.js non-strict prototype/map/callbackfn-resize-arraybuffer.js {unsupported: [resizable-arraybuffer]} prototype/map/create-ctor-non-object.js prototype/map/create-ctor-poisoned.js prototype/map/create-proto-from-ctor-realm-non-array.js - prototype/map/create-proxy.js {unsupported: [Proxy]} - prototype/map/create-revoked-proxy.js {unsupported: [Proxy]} + prototype/map/create-proxy.js prototype/map/create-species.js prototype/map/create-species-abrupt.js - prototype/map/create-species-non-ctor.js {unsupported: [Reflect.construct]} + prototype/map/create-species-non-ctor.js prototype/map/create-species-poisoned.js - prototype/map/create-species-undef-invalid-len.js {unsupported: [Proxy]} - prototype/map/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/map/not-a-constructor.js prototype/map/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/map/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/map/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/map/target-array-non-extensible.js prototype/map/target-array-with-non-configurable-property.js - prototype/pop/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/pop/not-a-constructor.js prototype/pop/set-length-array-is-frozen.js prototype/pop/set-length-array-length-is-non-writable.js prototype/pop/set-length-zero-array-is-frozen.js prototype/pop/set-length-zero-array-length-is-non-writable.js prototype/pop/throws-with-string-receiver.js prototype/push/length-near-integer-limit-set-failure.js non-strict - prototype/push/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/push/not-a-constructor.js prototype/push/S15.4.4.7_A2_T2.js incorrect length handling prototype/push/set-length-array-is-frozen.js prototype/push/set-length-array-length-is-non-writable.js @@ -218,20 +205,20 @@ built-ins/Array 383/3074 (12.46%) prototype/push/throws-with-string-receiver.js prototype/reduceRight/15.4.4.22-9-c-ii-4-s.js non-strict prototype/reduceRight/callbackfn-resize-arraybuffer.js {unsupported: [resizable-arraybuffer]} - prototype/reduceRight/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/reduceRight/not-a-constructor.js prototype/reduceRight/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/reduceRight/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/reduceRight/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/reduce/15.4.4.21-9-c-ii-4-s.js non-strict prototype/reduce/callbackfn-resize-arraybuffer.js {unsupported: [resizable-arraybuffer]} - prototype/reduce/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/reduce/not-a-constructor.js prototype/reduce/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/reduce/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/reduce/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/reverse/length-exceeding-integer-limit-with-proxy.js - prototype/reverse/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/reverse/not-a-constructor.js prototype/reverse/resizable-buffer.js {unsupported: [resizable-arraybuffer]} - prototype/shift/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/shift/not-a-constructor.js prototype/shift/set-length-array-is-frozen.js prototype/shift/set-length-array-length-is-non-writable.js prototype/shift/set-length-zero-array-is-frozen.js @@ -242,87 +229,82 @@ built-ins/Array 383/3074 (12.46%) prototype/slice/create-ctor-non-object.js prototype/slice/create-ctor-poisoned.js prototype/slice/create-proto-from-ctor-realm-non-array.js - prototype/slice/create-proxied-array-invalid-len.js {unsupported: [Proxy]} - prototype/slice/create-proxy.js {unsupported: [Proxy]} - prototype/slice/create-revoked-proxy.js {unsupported: [Proxy]} + prototype/slice/create-proxy.js prototype/slice/create-species.js prototype/slice/create-species-abrupt.js prototype/slice/create-species-neg-zero.js - prototype/slice/create-species-non-ctor.js {unsupported: [Reflect.construct]} + prototype/slice/create-species-non-ctor.js prototype/slice/create-species-poisoned.js - prototype/slice/length-exceeding-integer-limit-proxied-array.js - prototype/slice/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/slice/not-a-constructor.js prototype/slice/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/slice/target-array-non-extensible.js prototype/slice/target-array-with-non-configurable-property.js prototype/some/15.4.4.17-5-1-s.js non-strict prototype/some/callbackfn-resize-arraybuffer.js {unsupported: [resizable-arraybuffer]} - prototype/some/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/some/not-a-constructor.js prototype/some/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/some/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/some/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/sort/comparefn-grow.js {unsupported: [resizable-arraybuffer]} prototype/sort/comparefn-resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/sort/comparefn-shrink.js {unsupported: [resizable-arraybuffer]} - prototype/sort/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/sort/not-a-constructor.js prototype/sort/resizable-buffer-default-comparator.js {unsupported: [resizable-arraybuffer]} prototype/sort/S15.4.4.11_A8.js non-strict prototype/splice/clamps-length-to-integer-limit.js prototype/splice/create-ctor-non-object.js prototype/splice/create-ctor-poisoned.js prototype/splice/create-proto-from-ctor-realm-non-array.js - prototype/splice/create-proxy.js {unsupported: [Proxy]} - prototype/splice/create-revoked-proxy.js {unsupported: [Proxy]} + prototype/splice/create-proxy.js + prototype/splice/create-revoked-proxy.js prototype/splice/create-species.js prototype/splice/create-species-abrupt.js prototype/splice/create-species-length-exceeding-integer-limit.js prototype/splice/create-species-neg-zero.js - prototype/splice/create-species-non-ctor.js {unsupported: [Reflect.construct]} + prototype/splice/create-species-non-ctor.js prototype/splice/create-species-poisoned.js - prototype/splice/create-species-undef-invalid-len.js {unsupported: [Proxy]} - prototype/splice/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/splice/property-traps-order-with-species.js {unsupported: [Proxy]} + prototype/splice/not-a-constructor.js + prototype/splice/property-traps-order-with-species.js prototype/splice/S15.4.4.12_A6.1_T2.js incorrect length handling prototype/splice/S15.4.4.12_A6.1_T3.js non-strict prototype/splice/set_length_no_args.js prototype/splice/target-array-non-extensible.js prototype/splice/target-array-with-non-configurable-property.js - prototype/Symbol.iterator/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/Symbol.iterator/not-a-constructor.js prototype/Symbol.unscopables/change-array-by-copy.js prototype/toLocaleString/invoke-element-tolocalestring.js - prototype/toLocaleString/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toLocaleString/not-a-constructor.js prototype/toLocaleString/primitive_this_value.js strict prototype/toLocaleString/primitive_this_value_getter.js strict prototype/toLocaleString/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/toLocaleString/user-provided-tolocalestring-grow.js {unsupported: [resizable-arraybuffer]} prototype/toLocaleString/user-provided-tolocalestring-shrink.js {unsupported: [resizable-arraybuffer]} - prototype/toReversed/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toSorted/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toSpliced/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toReversed/not-a-constructor.js + prototype/toSorted/not-a-constructor.js + prototype/toSpliced/not-a-constructor.js prototype/toString/call-with-boolean.js - prototype/toString/non-callable-join-string-tag.js {unsupported: [Proxy, Reflect]} - prototype/toString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/unshift/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toString/non-callable-join-string-tag.js + prototype/toString/not-a-constructor.js + prototype/unshift/not-a-constructor.js prototype/unshift/set-length-array-is-frozen.js prototype/unshift/set-length-array-length-is-non-writable.js prototype/unshift/set-length-zero-array-is-frozen.js prototype/unshift/set-length-zero-array-length-is-non-writable.js prototype/unshift/throws-with-string-receiver.js - prototype/values/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/values/not-a-constructor.js prototype/values/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/values/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} prototype/values/resizable-buffer-shrink-mid-iteration.js {unsupported: [resizable-arraybuffer]} - prototype/with/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/with/not-a-constructor.js prototype/methods-called-as-functions.js - is-a-constructor.js {unsupported: [Reflect.construct]} - proto-from-ctor-realm-one.js {unsupported: [Reflect]} - proto-from-ctor-realm-two.js {unsupported: [Reflect]} - proto-from-ctor-realm-zero.js {unsupported: [Reflect]} + proto-from-ctor-realm-one.js + proto-from-ctor-realm-two.js + proto-from-ctor-realm-zero.js -built-ins/ArrayBuffer 142/191 (74.35%) +built-ins/ArrayBuffer 140/191 (73.3%) isView/arg-is-dataview-subclass-instance.js {unsupported: [class]} isView/arg-is-typedarray-subclass-instance.js {unsupported: [class]} - isView/not-a-constructor.js {unsupported: [Reflect.construct]} + isView/not-a-constructor.js prototype/byteLength/detached-buffer.js prototype/byteLength/invoked-as-accessor.js prototype/byteLength/length.js @@ -333,8 +315,8 @@ built-ins/ArrayBuffer 142/191 (74.35%) prototype/maxByteLength 11/11 (100.0%) prototype/resizable 10/10 (100.0%) prototype/resize 20/20 (100.0%) - prototype/slice/nonconstructor.js {unsupported: [Reflect.construct]} - prototype/slice/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/slice/nonconstructor.js + prototype/slice/not-a-constructor.js prototype/slice/species.js prototype/slice/species-constructor-is-not-object.js prototype/slice/species-constructor-is-undefined.js @@ -351,12 +333,10 @@ built-ins/ArrayBuffer 142/191 (74.35%) prototype/transfer 23/23 (100.0%) prototype/Symbol.toStringTag.js Symbol.species 4/4 (100.0%) - data-allocation-after-object-creation.js {unsupported: [Reflect.construct]} - is-a-constructor.js {unsupported: [Reflect.construct]} - newtarget-prototype-is-not-object.js {unsupported: [Reflect.construct]} + data-allocation-after-object-creation.js options-maxbytelength-allocation-limit.js {unsupported: [resizable-arraybuffer]} - options-maxbytelength-compared-before-object-creation.js {unsupported: [Reflect.construct, resizable-arraybuffer]} - options-maxbytelength-data-allocation-after-object-creation.js {unsupported: [Reflect.construct, resizable-arraybuffer]} + options-maxbytelength-compared-before-object-creation.js {unsupported: [resizable-arraybuffer]} + options-maxbytelength-data-allocation-after-object-creation.js {unsupported: [resizable-arraybuffer]} options-maxbytelength-diminuitive.js {unsupported: [resizable-arraybuffer]} options-maxbytelength-excessive.js {unsupported: [resizable-arraybuffer]} options-maxbytelength-negative.js {unsupported: [resizable-arraybuffer]} @@ -364,8 +344,8 @@ built-ins/ArrayBuffer 142/191 (74.35%) options-maxbytelength-poisoned.js {unsupported: [resizable-arraybuffer]} options-maxbytelength-undefined.js {unsupported: [resizable-arraybuffer]} options-non-object.js {unsupported: [resizable-arraybuffer]} - proto-from-ctor-realm.js {unsupported: [Reflect]} - prototype-from-newtarget.js {unsupported: [Reflect.construct]} + proto-from-ctor-realm.js + prototype-from-newtarget.js undefined-newtarget-throws.js built-ins/ArrayIteratorPrototype 1/27 (3.7%) @@ -383,36 +363,34 @@ built-ins/ArrayIteratorPrototype 1/27 (3.7%) ~built-ins/Atomics -built-ins/BigInt 21/75 (28.0%) +built-ins/BigInt 20/75 (26.67%) asIntN/bigint-tobigint-errors.js asIntN/bigint-tobigint-toprimitive.js asIntN/bigint-tobigint-wrapped-values.js asIntN/bits-toindex-errors.js asIntN/bits-toindex-toprimitive.js asIntN/bits-toindex-wrapped-values.js - asIntN/not-a-constructor.js {unsupported: [Reflect.construct]} + asIntN/not-a-constructor.js asUintN/bigint-tobigint-errors.js asUintN/bigint-tobigint-toprimitive.js asUintN/bigint-tobigint-wrapped-values.js asUintN/bits-toindex-errors.js asUintN/bits-toindex-toprimitive.js asUintN/bits-toindex-wrapped-values.js - asUintN/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toLocaleString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toString/not-a-constructor.js {unsupported: [Reflect.construct]} + asUintN/not-a-constructor.js + prototype/toLocaleString/not-a-constructor.js + prototype/toString/not-a-constructor.js prototype/toString/prototype-call.js Check IsInteger in ES2020, not IsSafeInteger, https://github.com/tc39/test262/commit/bf1b79d65a760a5f03df1198557da2d010f8f397#diff-3ecd6a0c50da5c8f8eff723afb6182a889b7315d99545b055559e22d302cc453 - prototype/valueOf/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/valueOf/not-a-constructor.js constructor-coercion.js - is-a-constructor.js {unsupported: [Reflect.construct]} wrapper-object-ordinary-toprimitive.js -built-ins/Boolean 4/51 (7.84%) - prototype/toString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/valueOf/not-a-constructor.js {unsupported: [Reflect.construct]} - is-a-constructor.js {unsupported: [Reflect.construct]} - proto-from-ctor-realm.js {unsupported: [Reflect]} +built-ins/Boolean 3/51 (5.88%) + prototype/toString/not-a-constructor.js + prototype/valueOf/not-a-constructor.js + proto-from-ctor-realm.js -built-ins/DataView 254/550 (46.18%) +built-ins/DataView 250/550 (45.45%) prototype/buffer/detached-buffer.js prototype/buffer/invoked-as-accessor.js prototype/buffer/length.js @@ -446,7 +424,7 @@ built-ins/DataView 254/550 (46.18%) prototype/getBigInt64/length.js prototype/getBigInt64/name.js prototype/getBigInt64/negative-byteoffset-throws.js - prototype/getBigInt64/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/getBigInt64/not-a-constructor.js prototype/getBigInt64/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/getBigInt64/return-abrupt-from-tonumber-byteoffset.js prototype/getBigInt64/return-value-clean-arraybuffer.js @@ -464,7 +442,7 @@ built-ins/DataView 254/550 (46.18%) prototype/getBigUint64/length.js prototype/getBigUint64/name.js prototype/getBigUint64/negative-byteoffset-throws.js - prototype/getBigUint64/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/getBigUint64/not-a-constructor.js prototype/getBigUint64/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/getBigUint64/return-abrupt-from-tonumber-byteoffset.js prototype/getBigUint64/return-value-clean-arraybuffer.js @@ -483,7 +461,7 @@ built-ins/DataView 254/550 (46.18%) prototype/getFloat16/minus-zero.js prototype/getFloat16/name.js prototype/getFloat16/negative-byteoffset-throws.js - prototype/getFloat16/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/getFloat16/not-a-constructor.js prototype/getFloat16/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/getFloat16/return-abrupt-from-tonumber-byteoffset.js prototype/getFloat16/return-infinity.js @@ -496,24 +474,24 @@ built-ins/DataView 254/550 (46.18%) prototype/getFloat32/detached-buffer.js prototype/getFloat32/detached-buffer-after-toindex-byteoffset.js prototype/getFloat32/detached-buffer-before-outofrange-byteoffset.js - prototype/getFloat32/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/getFloat32/not-a-constructor.js prototype/getFloat32/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/getFloat64/detached-buffer.js prototype/getFloat64/detached-buffer-after-toindex-byteoffset.js prototype/getFloat64/detached-buffer-before-outofrange-byteoffset.js - prototype/getFloat64/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/getFloat64/not-a-constructor.js prototype/getFloat64/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/getInt16/detached-buffer.js prototype/getInt16/detached-buffer-after-toindex-byteoffset.js prototype/getInt16/detached-buffer-before-outofrange-byteoffset.js - prototype/getInt16/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/getInt16/not-a-constructor.js prototype/getInt16/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/getInt32/detached-buffer.js prototype/getInt32/detached-buffer-after-toindex-byteoffset.js prototype/getInt32/detached-buffer-before-outofrange-byteoffset.js prototype/getInt32/index-is-out-of-range-sab.js {unsupported: [SharedArrayBuffer]} prototype/getInt32/negative-byteoffset-throws-sab.js {unsupported: [SharedArrayBuffer]} - prototype/getInt32/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/getInt32/not-a-constructor.js prototype/getInt32/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/getInt32/return-abrupt-from-tonumber-byteoffset-sab.js {unsupported: [SharedArrayBuffer]} prototype/getInt32/return-abrupt-from-tonumber-byteoffset-symbol-sab.js {unsupported: [SharedArrayBuffer]} @@ -526,22 +504,22 @@ built-ins/DataView 254/550 (46.18%) prototype/getInt8/detached-buffer.js prototype/getInt8/detached-buffer-after-toindex-byteoffset.js prototype/getInt8/detached-buffer-before-outofrange-byteoffset.js - prototype/getInt8/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/getInt8/not-a-constructor.js prototype/getInt8/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/getUint16/detached-buffer.js prototype/getUint16/detached-buffer-after-toindex-byteoffset.js prototype/getUint16/detached-buffer-before-outofrange-byteoffset.js - prototype/getUint16/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/getUint16/not-a-constructor.js prototype/getUint16/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/getUint32/detached-buffer.js prototype/getUint32/detached-buffer-after-toindex-byteoffset.js prototype/getUint32/detached-buffer-before-outofrange-byteoffset.js - prototype/getUint32/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/getUint32/not-a-constructor.js prototype/getUint32/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/getUint8/detached-buffer.js prototype/getUint8/detached-buffer-after-toindex-byteoffset.js prototype/getUint8/detached-buffer-before-outofrange-byteoffset.js - prototype/getUint8/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/getUint8/not-a-constructor.js prototype/getUint8/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/setBigInt64/detached-buffer.js prototype/setBigInt64/detached-buffer-after-bigint-value.js @@ -552,7 +530,7 @@ built-ins/DataView 254/550 (46.18%) prototype/setBigInt64/length.js prototype/setBigInt64/name.js prototype/setBigInt64/negative-byteoffset-throws.js - prototype/setBigInt64/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/setBigInt64/not-a-constructor.js prototype/setBigInt64/range-check-after-value-conversion.js prototype/setBigInt64/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/setBigInt64/return-abrupt-from-tobigint-value.js @@ -572,7 +550,7 @@ built-ins/DataView 254/550 (46.18%) prototype/setFloat16/name.js prototype/setFloat16/negative-byteoffset-throws.js prototype/setFloat16/no-value-arg.js - prototype/setFloat16/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/setFloat16/not-a-constructor.js prototype/setFloat16/range-check-after-value-conversion.js prototype/setFloat16/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/setFloat16/return-abrupt-from-tonumber-byteoffset.js @@ -585,66 +563,63 @@ built-ins/DataView 254/550 (46.18%) prototype/setFloat32/detached-buffer-after-number-value.js prototype/setFloat32/detached-buffer-after-toindex-byteoffset.js prototype/setFloat32/detached-buffer-before-outofrange-byteoffset.js - prototype/setFloat32/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/setFloat32/not-a-constructor.js prototype/setFloat32/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/setFloat64/detached-buffer.js prototype/setFloat64/detached-buffer-after-number-value.js prototype/setFloat64/detached-buffer-after-toindex-byteoffset.js prototype/setFloat64/detached-buffer-before-outofrange-byteoffset.js - prototype/setFloat64/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/setFloat64/not-a-constructor.js prototype/setFloat64/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/setInt16/detached-buffer.js prototype/setInt16/detached-buffer-after-number-value.js prototype/setInt16/detached-buffer-after-toindex-byteoffset.js prototype/setInt16/detached-buffer-before-outofrange-byteoffset.js - prototype/setInt16/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/setInt16/not-a-constructor.js prototype/setInt16/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/setInt32/detached-buffer.js prototype/setInt32/detached-buffer-after-number-value.js prototype/setInt32/detached-buffer-after-toindex-byteoffset.js prototype/setInt32/detached-buffer-before-outofrange-byteoffset.js - prototype/setInt32/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/setInt32/not-a-constructor.js prototype/setInt32/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/setInt8/detached-buffer.js prototype/setInt8/detached-buffer-after-number-value.js prototype/setInt8/detached-buffer-after-toindex-byteoffset.js prototype/setInt8/detached-buffer-before-outofrange-byteoffset.js - prototype/setInt8/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/setInt8/not-a-constructor.js prototype/setInt8/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/setUint16/detached-buffer.js prototype/setUint16/detached-buffer-after-number-value.js prototype/setUint16/detached-buffer-after-toindex-byteoffset.js prototype/setUint16/detached-buffer-before-outofrange-byteoffset.js - prototype/setUint16/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/setUint16/not-a-constructor.js prototype/setUint16/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/setUint32/detached-buffer.js prototype/setUint32/detached-buffer-after-number-value.js prototype/setUint32/detached-buffer-after-toindex-byteoffset.js prototype/setUint32/detached-buffer-before-outofrange-byteoffset.js - prototype/setUint32/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/setUint32/not-a-constructor.js prototype/setUint32/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/setUint8/detached-buffer.js prototype/setUint8/detached-buffer-after-number-value.js prototype/setUint8/detached-buffer-after-toindex-byteoffset.js prototype/setUint8/detached-buffer-before-outofrange-byteoffset.js - prototype/setUint8/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/setUint8/not-a-constructor.js prototype/setUint8/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/Symbol.toStringTag.js buffer-does-not-have-arraybuffer-data-throws-sab.js {unsupported: [SharedArrayBuffer]} buffer-reference-sab.js {unsupported: [SharedArrayBuffer]} byteoffset-is-negative-throws-sab.js {unsupported: [SharedArrayBuffer]} - byteOffset-validated-against-initial-buffer-length.js {unsupported: [Reflect.construct]} - custom-proto-access-detaches-buffer.js {unsupported: [Reflect.construct]} + custom-proto-access-detaches-buffer.js custom-proto-access-resizes-buffer-invalid-by-length.js {unsupported: [resizable-arraybuffer]} custom-proto-access-resizes-buffer-invalid-by-offset.js {unsupported: [resizable-arraybuffer]} custom-proto-access-resizes-buffer-valid-by-length.js {unsupported: [resizable-arraybuffer]} custom-proto-access-resizes-buffer-valid-by-offset.js {unsupported: [resizable-arraybuffer]} - custom-proto-access-throws.js {unsupported: [Reflect.construct]} - custom-proto-access-throws-sab.js {unsupported: [Reflect.construct, SharedArrayBuffer]} - custom-proto-if-not-object-fallbacks-to-default-prototype.js {unsupported: [Reflect.construct]} - custom-proto-if-not-object-fallbacks-to-default-prototype-sab.js {unsupported: [Reflect.construct, SharedArrayBuffer]} - custom-proto-if-object-is-used.js {unsupported: [Reflect.construct]} - custom-proto-if-object-is-used-sab.js {unsupported: [Reflect.construct, SharedArrayBuffer]} + custom-proto-access-throws.js + custom-proto-access-throws-sab.js {unsupported: [SharedArrayBuffer]} + custom-proto-if-not-object-fallbacks-to-default-prototype-sab.js {unsupported: [SharedArrayBuffer]} + custom-proto-if-object-is-used-sab.js {unsupported: [SharedArrayBuffer]} defined-bytelength-and-byteoffset-sab.js {unsupported: [SharedArrayBuffer]} defined-byteoffset-sab.js {unsupported: [SharedArrayBuffer]} defined-byteoffset-undefined-bytelength-sab.js {unsupported: [SharedArrayBuffer]} @@ -652,13 +627,12 @@ built-ins/DataView 254/550 (46.18%) excessive-bytelength-throws-sab.js {unsupported: [SharedArrayBuffer]} excessive-byteoffset-throws-sab.js {unsupported: [SharedArrayBuffer]} instance-extensibility-sab.js {unsupported: [SharedArrayBuffer]} - is-a-constructor.js {unsupported: [Reflect.construct]} negative-bytelength-throws-sab.js {unsupported: [SharedArrayBuffer]} negative-byteoffset-throws-sab.js {unsupported: [SharedArrayBuffer]} newtarget-undefined-throws.js newtarget-undefined-throws-sab.js {unsupported: [SharedArrayBuffer]} - proto-from-ctor-realm.js {unsupported: [Reflect]} - proto-from-ctor-realm-sab.js {unsupported: [SharedArrayBuffer, Reflect]} + proto-from-ctor-realm.js + proto-from-ctor-realm-sab.js {unsupported: [SharedArrayBuffer]} return-abrupt-tonumber-bytelength-sab.js {unsupported: [SharedArrayBuffer]} return-abrupt-tonumber-bytelength-symbol-sab.js {unsupported: [SharedArrayBuffer]} return-abrupt-tonumber-byteoffset-sab.js {unsupported: [SharedArrayBuffer]} @@ -667,44 +641,44 @@ built-ins/DataView 254/550 (46.18%) toindex-bytelength-sab.js {unsupported: [SharedArrayBuffer]} toindex-byteoffset-sab.js {unsupported: [SharedArrayBuffer]} -built-ins/Date 90/770 (11.69%) - now/not-a-constructor.js {unsupported: [Reflect.construct]} - parse/not-a-constructor.js {unsupported: [Reflect.construct]} +built-ins/Date 87/770 (11.3%) + now/not-a-constructor.js + parse/not-a-constructor.js parse/year-zero.js - prototype/getDate/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getDay/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getFullYear/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getHours/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getMilliseconds/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getMinutes/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getMonth/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getSeconds/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getTimezoneOffset/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getTime/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getUTCDate/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getUTCDay/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getUTCFullYear/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getUTCHours/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getUTCMilliseconds/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getUTCMinutes/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getUTCMonth/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/getUTCSeconds/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setDate/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/getDate/not-a-constructor.js + prototype/getDay/not-a-constructor.js + prototype/getFullYear/not-a-constructor.js + prototype/getHours/not-a-constructor.js + prototype/getMilliseconds/not-a-constructor.js + prototype/getMinutes/not-a-constructor.js + prototype/getMonth/not-a-constructor.js + prototype/getSeconds/not-a-constructor.js + prototype/getTimezoneOffset/not-a-constructor.js + prototype/getTime/not-a-constructor.js + prototype/getUTCDate/not-a-constructor.js + prototype/getUTCDay/not-a-constructor.js + prototype/getUTCFullYear/not-a-constructor.js + prototype/getUTCHours/not-a-constructor.js + prototype/getUTCMilliseconds/not-a-constructor.js + prototype/getUTCMinutes/not-a-constructor.js + prototype/getUTCMonth/not-a-constructor.js + prototype/getUTCSeconds/not-a-constructor.js + prototype/setDate/not-a-constructor.js prototype/setFullYear/15.9.5.40_1.js - prototype/setFullYear/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setHours/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setMilliseconds/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setMinutes/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setMonth/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setSeconds/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setTime/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setUTCDate/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setUTCFullYear/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setUTCHours/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setUTCMilliseconds/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setUTCMinutes/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setUTCMonth/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/setUTCSeconds/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/setFullYear/not-a-constructor.js + prototype/setHours/not-a-constructor.js + prototype/setMilliseconds/not-a-constructor.js + prototype/setMinutes/not-a-constructor.js + prototype/setMonth/not-a-constructor.js + prototype/setSeconds/not-a-constructor.js + prototype/setTime/not-a-constructor.js + prototype/setUTCDate/not-a-constructor.js + prototype/setUTCFullYear/not-a-constructor.js + prototype/setUTCHours/not-a-constructor.js + prototype/setUTCMilliseconds/not-a-constructor.js + prototype/setUTCMinutes/not-a-constructor.js + prototype/setUTCMonth/not-a-constructor.js + prototype/setUTCSeconds/not-a-constructor.js prototype/Symbol.toPrimitive/hint-default-first-invalid.js prototype/Symbol.toPrimitive/hint-default-first-non-callable.js prototype/Symbol.toPrimitive/hint-default-first-valid.js @@ -719,33 +693,30 @@ built-ins/Date 90/770 (11.69%) prototype/Symbol.toPrimitive/name.js prototype/Symbol.toPrimitive/prop-desc.js prototype/Symbol.toPrimitive/this-val-non-obj.js - prototype/toDateString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toISOString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toJSON/builtin.js {unsupported: [Reflect.construct]} + prototype/toDateString/not-a-constructor.js + prototype/toISOString/not-a-constructor.js prototype/toJSON/called-as-function.js prototype/toJSON/invoke-result.js - prototype/toJSON/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toJSON/not-a-constructor.js prototype/toJSON/to-primitive-symbol.js prototype/toJSON/to-primitive-value-of.js - prototype/toLocaleDateString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toLocaleString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toLocaleTimeString/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toLocaleDateString/not-a-constructor.js + prototype/toLocaleString/not-a-constructor.js + prototype/toLocaleTimeString/not-a-constructor.js prototype/toString/non-date-receiver.js - prototype/toString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toTimeString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toUTCString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/valueOf/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toString/not-a-constructor.js + prototype/toTimeString/not-a-constructor.js + prototype/toUTCString/not-a-constructor.js + prototype/valueOf/not-a-constructor.js prototype/valueOf/S9.4_A3_T1.js prototype/no-date-value.js UTC/coercion-order.js UTC/fp-evaluation-order.js - UTC/not-a-constructor.js {unsupported: [Reflect.construct]} + UTC/not-a-constructor.js coercion-order.js - is-a-constructor.js {unsupported: [Reflect.construct]} - proto-from-ctor-realm-one.js {unsupported: [Reflect]} - proto-from-ctor-realm-two.js {unsupported: [Reflect]} - proto-from-ctor-realm-zero.js {unsupported: [Reflect]} - subclassing.js {unsupported: [Reflect]} + proto-from-ctor-realm-one.js + proto-from-ctor-realm-two.js + proto-from-ctor-realm-zero.js value-get-symbol-to-prim-err.js value-symbol-to-prim-err.js value-symbol-to-prim-invocation.js @@ -759,17 +730,16 @@ built-ins/Date 90/770 (11.69%) value-to-primitive-result-string.js year-zero.js -built-ins/Error 6/41 (14.63%) - prototype/toString/not-a-constructor.js {unsupported: [Reflect.construct]} +built-ins/Error 5/41 (12.2%) + prototype/toString/not-a-constructor.js prototype/no-error-data.js prototype/S15.11.4_A2.js cause_abrupt.js - is-a-constructor.js {unsupported: [Reflect.construct]} - proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm.js ~built-ins/FinalizationRegistry -built-ins/Function 187/508 (36.81%) +built-ins/Function 185/508 (36.42%) internals/Call 2/2 (100.0%) internals/Construct 6/6 (100.0%) length/S15.3.5.1_A1_T3.js strict @@ -781,7 +751,7 @@ built-ins/Function 187/508 (36.81%) prototype/apply/15.3.4.3-3-s.js strict prototype/apply/argarray-not-object.js prototype/apply/argarray-not-object-realm.js - prototype/apply/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/apply/not-a-constructor.js prototype/apply/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/apply/S15.3.4.3_A3_T1.js non-interpreted prototype/apply/S15.3.4.3_A3_T2.js non-interpreted @@ -798,23 +768,23 @@ built-ins/Function 187/508 (36.81%) prototype/apply/S15.3.4.3_A7_T7.js non-interpreted prototype/apply/this-not-callable-realm.js prototype/bind/BoundFunction_restricted-properties.js - prototype/bind/get-fn-realm.js {unsupported: [Reflect]} - prototype/bind/get-fn-realm-recursive.js {unsupported: [Reflect]} - prototype/bind/instance-construct-newtarget-boundtarget.js {unsupported: [Reflect, new.target]} - prototype/bind/instance-construct-newtarget-boundtarget-bound.js {unsupported: [Reflect, new.target]} + prototype/bind/get-fn-realm.js + prototype/bind/get-fn-realm-recursive.js + prototype/bind/instance-construct-newtarget-boundtarget.js {unsupported: [new.target]} + prototype/bind/instance-construct-newtarget-boundtarget-bound.js {unsupported: [new.target]} prototype/bind/instance-construct-newtarget-self-new.js {unsupported: [new.target]} - prototype/bind/instance-construct-newtarget-self-reflect.js {unsupported: [Reflect, new.target]} + prototype/bind/instance-construct-newtarget-self-reflect.js {unsupported: [new.target]} prototype/bind/instance-length-exceeds-int32.js prototype/bind/instance-length-tointeger.js prototype/bind/instance-name.js prototype/bind/instance-name-chained.js prototype/bind/instance-name-error.js - prototype/bind/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/bind/proto-from-ctor-realm.js {unsupported: [Reflect]} + prototype/bind/not-a-constructor.js + prototype/bind/proto-from-ctor-realm.js prototype/call/15.3.4.4-1-s.js strict prototype/call/15.3.4.4-2-s.js strict prototype/call/15.3.4.4-3-s.js strict - prototype/call/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/call/not-a-constructor.js prototype/call/S15.3.4.4_A3_T1.js non-interpreted prototype/call/S15.3.4.4_A3_T2.js non-interpreted prototype/call/S15.3.4.4_A3_T3.js non-interpreted @@ -834,7 +804,7 @@ built-ins/Function 187/508 (36.81%) prototype/Symbol.hasInstance/this-val-bound-target.js prototype/Symbol.hasInstance/this-val-not-callable.js prototype/Symbol.hasInstance/this-val-poisoned-prototype.js - prototype/Symbol.hasInstance/value-get-prototype-of-err.js {unsupported: [Proxy]} + prototype/Symbol.hasInstance/value-get-prototype-of-err.js prototype/Symbol.hasInstance/value-negative.js prototype/Symbol.hasInstance/value-non-obj.js prototype/Symbol.hasInstance/value-positive.js @@ -856,7 +826,7 @@ built-ins/Function 187/508 (36.81%) prototype/toString/AsyncFunction.js {unsupported: [async-functions]} prototype/toString/AsyncGenerator.js {unsupported: [async-iteration]} prototype/toString/bound-function.js - prototype/toString/built-in-function-object.js {unsupported: [Reflect]} + prototype/toString/built-in-function-object.js prototype/toString/class-declaration-complex-heritage.js prototype/toString/class-declaration-explicit-ctor.js prototype/toString/class-declaration-implicit-ctor.js @@ -879,22 +849,21 @@ built-ins/Function 187/508 (36.81%) prototype/toString/method-class-statement-static.js prototype/toString/method-computed-property-name.js prototype/toString/method-object.js - prototype/toString/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toString/not-a-constructor.js prototype/toString/private-method-class-expression.js prototype/toString/private-method-class-statement.js prototype/toString/private-static-method-class-expression.js prototype/toString/private-static-method-class-statement.js - prototype/toString/proxy-arrow-function.js {unsupported: [Proxy]} - prototype/toString/proxy-async-function.js {unsupported: [Proxy, async-functions]} - prototype/toString/proxy-async-generator-function.js {unsupported: [Proxy, async-iteration]} - prototype/toString/proxy-async-generator-method-definition.js {unsupported: [Proxy, async-iteration]} - prototype/toString/proxy-async-method-definition.js {unsupported: [Proxy, async-functions]} - prototype/toString/proxy-bound-function.js {unsupported: [Proxy]} - prototype/toString/proxy-class.js {unsupported: [Proxy, class]} - prototype/toString/proxy-function-expression.js {unsupported: [Proxy]} - prototype/toString/proxy-generator-function.js {unsupported: [Proxy]} - prototype/toString/proxy-method-definition.js {unsupported: [Proxy]} - prototype/toString/proxy-non-callable-throws.js {unsupported: [Proxy]} + prototype/toString/proxy-arrow-function.js + prototype/toString/proxy-async-function.js {unsupported: [async-functions]} + prototype/toString/proxy-async-generator-function.js {unsupported: [async-iteration]} + prototype/toString/proxy-async-generator-method-definition.js {unsupported: [async-iteration]} + prototype/toString/proxy-async-method-definition.js {unsupported: [async-functions]} + prototype/toString/proxy-bound-function.js + prototype/toString/proxy-class.js {unsupported: [class]} + prototype/toString/proxy-function-expression.js + prototype/toString/proxy-generator-function.js + prototype/toString/proxy-method-definition.js prototype/toString/setter-class-expression.js prototype/toString/setter-class-expression-static.js prototype/toString/setter-class-statement.js @@ -945,11 +914,10 @@ built-ins/Function 187/508 (36.81%) 15.3.5.4_2-9gs.js strict call-bind-this-realm-undef.js call-bind-this-realm-value.js - is-a-constructor.js {unsupported: [Reflect.construct]} private-identifiers-not-empty.js {unsupported: [class-fields-private]} property-order.js - proto-from-ctor-realm.js {unsupported: [Reflect]} - proto-from-ctor-realm-prototype.js {unsupported: [Reflect]} + proto-from-ctor-realm.js + proto-from-ctor-realm-prototype.js StrictFunction_restricted-properties.js strict ~built-ins/GeneratorFunction @@ -958,7 +926,7 @@ built-ins/GeneratorPrototype 38/60 (63.33%) next/from-state-executing.js non-interpreted next/length.js next/name.js - next/not-a-constructor.js {unsupported: [Reflect.construct]} + next/not-a-constructor.js next/property-descriptor.js next/this-val-not-generator.js next/this-val-not-object.js @@ -966,7 +934,7 @@ built-ins/GeneratorPrototype 38/60 (63.33%) throw/from-state-executing.js non-interpreted throw/length.js throw/name.js - throw/not-a-constructor.js {unsupported: [Reflect.construct]} + throw/not-a-constructor.js throw/property-descriptor.js throw/this-val-not-generator.js throw/this-val-not-object.js @@ -975,176 +943,156 @@ built-ins/GeneratorPrototype 38/60 (63.33%) built-ins/Infinity 0/6 (0.0%) -built-ins/JSON 37/144 (25.69%) - parse/builtin.js {unsupported: [Reflect.construct]} +built-ins/JSON 29/144 (20.14%) + parse/builtin.js parse/duplicate-proto.js - parse/not-a-constructor.js {unsupported: [Reflect.construct]} - parse/revived-proxy.js {unsupported: [Proxy]} - parse/revived-proxy-revoked.js {unsupported: [Proxy]} - parse/reviver-array-define-prop-err.js {unsupported: [Proxy]} - parse/reviver-array-delete-err.js {unsupported: [Proxy]} + parse/not-a-constructor.js + parse/revived-proxy.js + parse/reviver-array-define-prop-err.js parse/reviver-array-get-prop-from-prototype.js - parse/reviver-array-length-coerce-err.js {unsupported: [Proxy]} - parse/reviver-array-length-get-err.js {unsupported: [Proxy]} + parse/reviver-array-length-coerce-err.js + parse/reviver-array-length-get-err.js parse/reviver-call-order.js - parse/reviver-object-define-prop-err.js {unsupported: [Proxy]} - parse/reviver-object-delete-err.js {unsupported: [Proxy]} + parse/reviver-object-define-prop-err.js parse/reviver-object-get-prop-from-prototype.js parse/reviver-object-non-configurable-prop-create.js parse/reviver-object-non-configurable-prop-delete.js strict - parse/reviver-object-own-keys-err.js {unsupported: [Proxy]} parse/S15.12.2_A1.js parse/text-negative-zero.js - stringify/builtin.js {unsupported: [Reflect.construct]} - stringify/not-a-constructor.js {unsupported: [Reflect.construct]} - stringify/replacer-array-abrupt.js {unsupported: [Proxy]} - stringify/replacer-array-proxy.js {unsupported: [Proxy]} - stringify/replacer-array-proxy-revoked.js {unsupported: [Proxy]} - stringify/replacer-array-proxy-revoked-realm.js {unsupported: [Proxy]} - stringify/replacer-array-wrong-type.js {unsupported: [Proxy]} + stringify/builtin.js + stringify/not-a-constructor.js + stringify/replacer-array-abrupt.js + stringify/replacer-array-proxy.js + stringify/replacer-array-wrong-type.js stringify/replacer-function-arguments.js stringify/replacer-function-object-deleted-property.js stringify/replacer-function-result.js - stringify/value-array-abrupt.js {unsupported: [Proxy]} - stringify/value-array-proxy.js {unsupported: [Proxy]} - stringify/value-array-proxy-revoked.js {unsupported: [Proxy]} + stringify/value-array-abrupt.js + stringify/value-array-proxy.js stringify/value-bigint-cross-realm.js stringify/value-bigint-tojson-receiver.js - stringify/value-object-proxy.js {unsupported: [Proxy]} - stringify/value-object-proxy-revoked.js {unsupported: [Proxy]} + stringify/value-object-proxy.js stringify/value-string-escape-unicode.js -built-ins/Map 13/171 (7.6%) - prototype/clear/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/delete/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/entries/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/forEach/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/get/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/has/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/keys/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/set/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/Symbol.iterator/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/values/not-a-constructor.js {unsupported: [Reflect.construct]} - is-a-constructor.js {unsupported: [Reflect.construct]} - proto-from-ctor-realm.js {unsupported: [Reflect]} +built-ins/Map 12/171 (7.02%) + prototype/clear/not-a-constructor.js + prototype/delete/not-a-constructor.js + prototype/entries/not-a-constructor.js + prototype/forEach/not-a-constructor.js + prototype/get/not-a-constructor.js + prototype/has/not-a-constructor.js + prototype/keys/not-a-constructor.js + prototype/set/not-a-constructor.js + prototype/Symbol.iterator/not-a-constructor.js + prototype/values/not-a-constructor.js + proto-from-ctor-realm.js valid-keys.js built-ins/MapIteratorPrototype 0/11 (0.0%) built-ins/Math 51/327 (15.6%) - abs/not-a-constructor.js {unsupported: [Reflect.construct]} - acosh/not-a-constructor.js {unsupported: [Reflect.construct]} - acos/not-a-constructor.js {unsupported: [Reflect.construct]} - asinh/not-a-constructor.js {unsupported: [Reflect.construct]} - asin/not-a-constructor.js {unsupported: [Reflect.construct]} - atan2/not-a-constructor.js {unsupported: [Reflect.construct]} - atanh/not-a-constructor.js {unsupported: [Reflect.construct]} - atan/not-a-constructor.js {unsupported: [Reflect.construct]} - cbrt/not-a-constructor.js {unsupported: [Reflect.construct]} - ceil/not-a-constructor.js {unsupported: [Reflect.construct]} - clz32/not-a-constructor.js {unsupported: [Reflect.construct]} - cosh/not-a-constructor.js {unsupported: [Reflect.construct]} - cos/not-a-constructor.js {unsupported: [Reflect.construct]} - expm1/not-a-constructor.js {unsupported: [Reflect.construct]} - exp/not-a-constructor.js {unsupported: [Reflect.construct]} + abs/not-a-constructor.js + acosh/not-a-constructor.js + acos/not-a-constructor.js + asinh/not-a-constructor.js + asin/not-a-constructor.js + atan2/not-a-constructor.js + atanh/not-a-constructor.js + atan/not-a-constructor.js + cbrt/not-a-constructor.js + ceil/not-a-constructor.js + clz32/not-a-constructor.js + cosh/not-a-constructor.js + cos/not-a-constructor.js + expm1/not-a-constructor.js + exp/not-a-constructor.js f16round 5/5 (100.0%) - floor/not-a-constructor.js {unsupported: [Reflect.construct]} - fround/not-a-constructor.js {unsupported: [Reflect.construct]} - hypot/not-a-constructor.js {unsupported: [Reflect.construct]} - imul/not-a-constructor.js {unsupported: [Reflect.construct]} - log10/not-a-constructor.js {unsupported: [Reflect.construct]} - log1p/not-a-constructor.js {unsupported: [Reflect.construct]} + floor/not-a-constructor.js + fround/not-a-constructor.js + hypot/not-a-constructor.js + imul/not-a-constructor.js + log10/not-a-constructor.js + log1p/not-a-constructor.js log2/log2-basicTests.js calculation is not exact - log2/not-a-constructor.js {unsupported: [Reflect.construct]} - log/not-a-constructor.js {unsupported: [Reflect.construct]} - max/not-a-constructor.js {unsupported: [Reflect.construct]} - min/not-a-constructor.js {unsupported: [Reflect.construct]} - pow/not-a-constructor.js {unsupported: [Reflect.construct]} - random/not-a-constructor.js {unsupported: [Reflect.construct]} - round/not-a-constructor.js {unsupported: [Reflect.construct]} - sign/not-a-constructor.js {unsupported: [Reflect.construct]} - sinh/not-a-constructor.js {unsupported: [Reflect.construct]} - sin/not-a-constructor.js {unsupported: [Reflect.construct]} - sqrt/not-a-constructor.js {unsupported: [Reflect.construct]} + log2/not-a-constructor.js + log/not-a-constructor.js + max/not-a-constructor.js + min/not-a-constructor.js + pow/not-a-constructor.js + random/not-a-constructor.js + round/not-a-constructor.js + sign/not-a-constructor.js + sinh/not-a-constructor.js + sin/not-a-constructor.js + sqrt/not-a-constructor.js sumPrecise 10/10 (100.0%) - tanh/not-a-constructor.js {unsupported: [Reflect.construct]} - tan/not-a-constructor.js {unsupported: [Reflect.construct]} - trunc/not-a-constructor.js {unsupported: [Reflect.construct]} + tanh/not-a-constructor.js + tan/not-a-constructor.js + trunc/not-a-constructor.js built-ins/NaN 0/6 (0.0%) -built-ins/NativeErrors 31/123 (25.2%) +built-ins/NativeErrors 23/123 (18.7%) AggregateError/errors-iterabletolist-failures.js - AggregateError/is-a-constructor.js {unsupported: [Reflect.construct]} AggregateError/message-tostring-abrupt.js AggregateError/message-tostring-abrupt-symbol.js - AggregateError/newtarget-proto-custom.js {unsupported: [Reflect.construct]} AggregateError/newtarget-proto-fallback.js - AggregateError/proto-from-ctor-realm.js {unsupported: [Reflect]} + AggregateError/proto-from-ctor-realm.js EvalError/prototype/not-error-object.js - EvalError/is-a-constructor.js {unsupported: [Reflect.construct]} - EvalError/proto-from-ctor-realm.js {unsupported: [Reflect]} + EvalError/proto-from-ctor-realm.js RangeError/prototype/not-error-object.js - RangeError/is-a-constructor.js {unsupported: [Reflect.construct]} - RangeError/proto-from-ctor-realm.js {unsupported: [Reflect]} + RangeError/proto-from-ctor-realm.js ReferenceError/prototype/not-error-object.js - ReferenceError/is-a-constructor.js {unsupported: [Reflect.construct]} - ReferenceError/proto-from-ctor-realm.js {unsupported: [Reflect]} + ReferenceError/proto-from-ctor-realm.js SuppressedError/prototype 2/2 (100.0%) SuppressedError 4/4 (100.0%) SyntaxError/prototype/not-error-object.js - SyntaxError/is-a-constructor.js {unsupported: [Reflect.construct]} - SyntaxError/proto-from-ctor-realm.js {unsupported: [Reflect]} + SyntaxError/proto-from-ctor-realm.js TypeError/prototype/not-error-object.js - TypeError/is-a-constructor.js {unsupported: [Reflect.construct]} - TypeError/proto-from-ctor-realm.js {unsupported: [Reflect]} + TypeError/proto-from-ctor-realm.js URIError/prototype/not-error-object.js - URIError/is-a-constructor.js {unsupported: [Reflect.construct]} - URIError/proto-from-ctor-realm.js {unsupported: [Reflect]} - -built-ins/Number 24/335 (7.16%) - isFinite/not-a-constructor.js {unsupported: [Reflect.construct]} - isInteger/not-a-constructor.js {unsupported: [Reflect.construct]} - isNaN/not-a-constructor.js {unsupported: [Reflect.construct]} - isSafeInteger/not-a-constructor.js {unsupported: [Reflect.construct]} - parseFloat/not-a-constructor.js {unsupported: [Reflect.construct]} - parseInt/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toExponential/not-a-constructor.js {unsupported: [Reflect.construct]} + URIError/proto-from-ctor-realm.js + +built-ins/Number 23/335 (6.87%) + isFinite/not-a-constructor.js + isInteger/not-a-constructor.js + isNaN/not-a-constructor.js + isSafeInteger/not-a-constructor.js + parseFloat/not-a-constructor.js + parseInt/not-a-constructor.js + prototype/toExponential/not-a-constructor.js prototype/toExponential/return-abrupt-tointeger-fractiondigits.js prototype/toExponential/return-abrupt-tointeger-fractiondigits-symbol.js prototype/toExponential/undefined-fractiondigits.js - prototype/toFixed/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toFixed/not-a-constructor.js prototype/toLocaleString/length.js - prototype/toLocaleString/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toLocaleString/not-a-constructor.js prototype/toPrecision/nan.js - prototype/toPrecision/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toString/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toPrecision/not-a-constructor.js + prototype/toString/not-a-constructor.js prototype/toString/numeric-literal-tostring-radix-1.js prototype/toString/numeric-literal-tostring-radix-37.js - prototype/valueOf/not-a-constructor.js {unsupported: [Reflect.construct]} - is-a-constructor.js {unsupported: [Reflect.construct]} - proto-from-ctor-realm.js {unsupported: [Reflect]} + prototype/valueOf/not-a-constructor.js + proto-from-ctor-realm.js S9.3.1_A2_U180E.js {unsupported: [u180e]} S9.3.1_A3_T1_U180E.js {unsupported: [u180e]} S9.3.1_A3_T2_U180E.js {unsupported: [u180e]} -built-ins/Object 222/3408 (6.51%) +built-ins/Object 212/3408 (6.22%) assign/assignment-to-readonly-property-of-target-must-throw-a-typeerror-exception.js - assign/not-a-constructor.js {unsupported: [Reflect.construct]} - assign/source-own-prop-desc-missing.js {unsupported: [Proxy]} - assign/source-own-prop-error.js {unsupported: [Proxy]} - assign/source-own-prop-keys-error.js {unsupported: [Proxy]} + assign/not-a-constructor.js + assign/source-own-prop-error.js assign/strings-and-symbol-order.js - assign/strings-and-symbol-order-proxy.js {unsupported: [Proxy]} + assign/strings-and-symbol-order-proxy.js assign/target-is-frozen-accessor-property-set-succeeds.js - assign/target-is-frozen-data-property-set-throws.js {unsupported: [Reflect]} + assign/target-is-frozen-data-property-set-throws.js assign/target-is-non-extensible-existing-accessor-property.js assign/target-is-non-extensible-existing-data-property.js assign/target-is-non-extensible-property-creation-throws.js assign/target-is-sealed-existing-accessor-property.js assign/target-is-sealed-existing-data-property.js - assign/target-is-sealed-property-creation-throws.js {unsupported: [Reflect]} - create/not-a-constructor.js {unsupported: [Reflect.construct]} + assign/target-is-sealed-property-creation-throws.js + create/not-a-constructor.js defineProperties/15.2.3.7-6-a-112.js non-strict defineProperties/15.2.3.7-6-a-113.js non-strict defineProperties/15.2.3.7-6-a-118.js @@ -1161,9 +1109,9 @@ built-ins/Object 222/3408 (6.51%) defineProperties/15.2.3.7-6-a-184.js defineProperties/15.2.3.7-6-a-185.js defineProperties/15.2.3.7-6-a-282.js - defineProperties/not-a-constructor.js {unsupported: [Reflect.construct]} + defineProperties/not-a-constructor.js defineProperties/property-description-must-be-an-object-not-symbol.js - defineProperties/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy]} + defineProperties/proxy-no-ownkeys-returned-keys-order.js defineProperties/typedarray-backed-by-resizable-buffer.js {unsupported: [resizable-arraybuffer]} defineProperty/15.2.3.6-4-116.js non-strict defineProperty/15.2.3.6-4-117.js non-strict @@ -1185,120 +1133,133 @@ built-ins/Object 222/3408 (6.51%) defineProperty/15.2.3.6-4-336.js defineProperty/coerced-P-grow.js {unsupported: [resizable-arraybuffer]} defineProperty/coerced-P-shrink.js {unsupported: [resizable-arraybuffer]} - defineProperty/not-a-constructor.js {unsupported: [Reflect.construct]} + defineProperty/not-a-constructor.js defineProperty/property-description-must-be-an-object-not-symbol.js defineProperty/typedarray-backed-by-resizable-buffer.js {unsupported: [resizable-arraybuffer]} - entries/not-a-constructor.js {unsupported: [Reflect.construct]} - entries/observable-operations.js {unsupported: [Proxy]} + entries/not-a-constructor.js + entries/observable-operations.js entries/order-after-define-property-with-function.js - freeze/abrupt-completion.js {unsupported: [Proxy]} - freeze/not-a-constructor.js {unsupported: [Reflect.construct]} - freeze/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy, Reflect]} - freeze/proxy-with-defineProperty-handler.js {unsupported: [Proxy, Reflect]} - freeze/throws-when-false.js + freeze/15.2.3.9-2-a-1.js + freeze/15.2.3.9-2-a-10.js + freeze/15.2.3.9-2-a-11.js + freeze/15.2.3.9-2-a-13.js + freeze/15.2.3.9-2-a-14.js + freeze/15.2.3.9-2-a-2.js + freeze/15.2.3.9-2-a-7.js + freeze/15.2.3.9-2-a-8.js + freeze/15.2.3.9-2-a-9.js + freeze/15.2.3.9-2-b-i-1.js + freeze/15.2.3.9-2-b-i-2.js + freeze/15.2.3.9-2-d-1.js + freeze/15.2.3.9-2-d-2.js + freeze/15.2.3.9-2-d-7.js + freeze/15.2.3.9-2-d-9.js + freeze/15.2.3.9-4-1.js + freeze/15.2.3.9-4-2.js + freeze/15.2.3.9-4-3.js + freeze/frozen-object-contains-symbol-properties-non-strict.js non-strict + freeze/frozen-object-contains-symbol-properties-strict.js strict + freeze/not-a-constructor.js + freeze/proxy-no-ownkeys-returned-keys-order.js + freeze/proxy-with-defineProperty-handler.js freeze/typedarray-backed-by-resizable-buffer.js {unsupported: [resizable-arraybuffer]} - fromEntries/not-a-constructor.js {unsupported: [Reflect.construct]} + fromEntries/not-a-constructor.js fromEntries/to-property-key.js fromEntries/uses-keys-not-iterator.js - getOwnPropertyDescriptors/not-a-constructor.js {unsupported: [Reflect.construct]} - getOwnPropertyDescriptors/observable-operations.js {unsupported: [Proxy]} - getOwnPropertyDescriptors/order-after-define-property.js {unsupported: [Reflect]} - getOwnPropertyDescriptors/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy]} - getOwnPropertyDescriptors/proxy-undefined-descriptor.js {unsupported: [Proxy]} + getOwnPropertyDescriptors/not-a-constructor.js + getOwnPropertyDescriptors/order-after-define-property.js + getOwnPropertyDescriptors/proxy-no-ownkeys-returned-keys-order.js + getOwnPropertyDescriptors/proxy-undefined-descriptor.js getOwnPropertyDescriptor/15.2.3.3-4-212.js getOwnPropertyDescriptor/15.2.3.3-4-213.js getOwnPropertyDescriptor/15.2.3.3-4-214.js getOwnPropertyDescriptor/15.2.3.3-4-215.js getOwnPropertyDescriptor/15.2.3.3-4-250.js - getOwnPropertyDescriptor/not-a-constructor.js {unsupported: [Reflect.construct]} - getOwnPropertyNames/not-a-constructor.js {unsupported: [Reflect.construct]} + getOwnPropertyDescriptor/not-a-constructor.js + getOwnPropertyNames/not-a-constructor.js getOwnPropertyNames/order-after-define-property.js - getOwnPropertyNames/proxy-invariant-absent-not-configurable-symbol-key.js {unsupported: [Proxy]} - getOwnPropertyNames/proxy-invariant-duplicate-symbol-entry.js {unsupported: [Proxy]} - getOwnPropertyNames/proxy-invariant-not-extensible-absent-symbol-key.js {unsupported: [Proxy]} - getOwnPropertyNames/proxy-invariant-not-extensible-extra-symbol-key.js {unsupported: [Proxy]} - getOwnPropertySymbols/not-a-constructor.js {unsupported: [Reflect.construct]} - getOwnPropertySymbols/proxy-invariant-absent-not-configurable-string-key.js {unsupported: [Proxy]} - getOwnPropertySymbols/proxy-invariant-duplicate-string-entry.js {unsupported: [Proxy]} - getOwnPropertySymbols/proxy-invariant-not-extensible-absent-string-key.js {unsupported: [Proxy]} - getOwnPropertySymbols/proxy-invariant-not-extensible-extra-string-key.js {unsupported: [Proxy]} - getPrototypeOf/not-a-constructor.js {unsupported: [Reflect.construct]} + getOwnPropertyNames/proxy-invariant-absent-not-configurable-symbol-key.js + getOwnPropertyNames/proxy-invariant-not-extensible-absent-symbol-key.js + getOwnPropertySymbols/not-a-constructor.js + getPrototypeOf/not-a-constructor.js hasOwn/length.js - hasOwn/not-a-constructor.js {unsupported: [Reflect.construct]} + hasOwn/not-a-constructor.js hasOwn/symbol_property_toPrimitive.js hasOwn/symbol_property_toString.js hasOwn/symbol_property_valueOf.js - internals/DefineOwnProperty/consistent-value-function-arguments.js - internals/DefineOwnProperty/consistent-value-function-caller.js internals/DefineOwnProperty/consistent-value-regexp-dollar1.js - internals/DefineOwnProperty/consistent-writable-regexp-dollar1.js - isExtensible/not-a-constructor.js {unsupported: [Reflect.construct]} - isFrozen/not-a-constructor.js {unsupported: [Reflect.construct]} - isFrozen/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy, Reflect]} - isSealed/not-a-constructor.js {unsupported: [Reflect.construct]} - isSealed/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy, Reflect]} - is/not-a-constructor.js {unsupported: [Reflect.construct]} - keys/not-a-constructor.js {unsupported: [Reflect.construct]} + isExtensible/not-a-constructor.js + isFrozen/15.2.3.12-1-5.js + isFrozen/15.2.3.12-1-6.js + isFrozen/15.2.3.12-1-7.js + isFrozen/not-a-constructor.js + isFrozen/proxy-no-ownkeys-returned-keys-order.js + isSealed/not-a-constructor.js + isSealed/proxy-no-ownkeys-returned-keys-order.js + is/not-a-constructor.js + keys/not-a-constructor.js keys/order-after-define-property-with-function.js - keys/property-traps-order-with-proxied-array.js {unsupported: [Proxy]} + keys/property-traps-order-with-proxied-array.js keys/proxy-keys.js - keys/proxy-non-enumerable-prop-invariant-1.js {unsupported: [Proxy]} - keys/proxy-non-enumerable-prop-invariant-2.js {unsupported: [Proxy]} - keys/proxy-non-enumerable-prop-invariant-3.js {unsupported: [Proxy]} - preventExtensions/abrupt-completion.js {unsupported: [Proxy]} - preventExtensions/not-a-constructor.js {unsupported: [Reflect.construct]} - preventExtensions/throws-when-false.js - prototype/__defineGetter__/define-abrupt.js {unsupported: [Proxy]} + keys/proxy-non-enumerable-prop-invariant-1.js + keys/proxy-non-enumerable-prop-invariant-2.js + keys/proxy-non-enumerable-prop-invariant-3.js + preventExtensions/not-a-constructor.js + prototype/__defineGetter__/define-abrupt.js prototype/__defineGetter__/define-existing.js prototype/__defineGetter__/define-non-configurable.js prototype/__defineGetter__/define-non-extensible.js prototype/__defineGetter__/this-non-obj.js - prototype/__defineSetter__/define-abrupt.js {unsupported: [Proxy]} + prototype/__defineSetter__/define-abrupt.js prototype/__defineSetter__/define-existing.js prototype/__defineSetter__/define-non-configurable.js prototype/__defineSetter__/define-non-extensible.js prototype/__defineSetter__/this-non-obj.js - prototype/__lookupGetter__/lookup-own-get-err.js {unsupported: [Proxy]} - prototype/__lookupGetter__/lookup-own-proto-err.js {unsupported: [Proxy]} - prototype/__lookupGetter__/lookup-proto-get-err.js {unsupported: [Proxy]} - prototype/__lookupGetter__/lookup-proto-proto-err.js {unsupported: [Proxy]} + prototype/__lookupGetter__/lookup-own-get-err.js + prototype/__lookupGetter__/lookup-proto-get-err.js prototype/__lookupGetter__/this-non-obj.js - prototype/__lookupSetter__/lookup-own-get-err.js {unsupported: [Proxy]} - prototype/__lookupSetter__/lookup-own-proto-err.js {unsupported: [Proxy]} - prototype/__lookupSetter__/lookup-proto-get-err.js {unsupported: [Proxy]} - prototype/__lookupSetter__/lookup-proto-proto-err.js {unsupported: [Proxy]} + prototype/__lookupSetter__/lookup-own-get-err.js + prototype/__lookupSetter__/lookup-proto-get-err.js prototype/__lookupSetter__/this-non-obj.js - prototype/__proto__ 15/15 (100.0%) - prototype/hasOwnProperty/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/__proto__/get-abrupt.js + prototype/__proto__/get-fn-name.js + prototype/__proto__/get-ordinary-obj.js + prototype/__proto__/get-to-obj-abrupt.js + prototype/__proto__/prop-desc.js + prototype/__proto__/set-cycle.js + prototype/__proto__/set-cycle-shadowed.js + prototype/__proto__/set-fn-name.js + prototype/__proto__/set-immutable.js + prototype/__proto__/set-invalid-value.js + prototype/__proto__/set-non-extensible.js + prototype/__proto__/set-non-obj-coercible.js + prototype/__proto__/set-non-object.js + prototype/__proto__/set-ordinary-obj.js + prototype/hasOwnProperty/not-a-constructor.js prototype/hasOwnProperty/symbol_property_toPrimitive.js prototype/hasOwnProperty/symbol_property_toString.js prototype/hasOwnProperty/symbol_property_valueOf.js prototype/hasOwnProperty/topropertykey_before_toobject.js - prototype/isPrototypeOf/arg-is-proxy.js {unsupported: [Proxy]} - prototype/isPrototypeOf/builtin.js {unsupported: [Reflect.construct]} - prototype/isPrototypeOf/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/isPrototypeOf/not-a-constructor.js prototype/isPrototypeOf/null-this-and-primitive-arg-returns-false.js prototype/isPrototypeOf/undefined-this-and-primitive-arg-returns-false.js - prototype/propertyIsEnumerable/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/propertyIsEnumerable/not-a-constructor.js prototype/propertyIsEnumerable/symbol_property_toPrimitive.js prototype/propertyIsEnumerable/symbol_property_toString.js prototype/propertyIsEnumerable/symbol_property_valueOf.js - prototype/toLocaleString/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toLocaleString/not-a-constructor.js prototype/toLocaleString/primitive_this_value.js strict prototype/toLocaleString/primitive_this_value_getter.js strict prototype/toString/get-symbol-tag-err.js - prototype/toString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toString/proxy-array.js {unsupported: [Proxy]} - prototype/toString/proxy-function.js {unsupported: [Proxy, async-functions]} - prototype/toString/proxy-function-async.js {unsupported: [Proxy, async-functions]} - prototype/toString/proxy-revoked.js {unsupported: [Proxy]} - prototype/toString/proxy-revoked-during-get-call.js {unsupported: [Proxy]} + prototype/toString/not-a-constructor.js + prototype/toString/proxy-function.js {unsupported: [async-functions]} + prototype/toString/proxy-function-async.js {unsupported: [async-functions]} prototype/toString/symbol-tag-array-builtin.js prototype/toString/symbol-tag-generators-builtin.js prototype/toString/symbol-tag-map-builtin.js prototype/toString/symbol-tag-non-str-bigint.js prototype/toString/symbol-tag-non-str-builtin.js - prototype/toString/symbol-tag-non-str-proxy-function.js {unsupported: [Proxy, async-functions]} + prototype/toString/symbol-tag-non-str-proxy-function.js {unsupported: [async-functions]} prototype/toString/symbol-tag-override-bigint.js prototype/toString/symbol-tag-override-instances.js prototype/toString/symbol-tag-override-primitives.js @@ -1308,15 +1269,12 @@ built-ins/Object 222/3408 (6.51%) prototype/toString/symbol-tag-string-builtin.js prototype/toString/symbol-tag-weakmap-builtin.js prototype/toString/symbol-tag-weakset-builtin.js - prototype/valueOf/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/valueOf/not-a-constructor.js prototype/valueOf/S15.2.4.4_A14.js prototype/valueOf/S15.2.4.4_A15.js - prototype/setPrototypeOf-with-different-values.js {unsupported: [Reflect.setPrototypeOf]} - prototype/setPrototypeOf-with-same-value.js {unsupported: [Reflect.setPrototypeOf]} - seal/abrupt-completion.js {unsupported: [Proxy]} - seal/not-a-constructor.js {unsupported: [Reflect.construct]} - seal/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy, Reflect]} - seal/proxy-with-defineProperty-handler.js {unsupported: [Proxy, Reflect]} + seal/not-a-constructor.js + seal/proxy-no-ownkeys-returned-keys-order.js + seal/proxy-with-defineProperty-handler.js seal/seal-asyncarrowfunction.js seal/seal-asyncfunction.js seal/seal-asyncgeneratorfunction.js @@ -1324,21 +1282,17 @@ built-ins/Object 222/3408 (6.51%) seal/seal-biguint64array.js seal/seal-finalizationregistry.js seal/seal-generatorfunction.js - seal/seal-proxy.js seal/seal-sharedarraybuffer.js {unsupported: [SharedArrayBuffer]} seal/seal-weakref.js - seal/throws-when-false.js - setPrototypeOf/not-a-constructor.js {unsupported: [Reflect.construct]} - setPrototypeOf/set-error.js {unsupported: [Proxy]} - values/not-a-constructor.js {unsupported: [Reflect.construct]} - values/observable-operations.js {unsupported: [Proxy]} + setPrototypeOf/not-a-constructor.js + values/not-a-constructor.js + values/observable-operations.js values/order-after-define-property.js - is-a-constructor.js {unsupported: [Reflect.construct]} property-order.js - proto-from-ctor-realm.js {unsupported: [Reflect]} - subclass-object-arg.js {unsupported: [Reflect.construct, Reflect, class]} + proto-from-ctor-realm.js + subclass-object-arg.js {unsupported: [class]} -built-ins/Promise 406/631 (64.34%) +built-ins/Promise 403/631 (63.87%) allSettled/capability-resolve-throws-reject.js {unsupported: [async]} allSettled/ctx-ctor.js {unsupported: [class]} allSettled/does-not-invoke-array-setters.js {unsupported: [async]} @@ -1375,7 +1329,7 @@ built-ins/Promise 406/631 (64.34%) allSettled/iter-returns-true-reject.js {unsupported: [async]} allSettled/iter-returns-undefined-reject.js {unsupported: [async]} allSettled/iter-step-err-reject.js {unsupported: [async]} - allSettled/not-a-constructor.js {unsupported: [Reflect.construct]} + allSettled/not-a-constructor.js allSettled/reject-deferred.js {unsupported: [async]} allSettled/reject-element-function-property-order.js allSettled/reject-ignored-deferred.js {unsupported: [async]} @@ -1434,7 +1388,7 @@ built-ins/Promise 406/631 (64.34%) all/iter-returns-true-reject.js {unsupported: [async]} all/iter-returns-undefined-reject.js {unsupported: [async]} all/iter-step-err-reject.js {unsupported: [async]} - all/not-a-constructor.js {unsupported: [Reflect.construct]} + all/not-a-constructor.js all/reject-deferred.js {unsupported: [async]} all/reject-ignored-deferred.js {unsupported: [async]} all/reject-ignored-immed.js {unsupported: [async]} @@ -1510,7 +1464,7 @@ built-ins/Promise 406/631 (64.34%) any/iter-returns-undefined-reject.js {unsupported: [async]} any/iter-step-err-no-close.js {unsupported: [async]} any/iter-step-err-reject.js {unsupported: [async]} - any/not-a-constructor.js {unsupported: [Reflect.construct]} + any/not-a-constructor.js any/reject-all-mixed.js {unsupported: [async]} any/reject-deferred.js {unsupported: [async]} any/reject-element-function-property-order.js @@ -1528,32 +1482,31 @@ built-ins/Promise 406/631 (64.34%) any/resolved-sequence-extra-ticks.js {unsupported: [async]} any/resolved-sequence-mixed.js {unsupported: [async]} any/resolved-sequence-with-rejections.js {unsupported: [async]} - prototype/catch/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/catch/not-a-constructor.js prototype/catch/S25.4.5.1_A3.1_T1.js {unsupported: [async]} prototype/catch/S25.4.5.1_A3.1_T2.js {unsupported: [async]} - prototype/finally/invokes-then-with-function.js {unsupported: [Reflect.construct]} - prototype/finally/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/finally/invokes-then-with-function.js + prototype/finally/not-a-constructor.js prototype/finally/rejected-observable-then-calls.js {unsupported: [async]} - prototype/finally/rejected-observable-then-calls-argument.js {unsupported: [Reflect.construct, class, async]} + prototype/finally/rejected-observable-then-calls-argument.js {unsupported: [class, async]} prototype/finally/rejected-observable-then-calls-PromiseResolve.js {unsupported: [async]} prototype/finally/rejection-reason-no-fulfill.js {unsupported: [async]} prototype/finally/rejection-reason-override-with-throw.js {unsupported: [async]} prototype/finally/resolution-value-no-override.js {unsupported: [async]} prototype/finally/resolved-observable-then-calls.js {unsupported: [async]} - prototype/finally/resolved-observable-then-calls-argument.js {unsupported: [Reflect.construct, async]} + prototype/finally/resolved-observable-then-calls-argument.js {unsupported: [async]} prototype/finally/resolved-observable-then-calls-PromiseResolve.js {unsupported: [async]} prototype/finally/species-constructor.js {unsupported: [async]} prototype/finally/subclass-reject-count.js {unsupported: [async]} prototype/finally/subclass-resolve-count.js {unsupported: [async]} prototype/finally/subclass-species-constructor-reject-count.js prototype/finally/subclass-species-constructor-resolve-count.js - prototype/finally/this-value-proxy.js prototype/then/capability-executor-called-twice.js {unsupported: [class]} prototype/then/capability-executor-not-callable.js {unsupported: [class]} prototype/then/ctor-access-count.js {unsupported: [async]} prototype/then/ctor-custom.js {unsupported: [class]} prototype/then/deferred-is-resolved-value.js {unsupported: [class, async]} - prototype/then/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/then/not-a-constructor.js prototype/then/prfm-fulfilled.js {unsupported: [async]} prototype/then/prfm-pending-fulfulled.js {unsupported: [async]} prototype/then/prfm-pending-rejected.js {unsupported: [async]} @@ -1643,7 +1596,7 @@ built-ins/Promise 406/631 (64.34%) race/iter-returns-true-reject.js {unsupported: [async]} race/iter-returns-undefined-reject.js {unsupported: [async]} race/iter-step-err-reject.js {unsupported: [async]} - race/not-a-constructor.js {unsupported: [Reflect.construct]} + race/not-a-constructor.js race/reject-deferred.js {unsupported: [async]} race/reject-ignored-deferred.js {unsupported: [async]} race/reject-ignored-immed.js {unsupported: [async]} @@ -1678,12 +1631,12 @@ built-ins/Promise 406/631 (64.34%) race/S25.4.4.3_A7.3_T2.js {unsupported: [async]} reject/capability-invocation.js reject/ctx-ctor.js {unsupported: [class]} - reject/not-a-constructor.js {unsupported: [Reflect.construct]} + reject/not-a-constructor.js reject/S25.4.4.4_A2.1_T1.js {unsupported: [async]} resolve/arg-non-thenable.js {unsupported: [async]} resolve/arg-poisoned-then.js {unsupported: [async]} resolve/ctx-ctor.js {unsupported: [class]} - resolve/not-a-constructor.js {unsupported: [Reflect.construct]} + resolve/not-a-constructor.js resolve/resolve-from-promise-capability.js resolve/resolve-non-obj.js {unsupported: [async]} resolve/resolve-non-thenable.js {unsupported: [async]} @@ -1701,7 +1654,7 @@ built-ins/Promise 406/631 (64.34%) try/ctx-ctor-throws.js try/length.js try/name.js - try/not-a-constructor.js {unsupported: [Reflect.construct]} + try/not-a-constructor.js try/promise.js try/prop-desc.js try/return-value.js {unsupported: [async]} @@ -1710,17 +1663,15 @@ built-ins/Promise 406/631 (64.34%) withResolvers/promise.js withResolvers/resolvers.js withResolvers/result.js - create-resolving-functions-reject.js {unsupported: [Reflect.construct, async]} - create-resolving-functions-resolve.js {unsupported: [Reflect.construct, async]} + create-resolving-functions-reject.js {unsupported: [async]} + create-resolving-functions-resolve.js {unsupported: [async]} exception-after-resolve-in-executor.js {unsupported: [async]} exception-after-resolve-in-thenable-job.js {unsupported: [async]} - executor-function-not-a-constructor.js {unsupported: [Reflect.construct]} + executor-function-not-a-constructor.js executor-function-property-order.js - get-prototype-abrupt.js {unsupported: [Reflect.construct, Reflect]} - get-prototype-abrupt-executor-not-callable.js {unsupported: [Reflect.construct, Reflect]} - is-a-constructor.js {unsupported: [Reflect.construct]} + get-prototype-abrupt.js property-order.js - proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm.js reject-function-property-order.js reject-ignored-via-abrupt.js {unsupported: [async]} reject-ignored-via-fn-deferred.js {unsupported: [async]} @@ -1746,11 +1697,119 @@ built-ins/Promise 406/631 (64.34%) resolve-thenable-deferred.js {unsupported: [async]} resolve-thenable-immed.js {unsupported: [async]} -~built-ins/Proxy - -~built-ins/Reflect +built-ins/Proxy 82/311 (26.37%) + construct/arguments-realm.js + construct/call-parameters.js + construct/call-parameters-new-target.js + construct/call-result.js non-interpreted + construct/return-is-abrupt.js non-interpreted + construct/trap-is-missing-target-is-proxy.js {unsupported: [class]} + construct/trap-is-null.js + construct/trap-is-null-target-is-proxy.js {unsupported: [class]} + construct/trap-is-undefined.js + construct/trap-is-undefined-no-property.js + construct/trap-is-undefined-proto-from-newtarget-realm.js + construct/trap-is-undefined-target-is-proxy.js {unsupported: [class]} + defineProperty/desc-realm.js + defineProperty/targetdesc-not-configurable-writable-desc-not-writable.js + defineProperty/targetdesc-undefined-target-is-not-extensible-realm.js non-strict + defineProperty/trap-is-missing-target-is-proxy.js + defineProperty/trap-is-undefined-target-is-proxy.js + deleteProperty/boolean-trap-result-boolean-false.js + deleteProperty/return-false-not-strict.js non-strict + deleteProperty/return-false-strict.js strict + deleteProperty/targetdesc-is-configurable-target-is-not-extensible.js + deleteProperty/trap-is-missing-target-is-proxy.js + deleteProperty/trap-is-null-target-is-proxy.js + deleteProperty/trap-is-undefined-strict.js strict + deleteProperty/trap-is-undefined-target-is-proxy.js + getOwnPropertyDescriptor/result-is-undefined-targetdesc-is-undefined.js + getOwnPropertyDescriptor/resultdesc-is-invalid-descriptor.js + getOwnPropertyDescriptor/resultdesc-is-not-configurable-not-writable-targetdesc-is-writable.js + getOwnPropertyDescriptor/resultdesc-is-not-configurable-targetdesc-is-configurable.js + getOwnPropertyDescriptor/resultdesc-is-not-configurable-targetdesc-is-undefined.js + getOwnPropertyDescriptor/trap-is-missing-target-is-proxy.js + getOwnPropertyDescriptor/trap-is-null-target-is-proxy.js + getOwnPropertyDescriptor/trap-is-undefined.js + getOwnPropertyDescriptor/trap-is-undefined-target-is-proxy.js + get/accessor-get-is-undefined-throws.js + get/trap-is-undefined-receiver.js + has/call-in-prototype.js + has/call-in-prototype-index.js + has/call-with.js non-strict + has/return-false-target-not-extensible-using-with.js non-strict + has/return-false-target-prop-exists-using-with.js non-strict + has/return-false-targetdesc-not-configurable-using-with.js non-strict + has/return-is-abrupt-with.js non-strict + has/return-true-target-prop-exists-using-with.js non-strict + has/trap-is-missing-target-is-proxy.js + has/trap-is-not-callable-using-with.js non-strict + ownKeys/trap-is-undefined-target-is-proxy.js + preventExtensions/trap-is-undefined-target-is-proxy.js {unsupported: [module]} + revocable/builtin.js + revocable/not-a-constructor.js + revocable/revocation-function-not-a-constructor.js + revocable/revocation-function-property-order.js + revocable/tco-fn-realm.js {unsupported: [tail-call-optimization]} + setPrototypeOf/internals-call-order.js + setPrototypeOf/not-extensible-target-not-same-target-prototype.js + setPrototypeOf/return-abrupt-from-target-getprototypeof.js + setPrototypeOf/toboolean-trap-result-false.js + setPrototypeOf/toboolean-trap-result-true-target-is-extensible.js + setPrototypeOf/trap-is-missing-target-is-proxy.js + setPrototypeOf/trap-is-null-target-is-proxy.js + set/boolean-trap-result-is-false-boolean-return-false.js + set/boolean-trap-result-is-false-null-return-false.js + set/boolean-trap-result-is-false-number-return-false.js + set/boolean-trap-result-is-false-string-return-false.js + set/boolean-trap-result-is-false-undefined-return-false.js + set/call-parameters.js + set/call-parameters-prototype.js + set/call-parameters-prototype-dunder-proto.js + set/call-parameters-prototype-index.js + set/target-property-is-accessor-not-configurable-set-is-undefined.js + set/trap-is-missing-receiver-multiple-calls.js + set/trap-is-missing-receiver-multiple-calls-index.js + set/trap-is-missing-target-is-proxy.js + set/trap-is-null-receiver.js + set/trap-is-null-target-is-proxy.js + set/trap-is-undefined-target-is-proxy.js + create-handler-not-object-throw-symbol.js + create-target-is-not-a-constructor.js + create-target-not-object-throw-symbol.js + get-fn-realm.js + get-fn-realm-recursive.js + property-order.js -built-ins/RegExp 1169/1854 (63.05%) +built-ins/Reflect 26/153 (16.99%) + apply/not-a-constructor.js + construct/newtarget-is-not-constructor-throws.js + construct/not-a-constructor.js + defineProperty/not-a-constructor.js + defineProperty/return-abrupt-from-property-key.js + deleteProperty/not-a-constructor.js + deleteProperty/return-abrupt-from-result.js + deleteProperty/return-boolean.js strict + getOwnPropertyDescriptor/not-a-constructor.js + getPrototypeOf/not-a-constructor.js + get/not-a-constructor.js + get/return-value-from-receiver.js + has/not-a-constructor.js + isExtensible/not-a-constructor.js + ownKeys/not-a-constructor.js + ownKeys/order-after-define-property.js + ownKeys/return-on-corresponding-order-large-index.js + preventExtensions/not-a-constructor.js + setPrototypeOf/not-a-constructor.js + set/call-prototype-property-set.js + set/different-property-descriptors.js + set/not-a-constructor.js + set/receiver-is-not-object.js + set/return-abrupt-from-result.js + set/return-false-if-receiver-is-not-writable.js + set/return-false-if-target-is-not-writable.js + +built-ins/RegExp 1168/1854 (63.0%) CharacterClassEscapes 24/24 (100.0%) dotall 4/4 (100.0%) escape 20/20 (100.0%) @@ -1776,7 +1835,7 @@ built-ins/RegExp 1169/1854 (63.05%) prototype/exec/duplicate-named-groups-properties.js prototype/exec/duplicate-named-indices-groups-properties.js prototype/exec/failure-lastindex-access.js - prototype/exec/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/exec/not-a-constructor.js prototype/exec/S15.10.6.2_A5_T3.js prototype/exec/success-lastindex-access.js prototype/exec/u-captured-value.js @@ -1852,7 +1911,7 @@ built-ins/RegExp 1169/1854 (63.05%) prototype/Symbol.match/get-flags-err.js prototype/Symbol.match/get-global-err.js prototype/Symbol.match/get-unicode-error.js - prototype/Symbol.match/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/Symbol.match/not-a-constructor.js prototype/Symbol.match/this-val-non-regexp.js prototype/Symbol.match/u-advance-after-empty.js prototype/Symbol.match/y-fail-global-return.js @@ -1887,7 +1946,7 @@ built-ins/RegExp 1169/1854 (63.05%) prototype/Symbol.replace/name.js prototype/Symbol.replace/named-groups.js {unsupported: [regexp-named-groups]} prototype/Symbol.replace/named-groups-fn.js {unsupported: [regexp-named-groups]} - prototype/Symbol.replace/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/Symbol.replace/not-a-constructor.js prototype/Symbol.replace/poisoned-stdlib.js {unsupported: [regexp-named-groups]} prototype/Symbol.replace/prop-desc.js prototype/Symbol.replace/replace-with-trailing.js @@ -1928,7 +1987,7 @@ built-ins/RegExp 1169/1854 (63.05%) prototype/Symbol.search/get-lastindex-err.js prototype/Symbol.search/lastindex-no-restore.js prototype/Symbol.search/match-err.js - prototype/Symbol.search/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/Symbol.search/not-a-constructor.js prototype/Symbol.search/set-lastindex-init.js prototype/Symbol.search/set-lastindex-init-err.js prototype/Symbol.search/set-lastindex-init-samevalue.js @@ -1948,7 +2007,7 @@ built-ins/RegExp 1169/1854 (63.05%) prototype/Symbol.split/length.js prototype/Symbol.split/limit-0-bail.js prototype/Symbol.split/name.js - prototype/Symbol.split/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/Symbol.split/not-a-constructor.js prototype/Symbol.split/prop-desc.js prototype/Symbol.split/species-ctor.js prototype/Symbol.split/species-ctor-ctor-get-err.js @@ -1980,11 +2039,11 @@ built-ins/RegExp 1169/1854 (63.05%) prototype/Symbol.split/str-trailing-chars.js prototype/Symbol.split/u-lastindex-adv-thru-failure.js prototype/Symbol.split/u-lastindex-adv-thru-match.js - prototype/test/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/test/not-a-constructor.js prototype/test/S15.10.6.3_A1_T22.js - prototype/toString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toString/S15.10.6.4_A6.js {unsupported: [Reflect.construct]} - prototype/toString/S15.10.6.4_A7.js {unsupported: [Reflect.construct]} + prototype/toString/not-a-constructor.js + prototype/toString/S15.10.6.4_A6.js + prototype/toString/S15.10.6.4_A7.js prototype/unicodeSets/cross-realm.js prototype/unicodeSets/length.js prototype/unicodeSets/name.js @@ -2011,8 +2070,7 @@ built-ins/RegExp 1169/1854 (63.05%) from-regexp-like-get-flags-err.js from-regexp-like-get-source-err.js from-regexp-like-short-circuit.js - is-a-constructor.js {unsupported: [Reflect.construct]} - proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm.js quantifier-integer-limit.js S15.10.1_A1_T13.js S15.10.1_A1_T14.js @@ -2026,10 +2084,10 @@ built-ins/RegExp 1169/1854 (63.05%) built-ins/RegExpStringIteratorPrototype 17/17 (100.0%) -built-ins/Set 167/381 (43.83%) - prototype/add/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/clear/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/delete/not-a-constructor.js {unsupported: [Reflect.construct]} +built-ins/Set 166/381 (43.57%) + prototype/add/not-a-constructor.js + prototype/clear/not-a-constructor.js + prototype/delete/not-a-constructor.js prototype/difference/add-not-called.js prototype/difference/allows-set-like-class.js prototype/difference/allows-set-like-object.js @@ -2043,7 +2101,7 @@ built-ins/Set 167/381 (43.83%) prototype/difference/difference.js prototype/difference/length.js prototype/difference/name.js - prototype/difference/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/difference/not-a-constructor.js prototype/difference/receiver-not-set.js prototype/difference/require-internal-slot.js prototype/difference/result-order.js @@ -2054,9 +2112,9 @@ built-ins/Set 167/381 (43.83%) prototype/difference/subclass.js prototype/difference/subclass-receiver-methods.js prototype/difference/subclass-symbol-species.js - prototype/entries/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/forEach/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/has/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/entries/not-a-constructor.js + prototype/forEach/not-a-constructor.js + prototype/has/not-a-constructor.js prototype/intersection/add-not-called.js prototype/intersection/allows-set-like-class.js prototype/intersection/allows-set-like-object.js @@ -2070,7 +2128,7 @@ built-ins/Set 167/381 (43.83%) prototype/intersection/intersection.js prototype/intersection/length.js prototype/intersection/name.js - prototype/intersection/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/intersection/not-a-constructor.js prototype/intersection/receiver-not-set.js prototype/intersection/require-internal-slot.js prototype/intersection/result-order.js @@ -2093,7 +2151,7 @@ built-ins/Set 167/381 (43.83%) prototype/isDisjointFrom/isDisjointFrom.js prototype/isDisjointFrom/length.js prototype/isDisjointFrom/name.js - prototype/isDisjointFrom/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/isDisjointFrom/not-a-constructor.js prototype/isDisjointFrom/receiver-not-set.js prototype/isDisjointFrom/require-internal-slot.js prototype/isDisjointFrom/set-like-array.js @@ -2112,7 +2170,7 @@ built-ins/Set 167/381 (43.83%) prototype/isSubsetOf/isSubsetOf.js prototype/isSubsetOf/length.js prototype/isSubsetOf/name.js - prototype/isSubsetOf/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/isSubsetOf/not-a-constructor.js prototype/isSubsetOf/receiver-not-set.js prototype/isSubsetOf/require-internal-slot.js prototype/isSubsetOf/set-like-array.js @@ -2132,7 +2190,7 @@ built-ins/Set 167/381 (43.83%) prototype/isSupersetOf/isSupersetOf.js prototype/isSupersetOf/length.js prototype/isSupersetOf/name.js - prototype/isSupersetOf/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/isSupersetOf/not-a-constructor.js prototype/isSupersetOf/receiver-not-set.js prototype/isSupersetOf/require-internal-slot.js prototype/isSupersetOf/set-like-array.js @@ -2140,7 +2198,7 @@ built-ins/Set 167/381 (43.83%) prototype/isSupersetOf/set-like-class-order.js prototype/isSupersetOf/size-is-a-number.js prototype/isSupersetOf/subclass-receiver-methods.js - prototype/Symbol.iterator/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/Symbol.iterator/not-a-constructor.js prototype/symmetricDifference/add-not-called.js prototype/symmetricDifference/allows-set-like-class.js prototype/symmetricDifference/allows-set-like-object.js @@ -2153,7 +2211,7 @@ built-ins/Set 167/381 (43.83%) prototype/symmetricDifference/converts-negative-zero.js prototype/symmetricDifference/length.js prototype/symmetricDifference/name.js - prototype/symmetricDifference/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/symmetricDifference/not-a-constructor.js prototype/symmetricDifference/receiver-not-set.js prototype/symmetricDifference/require-internal-slot.js prototype/symmetricDifference/result-order.js @@ -2178,7 +2236,7 @@ built-ins/Set 167/381 (43.83%) prototype/union/converts-negative-zero.js prototype/union/length.js prototype/union/name.js - prototype/union/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/union/not-a-constructor.js prototype/union/receiver-not-set.js prototype/union/require-internal-slot.js prototype/union/result-order.js @@ -2190,27 +2248,26 @@ built-ins/Set 167/381 (43.83%) prototype/union/subclass-receiver-methods.js prototype/union/subclass-symbol-species.js prototype/union/union.js - prototype/values/not-a-constructor.js {unsupported: [Reflect.construct]} - is-a-constructor.js {unsupported: [Reflect.construct]} - proto-from-ctor-realm.js {unsupported: [Reflect]} + prototype/values/not-a-constructor.js + proto-from-ctor-realm.js valid-values.js built-ins/SetIteratorPrototype 0/11 (0.0%) ~built-ins/SharedArrayBuffer -built-ins/String 140/1182 (11.84%) - fromCharCode/not-a-constructor.js {unsupported: [Reflect.construct]} - fromCodePoint/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/charAt/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/charCodeAt/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/codePointAt/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/concat/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/endsWith/not-a-constructor.js {unsupported: [Reflect.construct]} +built-ins/String 139/1182 (11.76%) + fromCharCode/not-a-constructor.js + fromCodePoint/not-a-constructor.js + prototype/charAt/not-a-constructor.js + prototype/charCodeAt/not-a-constructor.js + prototype/codePointAt/not-a-constructor.js + prototype/concat/not-a-constructor.js + prototype/endsWith/not-a-constructor.js prototype/endsWith/return-abrupt-from-searchstring-regexp-test.js - prototype/includes/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/includes/not-a-constructor.js prototype/includes/return-abrupt-from-searchstring-regexp-test.js - prototype/indexOf/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/indexOf/not-a-constructor.js prototype/indexOf/position-tointeger-bigint.js prototype/indexOf/position-tointeger-errors.js prototype/indexOf/position-tointeger-toprimitive.js @@ -2220,23 +2277,23 @@ built-ins/String 140/1182 (11.84%) prototype/indexOf/searchstring-tostring-toprimitive.js prototype/indexOf/searchstring-tostring-wrapped-values.js prototype/isWellFormed 8/8 (100.0%) - prototype/lastIndexOf/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/localeCompare/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/lastIndexOf/not-a-constructor.js + prototype/localeCompare/not-a-constructor.js prototype/matchAll 20/20 (100.0%) prototype/match/cstm-matcher-get-err.js prototype/match/cstm-matcher-invocation.js prototype/match/duplicate-named-groups-properties.js prototype/match/duplicate-named-indices-groups-properties.js prototype/match/invoke-builtin-match.js - prototype/match/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/normalize/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/padEnd/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/padStart/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/repeat/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/match/not-a-constructor.js + prototype/normalize/not-a-constructor.js + prototype/padEnd/not-a-constructor.js + prototype/padStart/not-a-constructor.js + prototype/repeat/not-a-constructor.js prototype/replaceAll/getSubstitution-0x0024-0x003C.js prototype/replaceAll/getSubstitution-0x0024N.js prototype/replaceAll/getSubstitution-0x0024NN.js - prototype/replaceAll/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/replaceAll/not-a-constructor.js prototype/replaceAll/replaceValue-call-each-match-position.js prototype/replaceAll/replaceValue-call-matching-empty.js prototype/replaceAll/replaceValue-value-tostring.js @@ -2255,74 +2312,73 @@ built-ins/String 140/1182 (11.84%) prototype/replaceAll/this-tostring.js prototype/replace/cstm-replace-get-err.js prototype/replace/cstm-replace-invocation.js - prototype/replace/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/replace/not-a-constructor.js prototype/replace/S15.5.4.11_A12.js non-strict prototype/search/cstm-search-get-err.js prototype/search/cstm-search-invocation.js prototype/search/invoke-builtin-search.js prototype/search/invoke-builtin-search-searcher-undef.js - prototype/search/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/slice/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/search/not-a-constructor.js + prototype/slice/not-a-constructor.js prototype/split/cstm-split-get-err.js prototype/split/cstm-split-invocation.js prototype/split/limit-touint32-error.js - prototype/split/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/split/not-a-constructor.js prototype/split/separator-regexp.js prototype/split/separator-tostring-error.js prototype/split/this-value-tostring-error.js - prototype/startsWith/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/startsWith/not-a-constructor.js prototype/startsWith/return-abrupt-from-searchstring-regexp-test.js - prototype/substring/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/substring/not-a-constructor.js prototype/substring/S15.5.4.15_A1_T5.js - prototype/Symbol.iterator/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/Symbol.iterator/not-a-constructor.js prototype/toLocaleLowerCase/Final_Sigma_U180E.js {unsupported: [u180e]} - prototype/toLocaleLowerCase/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toLocaleLowerCase/not-a-constructor.js prototype/toLocaleLowerCase/special_casing_conditional.js - prototype/toLocaleUpperCase/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toLocaleUpperCase/not-a-constructor.js prototype/toLowerCase/Final_Sigma_U180E.js {unsupported: [u180e]} - prototype/toLowerCase/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toLowerCase/not-a-constructor.js prototype/toLowerCase/special_casing_conditional.js prototype/toString/non-generic-realm.js - prototype/toString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/toUpperCase/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toString/not-a-constructor.js + prototype/toUpperCase/not-a-constructor.js prototype/toWellFormed 8/8 (100.0%) - prototype/trimEnd/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/trimEnd/not-a-constructor.js prototype/trimEnd/this-value-object-toprimitive-call-err.js prototype/trimEnd/this-value-object-toprimitive-meth-err.js prototype/trimEnd/this-value-object-toprimitive-meth-priority.js prototype/trimEnd/this-value-object-toprimitive-returns-object-err.js prototype/trimEnd/this-value-object-tostring-meth-priority.js prototype/trimEnd/this-value-object-valueof-meth-priority.js - prototype/trimStart/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/trimStart/not-a-constructor.js prototype/trimStart/this-value-object-toprimitive-call-err.js prototype/trimStart/this-value-object-toprimitive-meth-err.js prototype/trimStart/this-value-object-toprimitive-meth-priority.js prototype/trimStart/this-value-object-toprimitive-returns-object-err.js prototype/trimStart/this-value-object-tostring-meth-priority.js prototype/trimStart/this-value-object-valueof-meth-priority.js - prototype/trim/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/trim/not-a-constructor.js prototype/trim/u180e.js {unsupported: [u180e]} prototype/valueOf/non-generic-realm.js - prototype/valueOf/not-a-constructor.js {unsupported: [Reflect.construct]} - raw/not-a-constructor.js {unsupported: [Reflect.construct]} - is-a-constructor.js {unsupported: [Reflect.construct]} - proto-from-ctor-realm.js {unsupported: [Reflect]} + prototype/valueOf/not-a-constructor.js + raw/not-a-constructor.js + proto-from-ctor-realm.js built-ins/StringIteratorPrototype 0/7 (0.0%) -built-ins/Symbol 36/94 (38.3%) +built-ins/Symbol 35/94 (37.23%) asyncDispose/prop-desc.js asyncIterator/prop-desc.js dispose/prop-desc.js for/cross-realm.js for/description.js - for/not-a-constructor.js {unsupported: [Reflect.construct]} + for/not-a-constructor.js hasInstance/cross-realm.js isConcatSpreadable/cross-realm.js iterator/cross-realm.js keyFor/arg-non-symbol.js keyFor/cross-realm.js - keyFor/not-a-constructor.js {unsupported: [Reflect.construct]} + keyFor/not-a-constructor.js matchAll 2/2 (100.0%) match/cross-realm.js prototype/description/description-symboldescriptivestring.js @@ -2335,8 +2391,8 @@ built-ins/Symbol 36/94 (38.3%) prototype/Symbol.toPrimitive/prop-desc.js prototype/Symbol.toPrimitive/redefined-symbol-wrapper-ordinary-toprimitive.js prototype/Symbol.toPrimitive/removed-symbol-wrapper-ordinary-toprimitive.js - prototype/toString/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/valueOf/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toString/not-a-constructor.js + prototype/valueOf/not-a-constructor.js replace/cross-realm.js search/cross-realm.js species/cross-realm.js @@ -2345,7 +2401,6 @@ built-ins/Symbol 36/94 (38.3%) toPrimitive/cross-realm.js toStringTag/cross-realm.js unscopables/cross-realm.js - is-constructor.js {unsupported: [Reflect.construct]} built-ins/ThrowTypeError 8/14 (57.14%) extensible.js @@ -2357,7 +2412,7 @@ built-ins/ThrowTypeError 8/14 (57.14%) unique-per-realm-non-simple.js unique-per-realm-unmapped-args.js -built-ins/TypedArray 1091/1422 (76.72%) +built-ins/TypedArray 1084/1422 (76.23%) from/arylk-get-length-error.js from/arylk-to-length-error.js from/from-array-mapper-detaches-result.js @@ -2373,11 +2428,11 @@ built-ins/TypedArray 1091/1422 (76.72%) from/iterated-array-changed-by-tonumber.js from/length.js from/name.js - from/not-a-constructor.js {unsupported: [Reflect.construct]} + from/not-a-constructor.js from/prop-desc.js of/length.js of/name.js - of/not-a-constructor.js {unsupported: [Reflect.construct]} + of/not-a-constructor.js of/prop-desc.js of/resized-with-out-of-bounds-and-in-bounds-indices.js {unsupported: [resizable-arraybuffer]} prototype/at/BigInt/return-abrupt-from-this-out-of-bounds.js {unsupported: [resizable-arraybuffer]} @@ -2427,7 +2482,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/copyWithin/invoked-as-method.js prototype/copyWithin/length.js prototype/copyWithin/name.js - prototype/copyWithin/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/copyWithin/not-a-constructor.js prototype/copyWithin/prop-desc.js prototype/copyWithin/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/copyWithin/return-abrupt-from-this-out-of-bounds.js {unsupported: [resizable-arraybuffer]} @@ -2439,7 +2494,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/entries/invoked-as-method.js prototype/entries/length.js prototype/entries/name.js - prototype/entries/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/entries/not-a-constructor.js prototype/entries/prop-desc.js prototype/entries/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/entries/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} @@ -2450,14 +2505,13 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/every/BigInt 16/16 (100.0%) prototype/every/callbackfn-detachbuffer.js prototype/every/callbackfn-resize.js {unsupported: [resizable-arraybuffer]} - prototype/every/callbackfn-set-value-during-interaction.js {unsupported: [Reflect.set]} prototype/every/detached-buffer.js prototype/every/get-length-uses-internal-arraylength.js prototype/every/invoked-as-func.js prototype/every/invoked-as-method.js prototype/every/length.js prototype/every/name.js - prototype/every/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/every/not-a-constructor.js prototype/every/prop-desc.js prototype/every/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/every/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} @@ -2478,7 +2532,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/fill/invoked-as-method.js prototype/fill/length.js prototype/fill/name.js - prototype/fill/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/fill/not-a-constructor.js prototype/fill/prop-desc.js prototype/fill/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/fill/return-abrupt-from-this-out-of-bounds.js {unsupported: [resizable-arraybuffer]} @@ -2488,13 +2542,12 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/filter/arraylength-internal.js prototype/filter/callbackfn-detachbuffer.js prototype/filter/callbackfn-resize.js {unsupported: [resizable-arraybuffer]} - prototype/filter/callbackfn-set-value-during-iteration.js {unsupported: [Reflect.set]} prototype/filter/detached-buffer.js prototype/filter/invoked-as-func.js prototype/filter/invoked-as-method.js prototype/filter/length.js prototype/filter/name.js - prototype/filter/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/filter/not-a-constructor.js prototype/filter/prop-desc.js prototype/filter/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/filter/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} @@ -2515,7 +2568,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/findIndex/invoked-as-method.js prototype/findIndex/length.js prototype/findIndex/name.js - prototype/findIndex/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/findIndex/not-a-constructor.js prototype/findIndex/predicate-call-this-strict.js strict prototype/findIndex/predicate-may-detach-buffer.js prototype/findIndex/prop-desc.js @@ -2534,7 +2587,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/findLastIndex/invoked-as-method.js prototype/findLastIndex/length.js prototype/findLastIndex/name.js - prototype/findLastIndex/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/findLastIndex/not-a-constructor.js prototype/findLastIndex/predicate-call-this-strict.js strict prototype/findLastIndex/predicate-may-detach-buffer.js prototype/findLastIndex/prop-desc.js @@ -2551,7 +2604,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/findLast/invoked-as-method.js prototype/findLast/length.js prototype/findLast/name.js - prototype/findLast/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/findLast/not-a-constructor.js prototype/findLast/predicate-call-this-strict.js strict prototype/findLast/predicate-may-detach-buffer.js prototype/findLast/prop-desc.js @@ -2568,7 +2621,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/find/invoked-as-method.js prototype/find/length.js prototype/find/name.js - prototype/find/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/find/not-a-constructor.js prototype/find/predicate-call-this-strict.js strict prototype/find/predicate-may-detach-buffer.js prototype/find/prop-desc.js @@ -2582,13 +2635,12 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/forEach/arraylength-internal.js prototype/forEach/callbackfn-detachbuffer.js prototype/forEach/callbackfn-resize.js {unsupported: [resizable-arraybuffer]} - prototype/forEach/callbackfn-set-value-during-interaction.js {unsupported: [Reflect.set]} prototype/forEach/detached-buffer.js prototype/forEach/invoked-as-func.js prototype/forEach/invoked-as-method.js prototype/forEach/length.js prototype/forEach/name.js - prototype/forEach/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/forEach/not-a-constructor.js prototype/forEach/prop-desc.js prototype/forEach/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/forEach/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} @@ -2608,7 +2660,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/includes/invoked-as-method.js prototype/includes/length.js prototype/includes/name.js - prototype/includes/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/includes/not-a-constructor.js prototype/includes/prop-desc.js prototype/includes/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/includes/resizable-buffer-special-float-values.js {unsupported: [resizable-arraybuffer]} @@ -2626,7 +2678,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/indexOf/invoked-as-method.js prototype/indexOf/length.js prototype/indexOf/name.js - prototype/indexOf/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/indexOf/not-a-constructor.js prototype/indexOf/prop-desc.js prototype/indexOf/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/indexOf/resizable-buffer-special-float-values.js {unsupported: [resizable-arraybuffer]} @@ -2643,7 +2695,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/join/invoked-as-method.js prototype/join/length.js prototype/join/name.js - prototype/join/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/join/not-a-constructor.js prototype/join/prop-desc.js prototype/join/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/join/return-abrupt-from-this-out-of-bounds.js {unsupported: [resizable-arraybuffer]} @@ -2656,7 +2708,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/keys/invoked-as-method.js prototype/keys/length.js prototype/keys/name.js - prototype/keys/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/keys/not-a-constructor.js prototype/keys/prop-desc.js prototype/keys/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/keys/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} @@ -2675,7 +2727,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/lastIndexOf/invoked-as-method.js prototype/lastIndexOf/length.js prototype/lastIndexOf/name.js - prototype/lastIndexOf/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/lastIndexOf/not-a-constructor.js prototype/lastIndexOf/prop-desc.js prototype/lastIndexOf/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/lastIndexOf/resizable-buffer-special-float-values.js {unsupported: [resizable-arraybuffer]} @@ -2699,13 +2751,12 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/map/arraylength-internal.js prototype/map/callbackfn-detachbuffer.js prototype/map/callbackfn-resize.js {unsupported: [resizable-arraybuffer]} - prototype/map/callbackfn-set-value-during-interaction.js {unsupported: [Reflect.set]} prototype/map/detached-buffer.js prototype/map/invoked-as-func.js prototype/map/invoked-as-method.js prototype/map/length.js prototype/map/name.js - prototype/map/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/map/not-a-constructor.js prototype/map/prop-desc.js prototype/map/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/map/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} @@ -2725,14 +2776,13 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/reduceRight/BigInt 19/19 (100.0%) prototype/reduceRight/callbackfn-detachbuffer.js prototype/reduceRight/callbackfn-resize.js {unsupported: [resizable-arraybuffer]} - prototype/reduceRight/callbackfn-set-value-during-iteration.js {unsupported: [Reflect.set]} prototype/reduceRight/detached-buffer.js prototype/reduceRight/get-length-uses-internal-arraylength.js prototype/reduceRight/invoked-as-func.js prototype/reduceRight/invoked-as-method.js prototype/reduceRight/length.js prototype/reduceRight/name.js - prototype/reduceRight/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/reduceRight/not-a-constructor.js prototype/reduceRight/prop-desc.js prototype/reduceRight/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/reduceRight/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} @@ -2742,14 +2792,13 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/reduceRight/this-is-not-typedarray-instance.js prototype/reduce/callbackfn-detachbuffer.js prototype/reduce/callbackfn-resize.js {unsupported: [resizable-arraybuffer]} - prototype/reduce/callbackfn-set-value-during-iteration.js {unsupported: [Reflect.set]} prototype/reduce/detached-buffer.js prototype/reduce/get-length-uses-internal-arraylength.js prototype/reduce/invoked-as-func.js prototype/reduce/invoked-as-method.js prototype/reduce/length.js prototype/reduce/name.js - prototype/reduce/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/reduce/not-a-constructor.js prototype/reduce/prop-desc.js prototype/reduce/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/reduce/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} @@ -2764,7 +2813,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/reverse/invoked-as-method.js prototype/reverse/length.js prototype/reverse/name.js - prototype/reverse/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/reverse/not-a-constructor.js prototype/reverse/prop-desc.js prototype/reverse/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/reverse/return-abrupt-from-this-out-of-bounds.js {unsupported: [resizable-arraybuffer]} @@ -2793,7 +2842,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/set/invoked-as-method.js prototype/set/length.js prototype/set/name.js - prototype/set/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/set/not-a-constructor.js prototype/set/prop-desc.js prototype/set/src-typedarray-big-throws.js prototype/set/target-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} @@ -2834,7 +2883,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/slice/invoked-as-method.js prototype/slice/length.js prototype/slice/name.js - prototype/slice/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/slice/not-a-constructor.js prototype/slice/prop-desc.js prototype/slice/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/slice/return-abrupt-from-this-out-of-bounds.js {unsupported: [resizable-arraybuffer]} @@ -2850,14 +2899,13 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/some/BigInt 16/16 (100.0%) prototype/some/callbackfn-detachbuffer.js prototype/some/callbackfn-resize.js {unsupported: [resizable-arraybuffer]} - prototype/some/callbackfn-set-value-during-interaction.js {unsupported: [Reflect.set]} prototype/some/detached-buffer.js prototype/some/get-length-uses-internal-arraylength.js prototype/some/invoked-as-func.js prototype/some/invoked-as-method.js prototype/some/length.js prototype/some/name.js - prototype/some/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/some/not-a-constructor.js prototype/some/prop-desc.js prototype/some/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/some/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} @@ -2875,7 +2923,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/sort/invoked-as-method.js prototype/sort/length.js prototype/sort/name.js - prototype/sort/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/sort/not-a-constructor.js prototype/sort/prop-desc.js prototype/sort/resizable-buffer-default-comparator.js {unsupported: [resizable-arraybuffer]} prototype/sort/return-abrupt-from-this-out-of-bounds.js {unsupported: [resizable-arraybuffer]} @@ -2891,7 +2939,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/subarray/invoked-as-method.js prototype/subarray/length.js prototype/subarray/name.js - prototype/subarray/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/subarray/not-a-constructor.js prototype/subarray/prop-desc.js prototype/subarray/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/subarray/result-byteOffset-from-out-of-bounds.js {unsupported: [resizable-arraybuffer]} @@ -2908,7 +2956,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/subarray/speciesctor-get-species-returns-throws.js prototype/subarray/this-is-not-object.js prototype/subarray/this-is-not-typedarray-instance.js - prototype/Symbol.iterator/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/Symbol.iterator/not-a-constructor.js prototype/Symbol.toStringTag/BigInt 9/9 (100.0%) prototype/Symbol.toStringTag/detached-buffer.js prototype/Symbol.toStringTag/invoked-as-accessor.js @@ -2925,7 +2973,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/toLocaleString/invoked-as-method.js prototype/toLocaleString/length.js prototype/toLocaleString/name.js - prototype/toLocaleString/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toLocaleString/not-a-constructor.js prototype/toLocaleString/prop-desc.js prototype/toLocaleString/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/toLocaleString/return-abrupt-from-this-out-of-bounds.js {unsupported: [resizable-arraybuffer]} @@ -2935,11 +2983,11 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/toLocaleString/user-provided-tolocalestring-shrink.js {unsupported: [resizable-arraybuffer]} prototype/toReversed/metadata 3/3 (100.0%) prototype/toReversed/length-property-ignored.js - prototype/toReversed/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toReversed/not-a-constructor.js prototype/toReversed/this-value-invalid.js prototype/toSorted/metadata 3/3 (100.0%) prototype/toSorted/length-property-ignored.js - prototype/toSorted/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/toSorted/not-a-constructor.js prototype/toSorted/this-value-invalid.js prototype/toString/BigInt/detached-buffer.js prototype/toString 2/2 (100.0%) @@ -2951,7 +2999,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/values/make-in-bounds-after-exhausted.js {unsupported: [resizable-arraybuffer]} prototype/values/make-out-of-bounds-after-exhausted.js {unsupported: [resizable-arraybuffer]} prototype/values/name.js - prototype/values/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/values/not-a-constructor.js prototype/values/prop-desc.js prototype/values/resizable-buffer.js {unsupported: [resizable-arraybuffer]} prototype/values/resizable-buffer-grow-mid-iteration.js {unsupported: [resizable-arraybuffer]} @@ -2963,7 +3011,7 @@ built-ins/TypedArray 1091/1422 (76.72%) prototype/with/metadata 3/3 (100.0%) prototype/with/index-validated-against-current-length.js {unsupported: [resizable-arraybuffer]} prototype/with/length-property-ignored.js - prototype/with/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/with/not-a-constructor.js prototype 4/4 (100.0%) Symbol.species 4/4 (100.0%) invoked.js @@ -2975,7 +3023,7 @@ built-ins/TypedArray 1091/1422 (76.72%) resizable-buffer-length-tracking-1.js {unsupported: [resizable-arraybuffer]} resizable-buffer-length-tracking-2.js {unsupported: [resizable-arraybuffer]} -built-ins/TypedArrayConstructors 597/735 (81.22%) +built-ins/TypedArrayConstructors 566/735 (77.01%) BigInt64Array/prototype 4/4 (100.0%) BigInt64Array 8/8 (100.0%) BigUint64Array/prototype 4/4 (100.0%) @@ -2993,8 +3041,8 @@ built-ins/TypedArrayConstructors 597/735 (81.22%) ctors/buffer-arg/byteoffset-throws-from-modulo-element-size-sab.js {unsupported: [SharedArrayBuffer]} ctors/buffer-arg/byteoffset-to-number-detachbuffer.js ctors/buffer-arg/byteoffset-to-number-throws-sab.js {unsupported: [SharedArrayBuffer]} - ctors/buffer-arg/custom-proto-access-throws.js {unsupported: [Reflect]} - ctors/buffer-arg/custom-proto-access-throws-sab.js {unsupported: [SharedArrayBuffer, Reflect]} + ctors/buffer-arg/custom-proto-access-throws.js + ctors/buffer-arg/custom-proto-access-throws-sab.js {unsupported: [SharedArrayBuffer]} ctors/buffer-arg/defined-length-and-offset-sab.js {unsupported: [SharedArrayBuffer]} ctors/buffer-arg/defined-length-sab.js {unsupported: [SharedArrayBuffer]} ctors/buffer-arg/defined-negative-length.js @@ -3010,31 +3058,25 @@ built-ins/TypedArrayConstructors 597/735 (81.22%) ctors/buffer-arg/length-is-symbol-throws-sab.js {unsupported: [SharedArrayBuffer]} ctors/buffer-arg/length-to-number-detachbuffer.js ctors/buffer-arg/new-instance-extensibility-sab.js {unsupported: [SharedArrayBuffer]} - ctors/buffer-arg/proto-from-ctor-realm.js {unsupported: [Reflect]} - ctors/buffer-arg/proto-from-ctor-realm-sab.js {unsupported: [SharedArrayBuffer, Reflect]} + ctors/buffer-arg/proto-from-ctor-realm.js + ctors/buffer-arg/proto-from-ctor-realm-sab.js {unsupported: [SharedArrayBuffer]} ctors/buffer-arg/resizable-out-of-bounds.js {unsupported: [resizable-arraybuffer]} ctors/buffer-arg/returns-new-instance-sab.js {unsupported: [SharedArrayBuffer]} ctors/buffer-arg/toindex-bytelength-sab.js {unsupported: [SharedArrayBuffer]} ctors/buffer-arg/toindex-byteoffset-sab.js {unsupported: [SharedArrayBuffer]} ctors/buffer-arg/typedarray-backed-by-sharedarraybuffer.js {unsupported: [SharedArrayBuffer]} - ctors/buffer-arg/use-custom-proto-if-object.js {unsupported: [Reflect]} - ctors/buffer-arg/use-custom-proto-if-object-sab.js {unsupported: [SharedArrayBuffer, Reflect]} - ctors/buffer-arg/use-default-proto-if-custom-proto-is-not-object.js + ctors/buffer-arg/use-custom-proto-if-object-sab.js {unsupported: [SharedArrayBuffer]} ctors/buffer-arg/use-default-proto-if-custom-proto-is-not-object-sab.js {unsupported: [SharedArrayBuffer]} - ctors/length-arg/custom-proto-access-throws.js {unsupported: [Reflect]} + ctors/length-arg/custom-proto-access-throws.js ctors/length-arg/is-infinity-throws-rangeerror.js ctors/length-arg/is-negative-integer-throws-rangeerror.js ctors/length-arg/is-symbol-throws.js - ctors/length-arg/proto-from-ctor-realm.js {unsupported: [Reflect]} + ctors/length-arg/proto-from-ctor-realm.js ctors/length-arg/toindex-length.js - ctors/length-arg/use-custom-proto-if-object.js {unsupported: [Reflect]} - ctors/length-arg/use-default-proto-if-custom-proto-is-not-object.js - ctors/no-args/custom-proto-access-throws.js {unsupported: [Reflect]} - ctors/no-args/proto-from-ctor-realm.js {unsupported: [Reflect]} - ctors/no-args/use-custom-proto-if-object.js {unsupported: [Reflect]} - ctors/no-args/use-default-proto-if-custom-proto-is-not-object.js + ctors/no-args/custom-proto-access-throws.js + ctors/no-args/proto-from-ctor-realm.js ctors/object-arg/as-generator-iterable-returns.js - ctors/object-arg/custom-proto-access-throws.js {unsupported: [Reflect]} + ctors/object-arg/custom-proto-access-throws.js ctors/object-arg/iterated-array-changed-by-tonumber.js ctors/object-arg/iterated-array-with-modified-array-iterator.js ctors/object-arg/iterating-throws.js @@ -3045,28 +3087,22 @@ built-ins/TypedArrayConstructors 597/735 (81.22%) ctors/object-arg/length-is-symbol-throws.js ctors/object-arg/length-throws.js ctors/object-arg/new-instance-extensibility.js - ctors/object-arg/proto-from-ctor-realm.js {unsupported: [Reflect]} + ctors/object-arg/proto-from-ctor-realm.js ctors/object-arg/returns.js ctors/object-arg/throws-from-property.js ctors/object-arg/throws-setting-obj-to-primitive.js ctors/object-arg/throws-setting-obj-to-primitive-typeerror.js ctors/object-arg/throws-setting-property.js ctors/object-arg/throws-setting-symbol-property.js - ctors/object-arg/use-custom-proto-if-object.js {unsupported: [Reflect]} - ctors/object-arg/use-default-proto-if-custom-proto-is-not-object.js - ctors/typedarray-arg/custom-proto-access-throws.js {unsupported: [Reflect]} - ctors/typedarray-arg/proto-from-ctor-realm.js {unsupported: [Reflect]} + ctors/typedarray-arg/custom-proto-access-throws.js + ctors/typedarray-arg/proto-from-ctor-realm.js ctors/typedarray-arg/src-typedarray-big-throws.js ctors/typedarray-arg/src-typedarray-resizable-buffer.js {unsupported: [resizable-arraybuffer]} - ctors/typedarray-arg/use-custom-proto-if-object.js {unsupported: [Reflect]} - ctors/typedarray-arg/use-default-proto-if-custom-proto-is-not-object.js ctors/no-species.js Float32Array/prototype/not-typedarray-object.js Float32Array/prototype/proto.js - Float32Array/is-a-constructor.js {unsupported: [Reflect.construct]} Float64Array/prototype/not-typedarray-object.js Float64Array/prototype/proto.js - Float64Array/is-a-constructor.js {unsupported: [Reflect.construct]} from/BigInt 28/28 (100.0%) from/arylk-get-length-error.js from/arylk-to-length-error.js @@ -3093,41 +3129,34 @@ built-ins/TypedArrayConstructors 597/735 (81.22%) from/set-value-abrupt-completion.js Int16Array/prototype/not-typedarray-object.js Int16Array/prototype/proto.js - Int16Array/is-a-constructor.js {unsupported: [Reflect.construct]} Int32Array/prototype/not-typedarray-object.js Int32Array/prototype/proto.js - Int32Array/is-a-constructor.js {unsupported: [Reflect.construct]} Int8Array/prototype/not-typedarray-object.js Int8Array/prototype/proto.js - Int8Array/is-a-constructor.js {unsupported: [Reflect.construct]} internals/DefineOwnProperty/BigInt 26/26 (100.0%) internals/DefineOwnProperty/conversion-operation.js internals/DefineOwnProperty/conversion-operation-consistent-nan.js internals/DefineOwnProperty/desc-value-throws.js - internals/DefineOwnProperty/detached-buffer.js {unsupported: [Reflect]} + internals/DefineOwnProperty/detached-buffer.js internals/DefineOwnProperty/detached-buffer-throws.js internals/DefineOwnProperty/detached-buffer-throws-realm.js - internals/DefineOwnProperty/key-is-greater-than-last-index.js {unsupported: [Reflect]} - internals/DefineOwnProperty/key-is-lower-than-zero.js {unsupported: [Reflect]} - internals/DefineOwnProperty/key-is-minus-zero.js {unsupported: [Reflect]} - internals/DefineOwnProperty/key-is-not-canonical-index.js {unsupported: [Reflect]} - internals/DefineOwnProperty/key-is-not-integer.js {unsupported: [Reflect]} - internals/DefineOwnProperty/key-is-not-numeric-index.js {unsupported: [Reflect]} - internals/DefineOwnProperty/key-is-numericindex.js {unsupported: [Reflect]} - internals/DefineOwnProperty/key-is-numericindex-accessor-desc.js {unsupported: [Reflect]} + internals/DefineOwnProperty/key-is-greater-than-last-index.js + internals/DefineOwnProperty/key-is-lower-than-zero.js + internals/DefineOwnProperty/key-is-minus-zero.js + internals/DefineOwnProperty/key-is-not-canonical-index.js + internals/DefineOwnProperty/key-is-not-integer.js + internals/DefineOwnProperty/key-is-numericindex.js + internals/DefineOwnProperty/key-is-numericindex-accessor-desc.js internals/DefineOwnProperty/key-is-numericindex-accessor-desc-throws.js - internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js {unsupported: [Reflect]} + internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js internals/DefineOwnProperty/key-is-numericindex-desc-not-configurable-throws.js - internals/DefineOwnProperty/key-is-numericindex-desc-not-enumerable.js {unsupported: [Reflect]} + internals/DefineOwnProperty/key-is-numericindex-desc-not-enumerable.js internals/DefineOwnProperty/key-is-numericindex-desc-not-enumerable-throws.js - internals/DefineOwnProperty/key-is-numericindex-desc-not-writable.js {unsupported: [Reflect]} + internals/DefineOwnProperty/key-is-numericindex-desc-not-writable.js internals/DefineOwnProperty/key-is-numericindex-desc-not-writable-throws.js - internals/DefineOwnProperty/key-is-symbol.js {unsupported: [Reflect]} - internals/DefineOwnProperty/non-extensible-new-key.js {unsupported: [Reflect]} - internals/DefineOwnProperty/non-extensible-redefine-key.js {unsupported: [Reflect]} - internals/DefineOwnProperty/set-value.js {unsupported: [Reflect]} - internals/DefineOwnProperty/this-is-not-extensible.js {unsupported: [Reflect]} - internals/DefineOwnProperty/tonumber-value-detached-buffer.js {unsupported: [Reflect]} + internals/DefineOwnProperty/non-extensible-redefine-key.js + internals/DefineOwnProperty/set-value.js + internals/DefineOwnProperty/tonumber-value-detached-buffer.js internals/Delete/BigInt 19/19 (100.0%) internals/Delete/detached-buffer.js internals/Delete/detached-buffer-key-is-not-numeric-index.js @@ -3147,7 +3176,6 @@ built-ins/TypedArrayConstructors 597/735 (81.22%) internals/Delete/key-is-not-numeric-index-strict.js strict internals/Delete/key-is-out-of-bounds-non-strict.js non-strict internals/Delete/key-is-out-of-bounds-strict.js strict - internals/Delete/key-is-symbol.js internals/Get/BigInt 14/14 (100.0%) internals/GetOwnProperty/BigInt 12/12 (100.0%) internals/GetOwnProperty/detached-buffer.js @@ -3170,31 +3198,40 @@ built-ins/TypedArrayConstructors 597/735 (81.22%) internals/Get/key-is-out-of-bounds.js internals/Get/key-is-symbol.js internals/HasProperty/BigInt 15/15 (100.0%) - internals/HasProperty 17/17 (100.0%) + internals/HasProperty/abrupt-from-ordinary-has-parent-hasproperty.js + internals/HasProperty/detached-buffer.js + internals/HasProperty/detached-buffer-key-is-not-number.js + internals/HasProperty/detached-buffer-key-is-symbol.js + internals/HasProperty/detached-buffer-realm.js + internals/HasProperty/infinity-with-detached-buffer.js non-strict + internals/HasProperty/inherited-property.js + internals/HasProperty/key-is-greater-than-last-index.js + internals/HasProperty/key-is-lower-than-zero.js + internals/HasProperty/key-is-minus-zero.js + internals/HasProperty/key-is-not-canonical-index.js + internals/HasProperty/key-is-not-integer.js + internals/HasProperty/resizable-array-buffer-auto.js {unsupported: [resizable-arraybuffer]} + internals/HasProperty/resizable-array-buffer-fixed.js {unsupported: [resizable-arraybuffer]} internals/OwnPropertyKeys/BigInt 4/4 (100.0%) internals/OwnPropertyKeys 6/6 (100.0%) internals/Set/BigInt 27/27 (100.0%) internals/Set/detached-buffer.js - internals/Set/detached-buffer-key-is-not-numeric-index.js {unsupported: [Reflect]} - internals/Set/detached-buffer-key-is-symbol.js {unsupported: [Reflect]} + internals/Set/detached-buffer-key-is-not-numeric-index.js + internals/Set/detached-buffer-key-is-symbol.js internals/Set/detached-buffer-realm.js - internals/Set/indexed-value.js {unsupported: [Reflect]} - internals/Set/key-is-canonical-invalid-index-prototype-chain-set.js {unsupported: [Proxy]} - internals/Set/key-is-canonical-invalid-index-reflect-set.js {unsupported: [Reflect]} - internals/Set/key-is-in-bounds-receiver-is-not-typed-array.js {unsupported: [Reflect.set]} - internals/Set/key-is-minus-zero.js {unsupported: [Reflect]} - internals/Set/key-is-not-canonical-index.js {unsupported: [Reflect]} - internals/Set/key-is-not-integer.js {unsupported: [Reflect]} - internals/Set/key-is-not-numeric-index.js {unsupported: [Reflect]} - internals/Set/key-is-out-of-bounds.js {unsupported: [Reflect]} - internals/Set/key-is-out-of-bounds-receiver-is-not-object.js {unsupported: [Reflect.set]} - internals/Set/key-is-out-of-bounds-receiver-is-not-typed-array.js {unsupported: [Reflect.set]} - internals/Set/key-is-out-of-bounds-receiver-is-proto.js {unsupported: [Reflect.set]} - internals/Set/key-is-symbol.js {unsupported: [Reflect]} - internals/Set/key-is-valid-index-prototype-chain-set.js {unsupported: [Proxy]} - internals/Set/key-is-valid-index-reflect-set.js {unsupported: [Reflect]} + internals/Set/indexed-value.js + internals/Set/key-is-canonical-invalid-index-prototype-chain-set.js + internals/Set/key-is-canonical-invalid-index-reflect-set.js + internals/Set/key-is-in-bounds-receiver-is-not-typed-array.js + internals/Set/key-is-not-canonical-index.js + internals/Set/key-is-not-numeric-index.js + internals/Set/key-is-out-of-bounds-receiver-is-not-object.js + internals/Set/key-is-out-of-bounds-receiver-is-proto.js + internals/Set/key-is-symbol.js + internals/Set/key-is-valid-index-prototype-chain-set.js + internals/Set/key-is-valid-index-reflect-set.js internals/Set/resized-out-of-bounds-to-in-bounds-index.js {unsupported: [resizable-arraybuffer]} - internals/Set/tonumber-value-detached-buffer.js {unsupported: [Reflect]} + internals/Set/tonumber-value-detached-buffer.js internals/Set/tonumber-value-throws.js of/BigInt 12/12 (100.0%) of/argument-number-value-throws.js @@ -3237,78 +3274,72 @@ built-ins/TypedArrayConstructors 597/735 (81.22%) prototype 2/2 (100.0%) Uint16Array/prototype/not-typedarray-object.js Uint16Array/prototype/proto.js - Uint16Array/is-a-constructor.js {unsupported: [Reflect.construct]} Uint32Array/prototype/not-typedarray-object.js Uint32Array/prototype/proto.js - Uint32Array/is-a-constructor.js {unsupported: [Reflect.construct]} Uint8Array/prototype/not-typedarray-object.js Uint8Array/prototype/proto.js - Uint8Array/is-a-constructor.js {unsupported: [Reflect.construct]} Uint8ClampedArray/prototype/not-typedarray-object.js Uint8ClampedArray/prototype/proto.js - Uint8ClampedArray/is-a-constructor.js {unsupported: [Reflect.construct]} -built-ins/WeakMap 15/102 (14.71%) +built-ins/WeakMap 14/102 (13.73%) prototype/delete/delete-entry-with-symbol-key.js prototype/delete/delete-entry-with-symbol-key-initial-iterable.js - prototype/delete/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/delete/not-a-constructor.js prototype/delete/returns-false-when-symbol-key-not-present.js - prototype/get/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/get/not-a-constructor.js prototype/get/returns-undefined-with-symbol-key.js prototype/get/returns-value-with-symbol-key.js - prototype/has/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/has/not-a-constructor.js prototype/has/returns-false-when-symbol-key-not-present.js prototype/has/returns-true-when-symbol-key-present.js prototype/set/adds-symbol-element.js - prototype/set/not-a-constructor.js {unsupported: [Reflect.construct]} - is-a-constructor.js {unsupported: [Reflect.construct]} + prototype/set/not-a-constructor.js iterable-with-symbol-keys.js - proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm.js ~built-ins/WeakRef -built-ins/WeakSet 12/85 (14.12%) +built-ins/WeakSet 11/85 (12.94%) prototype/add/adds-symbol-element.js - prototype/add/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/add/not-a-constructor.js prototype/add/returns-this-symbol.js prototype/add/returns-this-when-ignoring-duplicate-symbol.js prototype/delete/delete-symbol-entry.js - prototype/delete/not-a-constructor.js {unsupported: [Reflect.construct]} - prototype/has/not-a-constructor.js {unsupported: [Reflect.construct]} + prototype/delete/not-a-constructor.js + prototype/has/not-a-constructor.js prototype/has/returns-false-when-symbol-value-not-present.js prototype/has/returns-true-when-symbol-value-present.js - is-a-constructor.js {unsupported: [Reflect.construct]} iterable-with-symbol-values.js - proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm.js built-ins/decodeURI 3/55 (5.45%) - not-a-constructor.js {unsupported: [Reflect.construct]} + not-a-constructor.js S15.1.3.1_A2.4_T1.js S15.1.3.1_A5.2.js built-ins/decodeURIComponent 3/55 (5.45%) - not-a-constructor.js {unsupported: [Reflect.construct]} + not-a-constructor.js S15.1.3.2_A2.4_T1.js S15.1.3.2_A5.2.js built-ins/encodeURI 2/31 (6.45%) - not-a-constructor.js {unsupported: [Reflect.construct]} + not-a-constructor.js S15.1.3.3_A5.2.js built-ins/encodeURIComponent 2/31 (6.45%) - not-a-constructor.js {unsupported: [Reflect.construct]} + not-a-constructor.js S15.1.3.4_A5.2.js built-ins/eval 3/10 (30.0%) length-non-configurable.js - not-a-constructor.js {unsupported: [Reflect.construct]} + not-a-constructor.js private-identifiers-not-empty.js {unsupported: [class-fields-private]} built-ins/global 0/29 (0.0%) built-ins/isFinite 8/17 (47.06%) length.js - not-a-constructor.js {unsupported: [Reflect.construct]} + not-a-constructor.js toprimitive-call-abrupt.js toprimitive-get-abrupt.js toprimitive-not-callable-throws.js @@ -3318,7 +3349,7 @@ built-ins/isFinite 8/17 (47.06%) built-ins/isNaN 8/17 (47.06%) length.js - not-a-constructor.js {unsupported: [Reflect.construct]} + not-a-constructor.js toprimitive-call-abrupt.js toprimitive-get-abrupt.js toprimitive-not-callable-throws.js @@ -3327,12 +3358,12 @@ built-ins/isNaN 8/17 (47.06%) toprimitive-valid-result.js built-ins/parseFloat 3/59 (5.08%) - not-a-constructor.js {unsupported: [Reflect.construct]} + not-a-constructor.js S15.1.2.3_A2_T10_U180E.js {unsupported: [u180e]} S15.1.2.3_A7.2.js built-ins/parseInt 3/60 (5.0%) - not-a-constructor.js {unsupported: [Reflect.construct]} + not-a-constructor.js S15.1.2.2_A2_T10_U180E.js {unsupported: [u180e]} S15.1.2.2_A9.2.js @@ -5867,9 +5898,9 @@ language/expressions/object 863/1169 (73.82%) dstr/meth-obj-ptrn-rest-getter.js {unsupported: [object-rest]} dstr/meth-obj-ptrn-rest-skip-non-enumerable.js {unsupported: [object-rest]} dstr/meth-obj-ptrn-rest-val-obj.js {unsupported: [object-rest]} - dstr/object-rest-proxy-get-not-called-on-dontenum-keys.js {unsupported: [Proxy, object-rest]} - dstr/object-rest-proxy-gopd-not-called-on-excluded-keys.js {unsupported: [Proxy, object-rest]} - dstr/object-rest-proxy-ownkeys-returned-keys-order.js {unsupported: [Proxy, object-rest]} + dstr/object-rest-proxy-get-not-called-on-dontenum-keys.js {unsupported: [object-rest]} + dstr/object-rest-proxy-gopd-not-called-on-excluded-keys.js {unsupported: [object-rest]} + dstr/object-rest-proxy-ownkeys-returned-keys-order.js {unsupported: [object-rest]} method-definition/forbidden-ext/b1/async-gen-meth-forbidden-ext-direct-access-prop-arguments.js {unsupported: [async-iteration, async]} method-definition/forbidden-ext/b1/async-gen-meth-forbidden-ext-direct-access-prop-caller.js {unsupported: [async-iteration, async]} method-definition/forbidden-ext/b1/async-meth-forbidden-ext-direct-access-prop-arguments.js {unsupported: [async-functions, async]} @@ -6161,11 +6192,11 @@ language/expressions/object 863/1169 (73.82%) let-non-strict-syntax.js non-strict literal-property-name-bigint.js {unsupported: [class]} method.js - object-spread-proxy-get-not-called-on-dontenum-keys.js {unsupported: [Proxy]} - object-spread-proxy-no-excluded-keys.js {unsupported: [Proxy]} - object-spread-proxy-ownkeys-returned-keys-order.js {unsupported: [Proxy]} + object-spread-proxy-get-not-called-on-dontenum-keys.js + object-spread-proxy-no-excluded-keys.js + object-spread-proxy-ownkeys-returned-keys-order.js prop-def-id-eval-error.js non-strict - prop-def-id-eval-error-2.js {unsupported: [Proxy]} + prop-def-id-eval-error-2.js non-strict prop-dup-data-data.js strict prop-dup-data-set.js strict prop-dup-get-data.js strict @@ -6281,9 +6312,7 @@ language/expressions/template-literal 2/57 (3.51%) language/expressions/this 0/6 (0.0%) -language/expressions/typeof 2/16 (12.5%) - built-in-ordinary-objects-no-call.js - proxy.js {unsupported: [Proxy]} +language/expressions/typeof 0/16 (0.0%) language/expressions/unary-minus 1/14 (7.14%) bigint-non-primitive.js @@ -6471,39 +6500,23 @@ language/global-code 30/42 (71.43%) language/identifier-resolution 0/14 (0.0%) -language/identifiers 84/248 (33.87%) - other_id_continue.js - other_id_continue-escaped.js - other_id_start.js - other_id_start-escaped.js +language/identifiers 61/248 (24.6%) part-unicode-10.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-10.0.0-class-escaped.js {unsupported: [class-fields-private, class]} - part-unicode-11.0.0.js part-unicode-11.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-11.0.0-class-escaped.js {unsupported: [class-fields-private, class]} - part-unicode-11.0.0-escaped.js - part-unicode-12.0.0.js part-unicode-12.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-12.0.0-class-escaped.js {unsupported: [class-fields-private, class]} - part-unicode-12.0.0-escaped.js - part-unicode-13.0.0.js part-unicode-13.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-13.0.0-class-escaped.js {unsupported: [class-fields-private, class]} - part-unicode-13.0.0-escaped.js - part-unicode-14.0.0.js part-unicode-14.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-14.0.0-class-escaped.js {unsupported: [class-fields-private, class]} - part-unicode-14.0.0-escaped.js - part-unicode-15.0.0.js part-unicode-15.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-15.0.0-class-escaped.js {unsupported: [class-fields-private, class]} - part-unicode-15.0.0-escaped.js part-unicode-15.1.0-class.js {unsupported: [class-fields-private, class]} part-unicode-15.1.0-class-escaped.js {unsupported: [class-fields-private, class]} - part-unicode-5.2.0.js part-unicode-5.2.0-class.js {unsupported: [class-fields-private, class]} part-unicode-5.2.0-class-escaped.js {unsupported: [class-fields-private, class]} - part-unicode-5.2.0-escaped.js part-unicode-6.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-6.0.0-class-escaped.js {unsupported: [class-fields-private, class]} part-unicode-6.1.0-class.js {unsupported: [class-fields-private, class]} @@ -6519,23 +6532,16 @@ language/identifiers 84/248 (33.87%) start-unicode-11.0.0.js start-unicode-11.0.0-class.js {unsupported: [class-fields-private, class]} start-unicode-11.0.0-class-escaped.js {unsupported: [class-fields-private, class]} - start-unicode-11.0.0-escaped.js - start-unicode-12.0.0.js start-unicode-12.0.0-class.js {unsupported: [class-fields-private, class]} start-unicode-12.0.0-class-escaped.js {unsupported: [class-fields-private, class]} - start-unicode-12.0.0-escaped.js start-unicode-13.0.0.js start-unicode-13.0.0-class.js {unsupported: [class-fields-private, class]} start-unicode-13.0.0-class-escaped.js {unsupported: [class-fields-private, class]} - start-unicode-13.0.0-escaped.js - start-unicode-14.0.0.js start-unicode-14.0.0-class.js {unsupported: [class-fields-private, class]} start-unicode-14.0.0-class-escaped.js {unsupported: [class-fields-private, class]} - start-unicode-14.0.0-escaped.js start-unicode-15.0.0.js start-unicode-15.0.0-class.js {unsupported: [class-fields-private, class]} start-unicode-15.0.0-class-escaped.js {unsupported: [class-fields-private, class]} - start-unicode-15.0.0-escaped.js start-unicode-5.2.0.js start-unicode-5.2.0-class.js {unsupported: [class-fields-private, class]} start-unicode-5.2.0-class-escaped.js {unsupported: [class-fields-private, class]} @@ -7114,7 +7120,7 @@ language/statements/for-in 40/115 (34.78%) scope-head-lex-open.js scope-head-var-none.js non-strict -language/statements/for-of 482/741 (65.05%) +language/statements/for-of 481/741 (64.91%) dstr/array-elem-init-assignment.js dstr/array-elem-init-evaluation.js dstr/array-elem-init-fn-name-arrow.js @@ -7568,7 +7574,6 @@ language/statements/for-of 482/741 (65.05%) head-var-bound-names-let.js non-strict head-var-init.js head-var-no-expr.js - iterator-as-proxy.js {unsupported: [Proxy]} iterator-close-non-object.js iterator-close-non-throw-get-method-abrupt.js iterator-close-non-throw-get-method-is-null.js @@ -8518,7 +8523,7 @@ language/statements/with 26/175 (14.86%) decl-let.js non-strict get-mutable-binding-binding-deleted-in-get-unscopables.js non-strict get-mutable-binding-binding-deleted-in-get-unscopables-strict-mode.js non-strict - has-property-err.js {unsupported: [Proxy]} + has-property-err.js non-strict labelled-fn-stmt.js non-strict let-array-with-newline.js non-strict let-block-with-newline.js non-strict @@ -8539,8 +8544,8 @@ language/types 9/113 (7.96%) number/S8.5_A4_T1.js number/S8.5_A4_T2.js non-strict reference/get-value-prop-base-primitive-realm.js - reference/put-value-prop-base-primitive.js {unsupported: [Proxy]} - reference/put-value-prop-base-primitive-realm.js {unsupported: [Proxy]} + reference/put-value-prop-base-primitive.js + reference/put-value-prop-base-primitive-realm.js undefined/S8.1_A3_T1.js undefined/S8.1_A3_T2.js non-strict From ec6f9dd38d0abd5141370b6a20acb31948c1658a Mon Sep 17 00:00:00 2001 From: Ronald Brill Date: Fri, 20 Sep 2024 19:08:24 +0200 Subject: [PATCH 2/4] Reflect - first hack for constructor detection (see #1376) --- .../org/mozilla/javascript/NativeProxy.java | 2 +- .../org/mozilla/javascript/NativeReflect.java | 17 ++++- .../javascript/tests/es6/NativeProxyTest.java | 2 +- .../tests/es6/NativeReflectTest.java | 5 +- tests/testsrc/test262.properties | 72 ++----------------- 5 files changed, 24 insertions(+), 74 deletions(-) diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeProxy.java b/rhino/src/main/java/org/mozilla/javascript/NativeProxy.java index ea58df67b1..df636cd647 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeProxy.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeProxy.java @@ -930,7 +930,7 @@ protected ScriptableObject getOwnPropertyDescriptor(Context cx, Object id) { Object trapResultObj = callTrap(trap, new Object[] {target, id}); if (!Undefined.isUndefined(trapResultObj) && !(trapResultObj instanceof Scriptable - && !ScriptRuntime.isSymbol(trapResultObj))) { + && !ScriptRuntime.isSymbol(trapResultObj))) { throw ScriptRuntime.typeError( "getOwnPropertyDescriptor trap has to return undefined or an object"); } diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeReflect.java b/rhino/src/main/java/org/mozilla/javascript/NativeReflect.java index 7ae6a13e7b..99ce5c44ca 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeReflect.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeReflect.java @@ -142,7 +142,7 @@ private static Scriptable construct( Integer.toString(args.length)); } - if (!(args[0] instanceof Constructable)) { + if (!isConstructor(args[0])) { throw ScriptRuntime.typeErrorById("msg.not.ctor", ScriptRuntime.typeof(args[0])); } @@ -151,7 +151,7 @@ private static Scriptable construct( return ctor.construct(cx, scope, ScriptRuntime.emptyArgs); } - if (args.length > 2 && !(args[2] instanceof Constructable)) { + if (args.length > 2 && !isConstructor(args[2])) { throw ScriptRuntime.typeErrorById("msg.not.ctor", ScriptRuntime.typeof(args[2])); } @@ -198,6 +198,19 @@ private static Scriptable construct( return newScriptable; } + private static boolean isConstructor(final Object argument) { + // Hack for the moment because all Functions are Constructable + // see #1376 for more + if (argument instanceof LambdaConstructor) { + return true; + } + if (argument instanceof LambdaFunction) { + return false; + } + + return argument instanceof Constructable; + } + private static Object defineProperty( Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (args.length < 3) { diff --git a/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeProxyTest.java b/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeProxyTest.java index 1cb3531e61..962e4336d7 100644 --- a/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeProxyTest.java +++ b/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeProxyTest.java @@ -210,7 +210,7 @@ public void definePropertyTrapReturnsFalse() { @Test public void - definePropertyDescNotConfigurableAndTargetPropertyDescriptorConfigurableAndTrapResultIsTrue() { + definePropertyDescNotConfigurableAndTargetPropertyDescriptorConfigurableAndTrapResultIsTrue() { String js = "var target = {};\n" + "var p = new Proxy(target, {\n" diff --git a/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeReflectTest.java b/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeReflectTest.java index 619cd4186b..97c6e73dba 100644 --- a/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeReflectTest.java +++ b/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeReflectTest.java @@ -157,12 +157,11 @@ public void constructNoConstructorObject() { public void constructNoConstructorFunction() { String js = "try {\n" - + " Reflect.construct(function() {}, [], Date.now);\n" + + " Reflect.construct(function() {}, [], Math.abs);\n" + "} catch(e) {\n" + " '' + e;\n" + "}"; - // testString("TypeError: \"object\" is not a constructor.", js); - // found no way to check a function for constructor + testString("TypeError: \"function\" is not a constructor.", js); } @Test diff --git a/tests/testsrc/test262.properties b/tests/testsrc/test262.properties index 109d018fff..10de018648 100644 --- a/tests/testsrc/test262.properties +++ b/tests/testsrc/test262.properties @@ -943,10 +943,9 @@ built-ins/GeneratorPrototype 38/60 (63.33%) built-ins/Infinity 0/6 (0.0%) -built-ins/JSON 29/144 (20.14%) +built-ins/JSON 27/144 (18.75%) parse/builtin.js parse/duplicate-proto.js - parse/not-a-constructor.js parse/revived-proxy.js parse/reviver-array-define-prop-err.js parse/reviver-array-get-prop-from-prototype.js @@ -960,7 +959,6 @@ built-ins/JSON 29/144 (20.14%) parse/S15.12.2_A1.js parse/text-negative-zero.js stringify/builtin.js - stringify/not-a-constructor.js stringify/replacer-array-abrupt.js stringify/replacer-array-proxy.js stringify/replacer-array-wrong-type.js @@ -990,45 +988,10 @@ built-ins/Map 12/171 (7.02%) built-ins/MapIteratorPrototype 0/11 (0.0%) -built-ins/Math 51/327 (15.6%) - abs/not-a-constructor.js - acosh/not-a-constructor.js - acos/not-a-constructor.js - asinh/not-a-constructor.js - asin/not-a-constructor.js - atan2/not-a-constructor.js - atanh/not-a-constructor.js - atan/not-a-constructor.js - cbrt/not-a-constructor.js - ceil/not-a-constructor.js - clz32/not-a-constructor.js - cosh/not-a-constructor.js - cos/not-a-constructor.js - expm1/not-a-constructor.js - exp/not-a-constructor.js +built-ins/Math 16/327 (4.89%) f16round 5/5 (100.0%) - floor/not-a-constructor.js - fround/not-a-constructor.js - hypot/not-a-constructor.js - imul/not-a-constructor.js - log10/not-a-constructor.js - log1p/not-a-constructor.js log2/log2-basicTests.js calculation is not exact - log2/not-a-constructor.js - log/not-a-constructor.js - max/not-a-constructor.js - min/not-a-constructor.js - pow/not-a-constructor.js - random/not-a-constructor.js - round/not-a-constructor.js - sign/not-a-constructor.js - sinh/not-a-constructor.js - sin/not-a-constructor.js - sqrt/not-a-constructor.js sumPrecise 10/10 (100.0%) - tanh/not-a-constructor.js - tan/not-a-constructor.js - trunc/not-a-constructor.js built-ins/NaN 0/6 (0.0%) @@ -1292,7 +1255,7 @@ built-ins/Object 212/3408 (6.22%) proto-from-ctor-realm.js subclass-object-arg.js {unsupported: [class]} -built-ins/Promise 403/631 (63.87%) +built-ins/Promise 392/631 (62.12%) allSettled/capability-resolve-throws-reject.js {unsupported: [async]} allSettled/ctx-ctor.js {unsupported: [class]} allSettled/does-not-invoke-array-setters.js {unsupported: [async]} @@ -1329,7 +1292,6 @@ built-ins/Promise 403/631 (63.87%) allSettled/iter-returns-true-reject.js {unsupported: [async]} allSettled/iter-returns-undefined-reject.js {unsupported: [async]} allSettled/iter-step-err-reject.js {unsupported: [async]} - allSettled/not-a-constructor.js allSettled/reject-deferred.js {unsupported: [async]} allSettled/reject-element-function-property-order.js allSettled/reject-ignored-deferred.js {unsupported: [async]} @@ -1388,7 +1350,6 @@ built-ins/Promise 403/631 (63.87%) all/iter-returns-true-reject.js {unsupported: [async]} all/iter-returns-undefined-reject.js {unsupported: [async]} all/iter-step-err-reject.js {unsupported: [async]} - all/not-a-constructor.js all/reject-deferred.js {unsupported: [async]} all/reject-ignored-deferred.js {unsupported: [async]} all/reject-ignored-immed.js {unsupported: [async]} @@ -1464,7 +1425,6 @@ built-ins/Promise 403/631 (63.87%) any/iter-returns-undefined-reject.js {unsupported: [async]} any/iter-step-err-no-close.js {unsupported: [async]} any/iter-step-err-reject.js {unsupported: [async]} - any/not-a-constructor.js any/reject-all-mixed.js {unsupported: [async]} any/reject-deferred.js {unsupported: [async]} any/reject-element-function-property-order.js @@ -1482,11 +1442,8 @@ built-ins/Promise 403/631 (63.87%) any/resolved-sequence-extra-ticks.js {unsupported: [async]} any/resolved-sequence-mixed.js {unsupported: [async]} any/resolved-sequence-with-rejections.js {unsupported: [async]} - prototype/catch/not-a-constructor.js prototype/catch/S25.4.5.1_A3.1_T1.js {unsupported: [async]} prototype/catch/S25.4.5.1_A3.1_T2.js {unsupported: [async]} - prototype/finally/invokes-then-with-function.js - prototype/finally/not-a-constructor.js prototype/finally/rejected-observable-then-calls.js {unsupported: [async]} prototype/finally/rejected-observable-then-calls-argument.js {unsupported: [class, async]} prototype/finally/rejected-observable-then-calls-PromiseResolve.js {unsupported: [async]} @@ -1506,7 +1463,6 @@ built-ins/Promise 403/631 (63.87%) prototype/then/ctor-access-count.js {unsupported: [async]} prototype/then/ctor-custom.js {unsupported: [class]} prototype/then/deferred-is-resolved-value.js {unsupported: [class, async]} - prototype/then/not-a-constructor.js prototype/then/prfm-fulfilled.js {unsupported: [async]} prototype/then/prfm-pending-fulfulled.js {unsupported: [async]} prototype/then/prfm-pending-rejected.js {unsupported: [async]} @@ -1596,7 +1552,6 @@ built-ins/Promise 403/631 (63.87%) race/iter-returns-true-reject.js {unsupported: [async]} race/iter-returns-undefined-reject.js {unsupported: [async]} race/iter-step-err-reject.js {unsupported: [async]} - race/not-a-constructor.js race/reject-deferred.js {unsupported: [async]} race/reject-ignored-deferred.js {unsupported: [async]} race/reject-ignored-immed.js {unsupported: [async]} @@ -1631,12 +1586,10 @@ built-ins/Promise 403/631 (63.87%) race/S25.4.4.3_A7.3_T2.js {unsupported: [async]} reject/capability-invocation.js reject/ctx-ctor.js {unsupported: [class]} - reject/not-a-constructor.js reject/S25.4.4.4_A2.1_T1.js {unsupported: [async]} resolve/arg-non-thenable.js {unsupported: [async]} resolve/arg-poisoned-then.js {unsupported: [async]} resolve/ctx-ctor.js {unsupported: [class]} - resolve/not-a-constructor.js resolve/resolve-from-promise-capability.js resolve/resolve-non-obj.js {unsupported: [async]} resolve/resolve-non-thenable.js {unsupported: [async]} @@ -1667,7 +1620,6 @@ built-ins/Promise 403/631 (63.87%) create-resolving-functions-resolve.js {unsupported: [async]} exception-after-resolve-in-executor.js {unsupported: [async]} exception-after-resolve-in-thenable-job.js {unsupported: [async]} - executor-function-not-a-constructor.js executor-function-property-order.js get-prototype-abrupt.js property-order.js @@ -1697,7 +1649,7 @@ built-ins/Promise 403/631 (63.87%) resolve-thenable-deferred.js {unsupported: [async]} resolve-thenable-immed.js {unsupported: [async]} -built-ins/Proxy 82/311 (26.37%) +built-ins/Proxy 81/311 (26.05%) construct/arguments-realm.js construct/call-parameters.js construct/call-parameters-new-target.js @@ -1747,7 +1699,6 @@ built-ins/Proxy 82/311 (26.37%) ownKeys/trap-is-undefined-target-is-proxy.js preventExtensions/trap-is-undefined-target-is-proxy.js {unsupported: [module]} revocable/builtin.js - revocable/not-a-constructor.js revocable/revocation-function-not-a-constructor.js revocable/revocation-function-property-order.js revocable/tco-fn-realm.js {unsupported: [tail-call-optimization]} @@ -1781,29 +1732,16 @@ built-ins/Proxy 82/311 (26.37%) get-fn-realm-recursive.js property-order.js -built-ins/Reflect 26/153 (16.99%) - apply/not-a-constructor.js +built-ins/Reflect 13/153 (8.5%) construct/newtarget-is-not-constructor-throws.js - construct/not-a-constructor.js - defineProperty/not-a-constructor.js defineProperty/return-abrupt-from-property-key.js - deleteProperty/not-a-constructor.js deleteProperty/return-abrupt-from-result.js deleteProperty/return-boolean.js strict - getOwnPropertyDescriptor/not-a-constructor.js - getPrototypeOf/not-a-constructor.js - get/not-a-constructor.js get/return-value-from-receiver.js - has/not-a-constructor.js - isExtensible/not-a-constructor.js - ownKeys/not-a-constructor.js ownKeys/order-after-define-property.js ownKeys/return-on-corresponding-order-large-index.js - preventExtensions/not-a-constructor.js - setPrototypeOf/not-a-constructor.js set/call-prototype-property-set.js set/different-property-descriptors.js - set/not-a-constructor.js set/receiver-is-not-object.js set/return-abrupt-from-result.js set/return-false-if-receiver-is-not-writable.js From ddb7af7e3591289dd8a1f296e39f92d2b5880957 Mon Sep 17 00:00:00 2001 From: Ronald Brill Date: Sat, 21 Sep 2024 18:04:56 +0200 Subject: [PATCH 3/4] adjust implementation regarding latest code changes, regenerate test262.properties with jdk 11 and some minor fixes --- .../AbstractEcmaObjectOperations.java | 9 +- .../org/mozilla/javascript/NativeReflect.java | 2 +- .../org/mozilla/javascript/ScriptRuntime.java | 9 +- .../org/mozilla/javascript/tests/Utils.java | 15 ++ .../javascript/tests/es6/NativeProxyTest.java | 180 ++++++++---------- .../tests/es6/NativeReflectTest.java | 149 ++++++--------- tests/testsrc/test262.properties | 29 ++- 7 files changed, 189 insertions(+), 204 deletions(-) diff --git a/rhino/src/main/java/org/mozilla/javascript/AbstractEcmaObjectOperations.java b/rhino/src/main/java/org/mozilla/javascript/AbstractEcmaObjectOperations.java index c6a8643666..844b288511 100644 --- a/rhino/src/main/java/org/mozilla/javascript/AbstractEcmaObjectOperations.java +++ b/rhino/src/main/java/org/mozilla/javascript/AbstractEcmaObjectOperations.java @@ -413,12 +413,13 @@ static boolean validateAndApplyPropertyDescriptor( } } - // if (!ScriptableObject.isGenericDescriptor(desc)) { if (ScriptableObject.isGenericDescriptor(desc)) { return true; - } else if (!Objects.equals( - ScriptableObject.isGenericDescriptor(current), - ScriptableObject.isGenericDescriptor(desc))) { + } + + if (!Objects.equals( + ScriptableObject.isDataDescriptor(current), + ScriptableObject.isDataDescriptor(desc))) { if (Boolean.FALSE.equals(current.get("configurable"))) { return false; } diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeReflect.java b/rhino/src/main/java/org/mozilla/javascript/NativeReflect.java index 99ce5c44ca..e3e35d3c88 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeReflect.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeReflect.java @@ -253,7 +253,7 @@ private static Object get(Context cx, Scriptable scope, Scriptable thisObj, Obje Object prop = ScriptableObject.getProperty(target, (Symbol) args[1]); return prop == Scriptable.NOT_FOUND ? Undefined.SCRIPTABLE_UNDEFINED : prop; } - if (args[1] instanceof Double) { + if (args[1] instanceof Number) { Object prop = ScriptableObject.getProperty(target, ScriptRuntime.toIndex(args[1])); return prop == Scriptable.NOT_FOUND ? Undefined.SCRIPTABLE_UNDEFINED : prop; } diff --git a/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java b/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java index c6661bfce1..7e1c8af4fb 100644 --- a/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java +++ b/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java @@ -2750,12 +2750,11 @@ public static Ref callRef(Callable function, Scriptable thisObj, Object[] args, * *

See ECMA 11.2.2 */ - public static Scriptable newObject(Object fun, Context cx, Scriptable scope, Object[] args) { - if (!(fun instanceof Function)) { - throw notFunctionError(fun); + public static Scriptable newObject(Object ctor, Context cx, Scriptable scope, Object[] args) { + if (!(ctor instanceof Constructable)) { + throw notFunctionError(ctor); } - Function function = (Function) fun; - return function.construct(cx, scope, args); + return ((Constructable) ctor).construct(cx, scope, args); } public static Object callSpecial( diff --git a/tests/src/test/java/org/mozilla/javascript/tests/Utils.java b/tests/src/test/java/org/mozilla/javascript/tests/Utils.java index 4aa64fa67f..72c1a24e88 100644 --- a/tests/src/test/java/org/mozilla/javascript/tests/Utils.java +++ b/tests/src/test/java/org/mozilla/javascript/tests/Utils.java @@ -121,6 +121,21 @@ public static void assertWithAllOptimizationLevelsES6( final Scriptable scope = cx.initStandardObjects(); final Object res = cx.evaluateString(scope, script, "test.js", 0, null); + if (expected instanceof Integer && res instanceof Double) { + assertEquals( + ((Integer) expected).doubleValue(), + ((Double) res).doubleValue(), + 0.00001); + return null; + } + if (expected instanceof Double && res instanceof Integer) { + assertEquals( + ((Double) expected).doubleValue(), + ((Integer) res).doubleValue(), + 0.00001); + return null; + } + assertEquals(expected, res); return null; }); diff --git a/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeProxyTest.java b/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeProxyTest.java index 962e4336d7..0b8655ad21 100644 --- a/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeProxyTest.java +++ b/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeProxyTest.java @@ -1,21 +1,20 @@ package org.mozilla.javascript.tests.es6; -import static org.junit.Assert.assertEquals; - import org.junit.Test; -import org.mozilla.javascript.Context; -import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.tests.Utils; public class NativeProxyTest { @Test public void testToString() { - testString("function Proxy() {\n\t[native code, arity=2]\n}\n", "Proxy.toString()"); - - testString("[object Object]", "Object.prototype.toString.call(new Proxy({}, {}))"); - testString("[object Array]", "Object.prototype.toString.call(new Proxy([], {}))"); - testString( + Utils.assertWithAllOptimizationLevelsES6( + "function Proxy() {\n\t[native code, arity=2]\n}\n", "Proxy.toString()"); + + Utils.assertWithAllOptimizationLevelsES6( + "[object Object]", "Object.prototype.toString.call(new Proxy({}, {}))"); + Utils.assertWithAllOptimizationLevelsES6( + "[object Array]", "Object.prototype.toString.call(new Proxy([], {}))"); + Utils.assertWithAllOptimizationLevelsES6( "[object Array]", "Object.prototype.toString.call(new Proxy(new Proxy([], {}), {}))"); } @@ -31,41 +30,42 @@ public void testToStringRevoke() { + " '' + e;\n" + "}"; - testString( + Utils.assertWithAllOptimizationLevelsES6( "TypeError: Illegal operation attempted on a revoked proxy", String.format(js, "{}", "rev.proxy")); - testString( + Utils.assertWithAllOptimizationLevelsES6( "TypeError: Illegal operation attempted on a revoked proxy", String.format(js, "[]", "rev.proxy")); } @Test public void prototype() { - testString("false", "'' + Object.hasOwnProperty.call(Proxy, 'prototype')"); + Utils.assertWithAllOptimizationLevelsES6( + "false", "'' + Object.hasOwnProperty.call(Proxy, 'prototype')"); - testString("2", "'' + Proxy.length"); + Utils.assertWithAllOptimizationLevelsES6("2", "'' + Proxy.length"); } @Test public void ctorMissingArgs() { - testString( + Utils.assertWithAllOptimizationLevelsES6( "TypeError: Proxy.ctor: At least 2 arguments required, but only 0 passed", "try { new Proxy() } catch(e) { '' + e }"); - testString( + Utils.assertWithAllOptimizationLevelsES6( "TypeError: Proxy.ctor: At least 2 arguments required, but only 1 passed", "try { new Proxy({}) } catch(e) { '' + e }"); - testString( + Utils.assertWithAllOptimizationLevelsES6( "TypeError: Expected argument of type object, but instead had type undefined", "try { new Proxy(undefined, {}) } catch(e) { '' + e }"); - testString( + Utils.assertWithAllOptimizationLevelsES6( "TypeError: Expected argument of type object, but instead had type object", "try { new Proxy(null, {}) } catch(e) { '' + e }"); } @Test public void ctorAsFunction() { - testString( + Utils.assertWithAllOptimizationLevelsES6( "TypeError: The constructor for Proxy may not be invoked as a function", "try { Proxy() } catch(e) { '' + e }"); } @@ -91,7 +91,7 @@ public void construct() { + "+ ' ' + (_P === P)" + "+ ' ' + _args.length + ' ' + _args[0] + ' ' + _args[1]"; - testString("true true true 2 1 4", js); + Utils.assertWithAllOptimizationLevelsES6("true true true 2 1 4", js); } @Test @@ -111,7 +111,7 @@ public void apply() { + "var x = ' ' + proxy1(1, 2);\n" + "res + x"; - testString(" Calculate sum: 1,2 21", js); + Utils.assertWithAllOptimizationLevelsES6(" Calculate sum: 1,2 21", js); } @Test @@ -137,7 +137,7 @@ public void applyParameters() { + "+ ' ' + (_context === context)" + "+ ' ' + _args.length + ' ' + _args[0] + ' ' + _args[1]"; - testString("true true true 2 1 4", js); + Utils.assertWithAllOptimizationLevelsES6("true true true 2 1 4", js); } @Test @@ -161,7 +161,7 @@ public void applyTrapIsNull() { + "+ ' ' + (_context === context)" + "+ ' ' + res"; - testString("1 true 3", js); + Utils.assertWithAllOptimizationLevelsES6("1 true 3", js); } @Test @@ -173,7 +173,7 @@ public void applyWithoutHandler() { + "var proxy1 = new Proxy(sum, {});\n" + "proxy1(1, 2);"; - testDouble(3.0, js); + Utils.assertWithAllOptimizationLevelsES6(3, js); } @Test @@ -191,7 +191,7 @@ public void defineProperty() { + "var proxy1 = new Proxy(o, handler);\n" + "Object.defineProperty(proxy1, 'p', { value: 42, writable: false });\n" + "res;"; - testString("[object Object] p false undefined undefined", js); + Utils.assertWithAllOptimizationLevelsES6("[object Object] p false undefined undefined", js); } @Test @@ -205,7 +205,7 @@ public void definePropertyTrapReturnsFalse() { + "});\n" + "'' + Reflect.defineProperty(p, 'attr', {})" + "+ ' ' + Object.getOwnPropertyDescriptor(target, 'attr')"; - testString("false undefined", js); + Utils.assertWithAllOptimizationLevelsES6("false undefined", js); } @Test @@ -230,7 +230,8 @@ public void definePropertyTrapReturnsFalse() { + "} catch(e) {\n" + " '' + e;\n" + "}\n"; - testString("TypeError: proxy can't define an incompatible property descriptor", js); + Utils.assertWithAllOptimizationLevelsES6( + "TypeError: proxy can't define an incompatible property descriptor", js); } @Test @@ -252,7 +253,8 @@ public void definePropertyDescAndTargetPropertyDescriptorNotCompatibleAndTrapRes + "} catch(e) {\n" + " '' + e;\n" + "}\n"; - testString("TypeError: proxy can't define an incompatible property descriptor", js); + Utils.assertWithAllOptimizationLevelsES6( + "TypeError: proxy can't define an incompatible property descriptor", js); } @Test @@ -276,7 +278,8 @@ public void definePropertyDescAndTargetPropertyDescriptorNotCompatibleAndTrapRes + "} catch(e) {\n" + " '' + e;\n" + "}\n"; - testString("TypeError: proxy can't define an incompatible property descriptor", js); + Utils.assertWithAllOptimizationLevelsES6( + "TypeError: proxy can't define an incompatible property descriptor", js); } @Test @@ -286,7 +289,7 @@ public void definePropertyWithoutHandler() { + "var proxy1 = new Proxy(o, {});\n" + "proxy1.p = 42;\n" + "'' + o.p;"; - testString("42", js); + Utils.assertWithAllOptimizationLevelsES6("42", js); } @Test @@ -301,7 +304,7 @@ public void definePropertyFreezedWithoutHandler() { + "} catch(e) {\n" + " '' + e;" + "}\n"; - testString( + Utils.assertWithAllOptimizationLevelsES6( "TypeError: Cannot add properties to this object because extensible is false.", js); } @@ -316,7 +319,8 @@ public void definePropertyHandlerNotFunction() { + "} catch(e) {\n" + " '' + e;" + "}\n"; - testString("TypeError: defineProperty is not a function, it is number.", js); + Utils.assertWithAllOptimizationLevelsES6( + "TypeError: defineProperty is not a function, it is number.", js); } @Test @@ -330,7 +334,7 @@ public void definePropertyHandlerNull() { + "} catch(e) {\n" + " '' + e;" + "}\n"; - testString("42", js); + Utils.assertWithAllOptimizationLevelsES6("42", js); } @Test @@ -344,7 +348,7 @@ public void definePropertyHandlerUndefined() { + "} catch(e) {\n" + " '' + e;" + "}\n"; - testString("42", js); + Utils.assertWithAllOptimizationLevelsES6("42", js); } @Test @@ -354,7 +358,7 @@ public void deletePropertyWithoutHandler() { + "var proxy1 = new Proxy(o, {});\n" + "delete proxy1.p;\n" + "'' + o.p;"; - testString("undefined", js); + Utils.assertWithAllOptimizationLevelsES6("undefined", js); } @Test @@ -378,7 +382,7 @@ public void getOwnPropertyDescriptor() { + "+ ' ' + result.writable " + "+ ' ' + (result.get === fn) " + "+ ' ' + (result.set === undefined)"; - testString( + Utils.assertWithAllOptimizationLevelsES6( "undefined 7 [value,writable,enumerable,configurable] true true false false true", js); } @@ -393,7 +397,7 @@ public void getOwnPropertyDescriptorResultUndefined() { + " }\n" + " });\n" + "'' + Object.getOwnPropertyDescriptor(p, 'attr');"; - testString("undefined", js); + Utils.assertWithAllOptimizationLevelsES6("undefined", js); } @Test @@ -412,7 +416,8 @@ public void getOwnPropertyDescriptorWithoutHandler() { + "+ ' ' + result.configurable" + "+ ' ' + (result.get === fn)" + "+ ' ' + (result.set === undefined)"; - testString("[get,set,enumerable,configurable] false true true true", js); + Utils.assertWithAllOptimizationLevelsES6( + "[get,set,enumerable,configurable] false true true true", js); } @Test @@ -433,7 +438,7 @@ public void isExtensible() { + "var x = Object.isExtensible(proxy1);\n" + "res += ' ' + x;\n" + "res += ' ' + x;\n"; - testString(" a true true true", js); + Utils.assertWithAllOptimizationLevelsES6(" a true true true", js); } @Test @@ -448,7 +453,7 @@ public void isExtensibleWithoutHandler() { + "var proxy2 = new Proxy(o2, {});\n" + "result += ' ' + Object.isExtensible(o2) + '-' + Object.isExtensible(proxy2);\n"; - testString("true-true false-false false-false", js); + Utils.assertWithAllOptimizationLevelsES6("true-true false-false false-false", js); } @Test @@ -463,7 +468,7 @@ public void preventExtensionsTrapReturnsNoBoolean() { + "var res = '' + Reflect.preventExtensions(p);\n" + "Object.preventExtensions(target);\n" + "res += ' ' + Reflect.preventExtensions(p);\n"; - testString("false false", js); + Utils.assertWithAllOptimizationLevelsES6("false false", js); } @Test @@ -472,7 +477,7 @@ public void preventExtensionsTrapIsUndefined() { "var target = {};\n" + "var p = new Proxy(target, {});\n" + "'' + Reflect.preventExtensions(p);"; - testString("true", js); + Utils.assertWithAllOptimizationLevelsES6("true", js); } @Test @@ -489,7 +494,7 @@ public void ownKeys() { + "var proxy1 = new Proxy(o, handler);\n" + "var x = Object.keys(proxy1);\n" + "res += ' ' + x;\n"; - testString("true d", js); + Utils.assertWithAllOptimizationLevelsES6("true d", js); } @Test @@ -502,7 +507,7 @@ public void ownKeysTrapUndefined() { + "var p = new Proxy(target, {});\n" + "var keys = Object.getOwnPropertyNames(p);\n" + "'' + keys[0] + ' ' + keys[1] + ' ' + keys.length"; - testString("foo bar 2", js); + Utils.assertWithAllOptimizationLevelsES6("foo bar 2", js); } @Test @@ -514,7 +519,7 @@ public void ownKeysArrayInTrapResult() { + " }\n" + "});\n" + "try { Object.keys(p); } catch(e) { '' + e }\n"; - testString( + Utils.assertWithAllOptimizationLevelsES6( "TypeError: proxy [[OwnPropertyKeys]] must return an array with only string and symbol elements", js); } @@ -531,7 +536,7 @@ public void ownKeysWithoutHandler() { + "var proxy2 = new Proxy(a1, {});\n" + "'' + Object.keys(proxy1)" + "+ ' ' + Object.keys(proxy2)"; - testString("p1,p2 ", js); + Utils.assertWithAllOptimizationLevelsES6("p1,p2 ", js); } @Test @@ -554,13 +559,13 @@ public void ownKeysWithoutHandler2() { + "var a1 = [];\n" + "var proxy1 = new Proxy(o1, {});\n" + "'' + Object.keys(proxy1)"; - testString("0,6,8,55,773,s1,str,-1,s2,str2", js); + Utils.assertWithAllOptimizationLevelsES6("0,6,8,55,773,s1,str,-1,s2,str2", js); } @Test public void ownKeysWithoutHandlerEmptyObj() { String js = "var proxy1 = new Proxy({}, {});\n" + "'' + Object.keys(proxy1).length"; - testString("0", js); + Utils.assertWithAllOptimizationLevelsES6("0", js); } @Test @@ -570,19 +575,19 @@ public void ownKeysWithoutHandlerDeleteObj() { + "delete o.d;\n" + "var proxy1 = new Proxy(o, {});\n" + "'' + Object.keys(proxy1).length"; - testString("0", js); + Utils.assertWithAllOptimizationLevelsES6("0", js); } @Test public void ownKeysWithoutHandlerEmptyArray() { String js = "var proxy1 = new Proxy([], {});\n" + "'' + Object.keys(proxy1)"; - testString("", js); + Utils.assertWithAllOptimizationLevelsES6("", js); } @Test public void ownKeysWithoutHandlerArray() { String js = "var proxy1 = new Proxy([, , 2], {});\n" + "'' + Object.keys(proxy1)"; - testString("2", js); + Utils.assertWithAllOptimizationLevelsES6("2", js); } @Test @@ -593,7 +598,7 @@ public void ownKeysWithoutHandlerNotEnumerable() { + "Object.defineProperty(o, 'p2', { get: function() {}, enumerable: false });\n" + "var proxy1 = new Proxy(o, {});\n" + "'' + Object.keys(proxy1)"; - testString("", js); + Utils.assertWithAllOptimizationLevelsES6("", js); } @Test @@ -614,7 +619,7 @@ public void hasTargetNotExtensible() { + "Object.preventExtensions(target);\n" + "try { 'attr' in p; } catch(e) { '' + e }\n"; - testString( + Utils.assertWithAllOptimizationLevelsES6( "TypeError: proxy can't report an existing own property 'attr' as non-existent on a non-extensible object", js); } @@ -638,7 +643,7 @@ public void hasHandlerCallsIn() { + "+ ' ' + ('attr' === _prop)" + "+ ' ' + ('attr' in p)"; - testString("false false false false", js); + Utils.assertWithAllOptimizationLevelsES6("false false false false", js); } @Test @@ -649,7 +654,7 @@ public void hasWithoutHandler() { + "'' + ('p' in proxy1)" + "+ ' ' + ('p2' in proxy1)" + "+ ' ' + ('toString' in proxy1)"; - testString("true false true", js); + Utils.assertWithAllOptimizationLevelsES6("true false true", js); } @Test @@ -662,7 +667,7 @@ public void hasSymbolWithoutHandler() { + "var proxy1 = new Proxy(o, {});\n" + "'' + (s1 in proxy1)" + "+ ' ' + (2 in proxy1)"; - testString("true false", js); + Utils.assertWithAllOptimizationLevelsES6("true false", js); } @Test @@ -675,7 +680,7 @@ public void getTrapIsNullTargetIsProxy() { + "'' + stringProxy.length" + " + ' ' + stringProxy[0]" + " + ' ' + stringProxy[4];"; - testString("3 s undefined", js); + Utils.assertWithAllOptimizationLevelsES6("3 s undefined", js); } @Test @@ -698,7 +703,7 @@ public void getTrapIsNullTargetIsProxy2() { + " + ' ' + proxy[10]" + " + ' ' + Object.create(proxy).foo" + " + ' ' + proxy.bar;"; - testString("1 2 3 undefined", js); + Utils.assertWithAllOptimizationLevelsES6("1 2 3 undefined", js); } @Test @@ -715,13 +720,13 @@ public void setTrap() { + "proxy.foo = [1, 2, 3];\n" + "res"; - testString("1,2,3 true", js); + Utils.assertWithAllOptimizationLevelsES6("1,2,3 true", js); } @Test public void getPropertyByIntWithoutHandler() { String js = "var a = ['zero', 'one'];" + "var proxy1 = new Proxy(a, {});\n" + "proxy1[1];"; - testString("one", js); + Utils.assertWithAllOptimizationLevelsES6("one", js); } @Test @@ -741,7 +746,7 @@ public void getProperty() { + "result += ', ' + proxy2.p;\n" + "result += ', ' + proxy2.u;\n"; - testString("value 1!, foo!, 42, undefined", js); + Utils.assertWithAllOptimizationLevelsES6("value 1!, foo!, 42, undefined", js); } @Test @@ -769,7 +774,7 @@ public void getPropertyParameters() { + "p['attr'];\n" + "res + ' ' + (_prop == 'attr')"; - testString("true true true true true", js); + Utils.assertWithAllOptimizationLevelsES6("true true true true true", js); } @Test @@ -789,7 +794,7 @@ public void getPropertyWithoutHandler() { + "result += ', ' + proxy2.p;\n" + "result += ', ' + proxy2.u;\n"; - testString("value 1, undefined, foo, 42, undefined", js); + Utils.assertWithAllOptimizationLevelsES6("value 1, undefined, foo, 42, undefined", js); } @Test @@ -800,7 +805,7 @@ public void getPrototypeOfNull() { + " getPrototypeOf: null,\n" + "});\n" + "'' + Object.getPrototypeOf(plainObjectProxy);\n"; - testString("null", js); + Utils.assertWithAllOptimizationLevelsES6("null", js); } @Test @@ -812,13 +817,13 @@ public void setPrototypeOfWithoutHandler() { + "result += ' ' + Reflect.setPrototypeOf(o1, null);\n" + "var o2 = {};\n" + "result += ' ' + Reflect.setPrototypeOf(Object.freeze(o2), null);\n"; - testString("true true false", js); + Utils.assertWithAllOptimizationLevelsES6("true true false", js); } @Test public void setPrototypeOfCycleWithoutHandler() { String js = "var o1 = {};\n" + "'' + Reflect.setPrototypeOf(o1, o1);\n"; - testString("false", js); + Utils.assertWithAllOptimizationLevelsES6("false", js); } @Test @@ -830,7 +835,7 @@ public void setPrototypeOfCycleComplexWithoutHandler() { + "'' + Reflect.setPrototypeOf(o1, o2)" + "+ ' ' + Reflect.setPrototypeOf(o2, o3)" + "+ ' ' + Reflect.setPrototypeOf(o3, o1)"; - testString("true true false", js); + Utils.assertWithAllOptimizationLevelsES6("true true false", js); } @Test @@ -846,19 +851,20 @@ public void setPrototypeOfSameWithoutHandler() { + "'' + Reflect.setPrototypeOf(o1, Object.prototype)" + "+ ' ' + Reflect.setPrototypeOf(o2, null)" + "+ ' ' + Reflect.setPrototypeOf(o3, proto)"; - testString("true true true", js); + Utils.assertWithAllOptimizationLevelsES6("true true true", js); } @Test public void typeof() { - testString("object", "typeof new Proxy({}, {})"); - testString("function", "typeof new Proxy(function() {}, {})"); + Utils.assertWithAllOptimizationLevelsES6("object", "typeof new Proxy({}, {})"); + Utils.assertWithAllOptimizationLevelsES6("function", "typeof new Proxy(function() {}, {})"); } @Test public void typeofRevocable() { - testString("object", "var rev = Proxy.revocable({}, {}); rev.revoke(); typeof rev.proxy"); - testString( + Utils.assertWithAllOptimizationLevelsES6( + "object", "var rev = Proxy.revocable({}, {}); rev.revoke(); typeof rev.proxy"); + Utils.assertWithAllOptimizationLevelsES6( "function", "var rev = Proxy.revocable(function() {}, {}); rev.revoke(); typeof rev.proxy"); @@ -867,7 +873,7 @@ public void typeofRevocable() { + "revocableTarget.revoke();\n" + "var revocable = Proxy.revocable(revocableTarget.proxy, {});\n" + "'' + typeof revocable.proxy;\n"; - testString("function", js); + Utils.assertWithAllOptimizationLevelsES6("function", js); } @Test @@ -879,40 +885,14 @@ public void revocableFunctionIsAnonymous() { + "+ ' ' + desc.writable " + "+ ' ' + desc.enumerable " + "+ ' ' + desc.configurable"; - testString("undefined false false true", js); + Utils.assertWithAllOptimizationLevelsES6("undefined false false true", js); } @Test public void revocableGetPrototypeOf() { - testString( + Utils.assertWithAllOptimizationLevelsES6( "TypeError: Illegal operation attempted on a revoked proxy", "var rev = Proxy.revocable({}, {}); rev.revoke(); " + "try { Object.getPrototypeOf(rev.proxy); } catch(e) { '' + e }"); } - - private static void testString(String expected, String js) { - Utils.runWithAllOptimizationLevels( - cx -> { - cx.setLanguageVersion(Context.VERSION_ES6); - final Scriptable scope = cx.initStandardObjects(); - - Object result = cx.evaluateString(scope, js, "test", 1, null); - assertEquals(expected, result); - - return null; - }); - } - - private static void testDouble(double expected, String js) { - Utils.runWithAllOptimizationLevels( - cx -> { - cx.setLanguageVersion(Context.VERSION_ES6); - final Scriptable scope = cx.initStandardObjects(); - - Object result = cx.evaluateString(scope, js, "test", 1, null); - assertEquals(expected, ((Double) result).doubleValue(), 0.00001); - - return null; - }); - } } diff --git a/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeReflectTest.java b/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeReflectTest.java index 97c6e73dba..efabb74f9c 100644 --- a/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeReflectTest.java +++ b/tests/src/test/java/org/mozilla/javascript/tests/es6/NativeReflectTest.java @@ -1,45 +1,49 @@ package org.mozilla.javascript.tests.es6; -import static org.junit.Assert.assertEquals; - import org.junit.Test; -import org.mozilla.javascript.Context; -import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.tests.Utils; public class NativeReflectTest { @Test public void testToString() { - testString("[object Reflect]", "Reflect.toString()"); + Utils.assertWithAllOptimizationLevelsES6("[object Reflect]", "Reflect.toString()"); } @Test public void apply() { - testDouble(1.0, "Reflect.apply(Math.floor, undefined, [1.75])"); - testString( + Utils.assertWithAllOptimizationLevelsES6( + 1.0, "Reflect.apply(Math.floor, undefined, [1.75])"); + Utils.assertWithAllOptimizationLevelsES6( "hello", "Reflect.apply(String.fromCharCode, undefined, [104, 101, 108, 108, 111])"); - testInt(4, "Reflect.apply(RegExp.prototype.exec, /ab/, ['confabulation']).index"); - testString("i", "Reflect.apply(''.charAt, 'ponies', [3])"); + Utils.assertWithAllOptimizationLevelsES6( + 4, "Reflect.apply(RegExp.prototype.exec, /ab/, ['confabulation']).index"); + Utils.assertWithAllOptimizationLevelsES6("i", "Reflect.apply(''.charAt, 'ponies', [3])"); } @Test public void applyString() { - testString("foo", "Reflect.apply(String.prototype.toString, 'foo', [])"); - testString("oo", "Reflect.apply(String.prototype.substring, 'foo', [1])"); + Utils.assertWithAllOptimizationLevelsES6( + "foo", "Reflect.apply(String.prototype.toString, 'foo', [])"); + Utils.assertWithAllOptimizationLevelsES6( + "oo", "Reflect.apply(String.prototype.substring, 'foo', [1])"); } @Test public void applyNumber() { - testString("1.234567e+3", "Reflect.apply(Number.prototype.toExponential, 1234.567, [])"); - testString("1.23e+3", "Reflect.apply(Number.prototype.toExponential, 1234.567, [2])"); + Utils.assertWithAllOptimizationLevelsES6( + "1.234567e+3", "Reflect.apply(Number.prototype.toExponential, 1234.567, [])"); + Utils.assertWithAllOptimizationLevelsES6( + "1.23e+3", "Reflect.apply(Number.prototype.toExponential, 1234.567, [2])"); } @Test public void applyBoolean() { - testString("true", "Reflect.apply(Boolean.prototype.toString, true, [])"); - testString("false", "Reflect.apply(Boolean.prototype.toString, false, [])"); + Utils.assertWithAllOptimizationLevelsES6( + "true", "Reflect.apply(Boolean.prototype.toString, true, [])"); + Utils.assertWithAllOptimizationLevelsES6( + "false", "Reflect.apply(Boolean.prototype.toString, false, [])"); } @Test @@ -63,13 +67,13 @@ public void applyDetails() { + "+ ' ' + results.args[1]" + "+ ' ' + results.args[2]" + "+ ' ' + results.args[3]"; - testString("1 true 4 arg1 2 undefined null", js); + Utils.assertWithAllOptimizationLevelsES6("1 true 4 arg1 2 undefined null", js); } @Test public void applyMissingArgs() { String js = "try {\n" + " Reflect.apply();\n" + "} catch(e) {\n" + " '' + e;\n" + "}"; - testString( + Utils.assertWithAllOptimizationLevelsES6( "TypeError: Reflect.apply: At least 3 arguments required, but only 0 passed", js); } @@ -81,7 +85,8 @@ public void applyTargetNotFunction() { + "} catch(e) {\n" + " '' + e;\n" + "}"; - testString("TypeError: [object Object] is not a function, it is object.", js); + Utils.assertWithAllOptimizationLevelsES6( + "TypeError: [object Object] is not a function, it is object.", js); } @Test @@ -93,7 +98,8 @@ public void applyArgumentsListNotFunction() { + "} catch(e) {\n" + " '' + e;\n" + "}"; - testString("TypeError: Expected argument of type object, but instead had type symbol", js); + Utils.assertWithAllOptimizationLevelsES6( + "TypeError: Expected argument of type object, but instead had type symbol", js); } @Test @@ -101,7 +107,7 @@ public void construct() { String js = "var d = Reflect.construct(Date, [1776, 6, 4]);\n" + "'' + (d instanceof Date) + ' ' + d.getFullYear();"; - testString("true 1776", js); + Utils.assertWithAllOptimizationLevelsES6("true 1776", js); } @Test @@ -117,7 +123,7 @@ public void constructNewTarget() { + "'' + (Object.getPrototypeOf(result) === Array.prototype)" + " + ' ' + (internPrototype === Array.prototype)" + " + ' ' + (result.o === o)"; - testString("true true true", js); + Utils.assertWithAllOptimizationLevelsES6("true true true", js); } @Test @@ -128,7 +134,7 @@ public void constructNoConstructorNumber() { + "} catch(e) {\n" + " '' + e;\n" + "}"; - testString("TypeError: \"number\" is not a constructor.", js); + Utils.assertWithAllOptimizationLevelsES6("TypeError: \"number\" is not a constructor.", js); } @Test @@ -139,7 +145,7 @@ public void constructNoConstructorNull() { + "} catch(e) {\n" + " '' + e;\n" + "}"; - testString("TypeError: \"object\" is not a constructor.", js); + Utils.assertWithAllOptimizationLevelsES6("TypeError: \"object\" is not a constructor.", js); } @Test @@ -150,7 +156,7 @@ public void constructNoConstructorObject() { + "} catch(e) {\n" + " '' + e;\n" + "}"; - testString("TypeError: \"object\" is not a constructor.", js); + Utils.assertWithAllOptimizationLevelsES6("TypeError: \"object\" is not a constructor.", js); } @Test @@ -161,7 +167,8 @@ public void constructNoConstructorFunction() { + "} catch(e) {\n" + " '' + e;\n" + "}"; - testString("TypeError: \"function\" is not a constructor.", js); + Utils.assertWithAllOptimizationLevelsES6( + "TypeError: \"function\" is not a constructor.", js); } @Test @@ -177,7 +184,7 @@ public void constructorArgs() { + "Reflect.construct(foo, [1, 2]);\n" + "res;"; - testString("foo - 1 2 ", script); + Utils.assertWithAllOptimizationLevelsES6("foo - 1 2 ", script); } @Test @@ -199,14 +206,14 @@ public void constructorArgsWithTarget() { + "Reflect.construct(foo, [6, 7, 8], bar);\n" + "res;"; - testString("foo - 6 7 8 ", script); + Utils.assertWithAllOptimizationLevelsES6("foo - 6 7 8 ", script); } @Test public void defineProperty() { String js = "var o = {};\n" + "'' + Reflect.defineProperty(o, 'p', { value: 42 }) + ' ' + o.p;"; - testString("true 42", js); + Utils.assertWithAllOptimizationLevelsES6("true 42", js); } @Test @@ -216,7 +223,7 @@ public void definePropertyWithoutValue() { + "'' + Reflect.defineProperty(o, 'p', {})" + "+ ' ' + Reflect.has(o, 'p')" + "+ ' ' + o.p;"; - testString("true true undefined", js); + Utils.assertWithAllOptimizationLevelsES6("true true undefined", js); } @Test @@ -225,7 +232,7 @@ public void definePropertyFreezed() { "var o = {};\n" + "Object.freeze(o);\n" + "'' + Reflect.defineProperty(o, 'p', { value: 42 }) + ' ' + o.p;"; - testString("false undefined", js); + Utils.assertWithAllOptimizationLevelsES6("false undefined", js); } @Test @@ -235,7 +242,7 @@ public void deleteProperty() { + "'' + Reflect.deleteProperty(o, 'p')" + "+ ' ' + Reflect.has(o, 'p')" + "+ ' ' + o.p;"; - testString("true false undefined", js); + Utils.assertWithAllOptimizationLevelsES6("true false undefined", js); } @Test @@ -253,7 +260,8 @@ public void getOwnPropertyDescriptor() { + "+ ' ' + result.configurable" + "+ ' ' + (result.get === fn)" + "+ ' ' + (result.set === undefined)"; - testString("[get,set,enumerable,configurable] false true true true", js); + Utils.assertWithAllOptimizationLevelsES6( + "[get,set,enumerable,configurable] false true true true", js); } @Test @@ -266,7 +274,7 @@ public void isExtensible() { + "var o2 = Object.seal({});\n" + "result += ' ' + Reflect.isExtensible(o2);\n"; - testString("true false false", js); + Utils.assertWithAllOptimizationLevelsES6("true false false", js); } @Test @@ -279,7 +287,7 @@ public void ownKeys() { + "var a1 = [];\n" + "'' + Reflect.ownKeys(o1)" + "+ ' ' + Reflect.ownKeys(a1)"; - testString("p1,p2 length", js); + Utils.assertWithAllOptimizationLevelsES6("p1,p2 length", js); } @Test @@ -301,31 +309,31 @@ public void ownKeys2() { + "};\n" + "var a1 = [];\n" + "'' + Reflect.ownKeys(o1)"; - testString("0,6,8,55,773,s1,str,-1,s2,str2", js); + Utils.assertWithAllOptimizationLevelsES6("0,6,8,55,773,s1,str,-1,s2,str2", js); } @Test public void ownKeysEmptyObj() { String js = "'' + Reflect.ownKeys({}).length"; - testString("0", js); + Utils.assertWithAllOptimizationLevelsES6("0", js); } @Test public void ownKeysDeleteObj() { String js = "var o = { d: 42 };\n" + "delete o.d;\n" + "'' + Reflect.ownKeys(o).length"; - testString("0", js); + Utils.assertWithAllOptimizationLevelsES6("0", js); } @Test public void ownKeysEmptyArray() { String js = "'' + Reflect.ownKeys([])"; - testString("length", js); + Utils.assertWithAllOptimizationLevelsES6("length", js); } @Test public void ownKeysArray() { String js = "'' + Reflect.ownKeys([, , 2])"; - testString("2,length", js); + Utils.assertWithAllOptimizationLevelsES6("2,length", js); } @Test @@ -335,7 +343,7 @@ public void ownKeysNotEnumerable() { + "Object.defineProperty(o, 'p1', { value: 42, enumerable: false });\n" + "Object.defineProperty(o, 'p2', { get: function() {}, enumerable: false });\n" + "'' + Reflect.ownKeys(o)"; - testString("p1,p2", js); + Utils.assertWithAllOptimizationLevelsES6("p1,p2", js); } @Test @@ -345,7 +353,7 @@ public void has() { + "'' + Reflect.has(o1, 'p')" + "+ ' ' + Reflect.has(o1, 'p2')" + "+ ' ' + Reflect.has(o1, 'toString')"; - testString("true false true", js); + Utils.assertWithAllOptimizationLevelsES6("true false true", js); } @Test @@ -357,13 +365,13 @@ public void hasSymbol() { + "o[s1] = 42;\n" + "'' + Reflect.has(o, s1)" + "+ ' ' + Reflect.has(o, 2)"; - testString("true false", js); + Utils.assertWithAllOptimizationLevelsES6("true false", js); } @Test public void hasProto() { String js = "var o1 = { p: 42 }\n" + "'' + typeof Reflect.has.__proto__"; - testString("function", js); + Utils.assertWithAllOptimizationLevelsES6("function", js); } @Test @@ -377,7 +385,7 @@ public void getOwnPropertyDescriptorSymbol() { + "+ ' ' + result.enumerable" + "+ ' ' + result.configurable" + "+ ' ' + result.writable"; - testString("42 true true true", js); + Utils.assertWithAllOptimizationLevelsES6("42 true true true", js); } @Test @@ -386,13 +394,13 @@ public void getOwnPropertyDescriptorUndefinedProperty() { "var o = Object.create({p: 1});\n" + "var result = Reflect.getOwnPropertyDescriptor(o, 'p');\n" + "'' + (result === undefined)"; - testString("true", js); + Utils.assertWithAllOptimizationLevelsES6("true", js); } @Test public void getPropertyByInt() { String js = "var a = ['zero', 'one']\n" + "Reflect.get(a, 1);"; - testString("one", js); + Utils.assertWithAllOptimizationLevelsES6("one", js); } @Test @@ -410,7 +418,7 @@ public void getProperty() { + "result += ', ' + Reflect.get(o2, 'p');\n" + "result += ', ' + Reflect.get(o2, 'u');\n"; - testString("value 1, undefined, foo, 42, undefined", js); + Utils.assertWithAllOptimizationLevelsES6("value 1, undefined, foo, 42, undefined", js); } @Test @@ -422,13 +430,13 @@ public void setPrototypeOf() { + "result += ' ' + Reflect.setPrototypeOf(o1, null);\n" + "var o2 = {};\n" + "result += ' ' + Reflect.setPrototypeOf(Object.freeze(o2), null);\n"; - testString("true true false", js); + Utils.assertWithAllOptimizationLevelsES6("true true false", js); } @Test public void setPrototypeOfCycle() { String js = "var o1 = {};\n" + "'' + Reflect.setPrototypeOf(o1, o1);\n"; - testString("false", js); + Utils.assertWithAllOptimizationLevelsES6("false", js); } @Test @@ -440,7 +448,7 @@ public void setPrototypeOfCycleComplex() { + "'' + Reflect.setPrototypeOf(o1, o2)" + "+ ' ' + Reflect.setPrototypeOf(o2, o3)" + "+ ' ' + Reflect.setPrototypeOf(o3, o1)"; - testString("true true false", js); + Utils.assertWithAllOptimizationLevelsES6("true true false", js); } @Test @@ -456,45 +464,6 @@ public void setPrototypeOfSame() { + "'' + Reflect.setPrototypeOf(o1, Object.prototype)" + "+ ' ' + Reflect.setPrototypeOf(o2, null)" + "+ ' ' + Reflect.setPrototypeOf(o3, proto)"; - testString("true true true", js); - } - - private static void testString(String expected, String js) { - Utils.runWithAllOptimizationLevels( - cx -> { - cx.setLanguageVersion(Context.VERSION_ES6); - final Scriptable scope = cx.initStandardObjects(); - - Object result = cx.evaluateString(scope, js, "test", 1, null); - assertEquals(expected, result); - - return null; - }); - } - - private static void testDouble(double expected, String js) { - Utils.runWithAllOptimizationLevels( - cx -> { - cx.setLanguageVersion(Context.VERSION_ES6); - final Scriptable scope = cx.initStandardObjects(); - - Object result = cx.evaluateString(scope, js, "test", 1, null); - assertEquals(expected, ((Double) result).doubleValue(), 0.00001); - - return null; - }); - } - - private static void testInt(int expected, String js) { - Utils.runWithAllOptimizationLevels( - cx -> { - cx.setLanguageVersion(Context.VERSION_ES6); - final Scriptable scope = cx.initStandardObjects(); - - Object result = cx.evaluateString(scope, js, "test", 1, null); - assertEquals(expected, ((Integer) result).intValue()); - - return null; - }); + Utils.assertWithAllOptimizationLevelsES6("true true true", js); } } diff --git a/tests/testsrc/test262.properties b/tests/testsrc/test262.properties index 10de018648..58a581a724 100644 --- a/tests/testsrc/test262.properties +++ b/tests/testsrc/test262.properties @@ -1649,12 +1649,10 @@ built-ins/Promise 392/631 (62.12%) resolve-thenable-deferred.js {unsupported: [async]} resolve-thenable-immed.js {unsupported: [async]} -built-ins/Proxy 81/311 (26.05%) +built-ins/Proxy 79/311 (25.4%) construct/arguments-realm.js construct/call-parameters.js construct/call-parameters-new-target.js - construct/call-result.js non-interpreted - construct/return-is-abrupt.js non-interpreted construct/trap-is-missing-target-is-proxy.js {unsupported: [class]} construct/trap-is-null.js construct/trap-is-null-target-is-proxy.js {unsupported: [class]} @@ -6438,23 +6436,39 @@ language/global-code 30/42 (71.43%) language/identifier-resolution 0/14 (0.0%) -language/identifiers 61/248 (24.6%) +language/identifiers 84/248 (33.87%) + other_id_continue.js + other_id_continue-escaped.js + other_id_start.js + other_id_start-escaped.js part-unicode-10.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-10.0.0-class-escaped.js {unsupported: [class-fields-private, class]} + part-unicode-11.0.0.js part-unicode-11.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-11.0.0-class-escaped.js {unsupported: [class-fields-private, class]} + part-unicode-11.0.0-escaped.js + part-unicode-12.0.0.js part-unicode-12.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-12.0.0-class-escaped.js {unsupported: [class-fields-private, class]} + part-unicode-12.0.0-escaped.js + part-unicode-13.0.0.js part-unicode-13.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-13.0.0-class-escaped.js {unsupported: [class-fields-private, class]} + part-unicode-13.0.0-escaped.js + part-unicode-14.0.0.js part-unicode-14.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-14.0.0-class-escaped.js {unsupported: [class-fields-private, class]} + part-unicode-14.0.0-escaped.js + part-unicode-15.0.0.js part-unicode-15.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-15.0.0-class-escaped.js {unsupported: [class-fields-private, class]} + part-unicode-15.0.0-escaped.js part-unicode-15.1.0-class.js {unsupported: [class-fields-private, class]} part-unicode-15.1.0-class-escaped.js {unsupported: [class-fields-private, class]} + part-unicode-5.2.0.js part-unicode-5.2.0-class.js {unsupported: [class-fields-private, class]} part-unicode-5.2.0-class-escaped.js {unsupported: [class-fields-private, class]} + part-unicode-5.2.0-escaped.js part-unicode-6.0.0-class.js {unsupported: [class-fields-private, class]} part-unicode-6.0.0-class-escaped.js {unsupported: [class-fields-private, class]} part-unicode-6.1.0-class.js {unsupported: [class-fields-private, class]} @@ -6470,16 +6484,23 @@ language/identifiers 61/248 (24.6%) start-unicode-11.0.0.js start-unicode-11.0.0-class.js {unsupported: [class-fields-private, class]} start-unicode-11.0.0-class-escaped.js {unsupported: [class-fields-private, class]} + start-unicode-11.0.0-escaped.js + start-unicode-12.0.0.js start-unicode-12.0.0-class.js {unsupported: [class-fields-private, class]} start-unicode-12.0.0-class-escaped.js {unsupported: [class-fields-private, class]} + start-unicode-12.0.0-escaped.js start-unicode-13.0.0.js start-unicode-13.0.0-class.js {unsupported: [class-fields-private, class]} start-unicode-13.0.0-class-escaped.js {unsupported: [class-fields-private, class]} + start-unicode-13.0.0-escaped.js + start-unicode-14.0.0.js start-unicode-14.0.0-class.js {unsupported: [class-fields-private, class]} start-unicode-14.0.0-class-escaped.js {unsupported: [class-fields-private, class]} + start-unicode-14.0.0-escaped.js start-unicode-15.0.0.js start-unicode-15.0.0-class.js {unsupported: [class-fields-private, class]} start-unicode-15.0.0-class-escaped.js {unsupported: [class-fields-private, class]} + start-unicode-15.0.0-escaped.js start-unicode-5.2.0.js start-unicode-5.2.0-class.js {unsupported: [class-fields-private, class]} start-unicode-5.2.0-class-escaped.js {unsupported: [class-fields-private, class]} From 53fc267e69f6bb32abce09bb124a73a1d5cd38fb Mon Sep 17 00:00:00 2001 From: Ronald Brill Date: Sat, 21 Sep 2024 18:40:02 +0200 Subject: [PATCH 4/4] fix copy & paste error --- .../org/mozilla/javascript/NativeObject.java | 4 +-- tests/testsrc/test262.properties | 25 +------------------ 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeObject.java b/rhino/src/main/java/org/mozilla/javascript/NativeObject.java index ddacca6ffc..ef5aaab2ca 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeObject.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeObject.java @@ -647,9 +647,9 @@ public Object execIdCall( boolean status = AbstractEcmaObjectOperations.setIntegrityLevel( - cx, arg, AbstractEcmaObjectOperations.INTEGRITY_LEVEL.SEALED); + cx, arg, AbstractEcmaObjectOperations.INTEGRITY_LEVEL.FROZEN); if (!status) { - throw ScriptRuntime.typeError("Object is not sealable"); + throw ScriptRuntime.typeError("Object is not freezable"); } return arg; diff --git a/tests/testsrc/test262.properties b/tests/testsrc/test262.properties index 58a581a724..be2472b81a 100644 --- a/tests/testsrc/test262.properties +++ b/tests/testsrc/test262.properties @@ -1041,7 +1041,7 @@ built-ins/Number 23/335 (6.87%) S9.3.1_A3_T1_U180E.js {unsupported: [u180e]} S9.3.1_A3_T2_U180E.js {unsupported: [u180e]} -built-ins/Object 212/3408 (6.22%) +built-ins/Object 189/3408 (5.55%) assign/assignment-to-readonly-property-of-target-must-throw-a-typeerror-exception.js assign/not-a-constructor.js assign/source-own-prop-error.js @@ -1102,26 +1102,6 @@ built-ins/Object 212/3408 (6.22%) entries/not-a-constructor.js entries/observable-operations.js entries/order-after-define-property-with-function.js - freeze/15.2.3.9-2-a-1.js - freeze/15.2.3.9-2-a-10.js - freeze/15.2.3.9-2-a-11.js - freeze/15.2.3.9-2-a-13.js - freeze/15.2.3.9-2-a-14.js - freeze/15.2.3.9-2-a-2.js - freeze/15.2.3.9-2-a-7.js - freeze/15.2.3.9-2-a-8.js - freeze/15.2.3.9-2-a-9.js - freeze/15.2.3.9-2-b-i-1.js - freeze/15.2.3.9-2-b-i-2.js - freeze/15.2.3.9-2-d-1.js - freeze/15.2.3.9-2-d-2.js - freeze/15.2.3.9-2-d-7.js - freeze/15.2.3.9-2-d-9.js - freeze/15.2.3.9-4-1.js - freeze/15.2.3.9-4-2.js - freeze/15.2.3.9-4-3.js - freeze/frozen-object-contains-symbol-properties-non-strict.js non-strict - freeze/frozen-object-contains-symbol-properties-strict.js strict freeze/not-a-constructor.js freeze/proxy-no-ownkeys-returned-keys-order.js freeze/proxy-with-defineProperty-handler.js @@ -1152,9 +1132,6 @@ built-ins/Object 212/3408 (6.22%) hasOwn/symbol_property_valueOf.js internals/DefineOwnProperty/consistent-value-regexp-dollar1.js isExtensible/not-a-constructor.js - isFrozen/15.2.3.12-1-5.js - isFrozen/15.2.3.12-1-6.js - isFrozen/15.2.3.12-1-7.js isFrozen/not-a-constructor.js isFrozen/proxy-no-ownkeys-returned-keys-order.js isSealed/not-a-constructor.js