diff --git a/examples/Matrix.java b/examples/Matrix.java index cea70015df..baf0810c8d 100644 --- a/examples/Matrix.java +++ b/examples/Matrix.java @@ -9,6 +9,7 @@ import org.mozilla.javascript.Context; import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.ScriptableObject; +import org.mozilla.javascript.Symbol; /** * Matrix: An example host object class that implements the Scriptable interface. @@ -93,6 +94,17 @@ public boolean has(int index, Scriptable start) { return true; } + /** + * Defines all numeric properties by returning true. + * + * @param key the key of the property + * @param start the object where lookup began + */ + @Override + public boolean has(Symbol key, Scriptable start) { + return true; + } + /** * Get the named property. * @@ -172,6 +184,14 @@ public void delete(String id) {} @Override public void delete(int index) {} + /** + * Remove an symbol property. + * + *

This method shouldn't even be called since we define all properties as PERMANENT. + */ + @Override + public void delete(Symbol key) {} + /** Get prototype. */ @Override public Scriptable getPrototype() { diff --git a/src/org/mozilla/javascript/NativeReflect.java b/src/org/mozilla/javascript/NativeReflect.java new file mode 100644 index 0000000000..54d8b40e8b --- /dev/null +++ b/src/org/mozilla/javascript/NativeReflect.java @@ -0,0 +1,468 @@ +/* -*- 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 IdScriptableObject { + private static final long serialVersionUID = 2920773905356325445L; + + private static final Object REFLECT_TAG = "Reflect"; + + static void init(Scriptable scope, boolean sealed) { + NativeReflect obj = new NativeReflect(); + obj.activatePrototypeMap(LAST_METHOD_ID); + obj.setPrototype(getObjectPrototype(scope)); + obj.setParentScope(scope); + if (sealed) { + obj.sealObject(); + } + ScriptableObject.defineProperty(scope, "Reflect", obj, ScriptableObject.DONTENUM); + } + + private NativeReflect() {} + + @Override + public String getClassName() { + return "Reflect"; + } + + @Override + protected void initPrototypeId(int id) { + if (id <= LAST_METHOD_ID) { + String name; + int arity; + switch (id) { + case Id_toSource: + arity = 0; + name = "toSource"; + break; + case Id_apply: + arity = 3; + name = "apply"; + break; + case Id_construct: + arity = 2; + name = "construct"; + break; + case Id_defineProperty: + arity = 3; + name = "defineProperty"; + break; + case Id_deleteProperty: + arity = 2; + name = "deleteProperty"; + break; + case Id_get: + arity = 2; + name = "get"; + break; + case Id_getOwnPropertyDescriptor: + arity = 2; + name = "getOwnPropertyDescriptor"; + break; + case Id_getPrototypeOf: + arity = 1; + name = "getPrototypeOf"; + break; + case Id_has: + arity = 2; + name = "has"; + break; + case Id_isExtensible: + arity = 1; + name = "isExtensible"; + break; + case Id_ownKeys: + arity = 1; + name = "ownKeys"; + break; + case Id_preventExtensions: + arity = 1; + name = "preventExtensions"; + break; + case Id_set: + arity = 3; + name = "set"; + break; + case Id_setPrototypeOf: + arity = 2; + name = "setPrototypeOf"; + break; + default: + throw new IllegalStateException(String.valueOf(id)); + } + initPrototypeMethod(REFLECT_TAG, id, name, arity); + } + } + + @Override + public Object execIdCall( + IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { + if (!f.hasTag(REFLECT_TAG)) { + return super.execIdCall(f, cx, scope, thisObj, args); + } + + int methodId = f.methodId(); + switch (methodId) { + case Id_toSource: + return "Reflect"; + + case Id_apply: + return js_apply(cx, scope, args); + case Id_construct: + return js_construct(cx, scope, args); + case Id_defineProperty: + return js_defineProperty(cx, args); + case Id_deleteProperty: + return js_deleteProperty(args); + case Id_get: + return js_get(args); + case Id_getOwnPropertyDescriptor: + return js_getOwnPropertyDescriptor(cx, args); + case Id_getPrototypeOf: + return js_getPrototypeOf(args); + case Id_has: + return js_has(args); + case Id_isExtensible: + return js_isExtensible(args); + case Id_ownKeys: + return js_ownKeys(cx, scope, args); + case Id_preventExtensions: + return js_preventExtensions(args); + case Id_set: + return js_set(args); + case Id_setPrototypeOf: + return js_setPrototypeOf(args); + + default: + throw new IllegalStateException(String.valueOf(methodId)); + } + } + + private static Object js_apply(Context cx, Scriptable scope, 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]); + + Scriptable thisObj = Undefined.SCRIPTABLE_UNDEFINED; + if (args[1] instanceof Scriptable) { + thisObj = (Scriptable) 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}); + } + + private static Scriptable js_construct(Context cx, Scriptable scope, Object[] args) { + if (args.length < 1) { + throw ScriptRuntime.typeErrorById( + "msg.method.missing.parameter", + "Reflect.construct", + "3", + Integer.toString(args.length)); + } + + if (!(args[0] instanceof Function)) { + throw ScriptRuntime.typeErrorById("msg.not.ctor", ScriptRuntime.typeof(args[0])); + } + + Function ctor = (Function) args[0]; + if (args.length < 2) { + return ctor.construct(cx, scope, ScriptRuntime.emptyArgs); + } + Object[] callArgs = ScriptRuntime.getApplyArguments(cx, args[1]); + return ctor.construct(cx, scope, callArgs); + } + + private static boolean js_defineProperty(Context cx, Object[] args) { + if (args.length < 3) { + throw ScriptRuntime.typeErrorById( + "msg.method.missing.parameter", + "Reflect.apply", + "3", + Integer.toString(args.length)); + } + + ScriptableObject obj = checkTarget(args); + ScriptableObject desc = ScriptableObject.ensureScriptableObject(args[2]); + + try { + obj.defineOwnProperty(cx, args[1], desc); + return true; + } catch (EcmaError e) { + return false; + } + } + + private static boolean js_deleteProperty(Object[] args) { + ScriptableObject obj = checkTarget(args); + + if (args.length > 1) { + if (ScriptRuntime.isSymbol(args[1])) { + return ScriptableObject.deleteProperty(obj, (Symbol) args[1]); + } + + return ScriptableObject.deleteProperty(obj, ScriptRuntime.toString(args[1])); + } + return false; + } + + private static Object js_get(Object[] args) { + ScriptableObject obj = checkTarget(args); + + if (args.length > 1) { + if (ScriptRuntime.isSymbol(args[1])) { + Object prop = ScriptableObject.getProperty(obj, (Symbol) args[1]); + return prop == Scriptable.NOT_FOUND ? Undefined.SCRIPTABLE_UNDEFINED : prop; + } + if (args[1] instanceof Double) { + Object prop = ScriptableObject.getProperty(obj, ScriptRuntime.toIndex(args[1])); + return prop == Scriptable.NOT_FOUND ? Undefined.SCRIPTABLE_UNDEFINED : prop; + } + + Object prop = ScriptableObject.getProperty(obj, ScriptRuntime.toString(args[1])); + return prop == Scriptable.NOT_FOUND ? Undefined.SCRIPTABLE_UNDEFINED : prop; + } + return Undefined.SCRIPTABLE_UNDEFINED; + } + + private static Scriptable js_getOwnPropertyDescriptor(Context cx, Object[] args) { + ScriptableObject obj = checkTarget(args); + + if (args.length > 1) { + if (ScriptRuntime.isSymbol(args[1])) { + ScriptableObject desc = obj.getOwnPropertyDescriptor(cx, args[1]); + return desc == null ? Undefined.SCRIPTABLE_UNDEFINED : desc; + } + + ScriptableObject desc = + obj.getOwnPropertyDescriptor(cx, ScriptRuntime.toString(args[1])); + return desc == null ? Undefined.SCRIPTABLE_UNDEFINED : desc; + } + return Undefined.SCRIPTABLE_UNDEFINED; + } + + private static Scriptable js_getPrototypeOf(Object[] args) { + ScriptableObject obj = checkTarget(args); + + return obj.getPrototype(); + } + + private static boolean js_has(Object[] args) { + ScriptableObject obj = checkTarget(args); + + if (args.length > 1) { + if (ScriptRuntime.isSymbol(args[1])) { + return ScriptableObject.hasProperty(obj, (Symbol) args[1]); + } + + return ScriptableObject.hasProperty(obj, ScriptRuntime.toString(args[1])); + } + return false; + } + + private static boolean js_isExtensible(Object[] args) { + ScriptableObject obj = checkTarget(args); + return obj.isExtensible(); + } + + private static Scriptable js_ownKeys(Context cx, Scriptable scope, Object[] args) { + ScriptableObject obj = checkTarget(args); + + final List strings = new ArrayList<>(); + final List symbols = new ArrayList<>(); + + for (Object o : obj.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 boolean js_preventExtensions(Object[] args) { + ScriptableObject obj = checkTarget(args); + + obj.preventExtensions(); + return true; + } + + private static boolean js_set(Object[] args) { + ScriptableObject obj = checkTarget(args); + + if (args.length > 1) { + Object value = args.length < 2 ? Undefined.instance : args[2]; + + if (ScriptRuntime.isSymbol(args[1])) { + obj.put((Symbol) args[1], obj, value); + return true; + } + if (args[1] instanceof Double) { + obj.put(ScriptRuntime.toIndex(args[1]), obj, value); + return true; + } + + obj.put(ScriptRuntime.toString(args[1]), obj, value); + return true; + } + return false; + } + + private static boolean js_setPrototypeOf(Object[] args) { + if (args.length < 2) { + throw ScriptRuntime.typeErrorById( + "msg.method.missing.parameter", + "Reflect.js_setPrototypeOf", + "2", + Integer.toString(args.length)); + } + + ScriptableObject obj = checkTarget(args); + + if (obj.getPrototype() == args[1]) { + return true; + } + + if (!obj.isExtensible()) { + return false; + } + + if (args[1] == null) { + obj.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 (obj.getPrototype() == proto) { + return true; + } + + // avoid cycles + Scriptable p = proto; + while (p != null) { + if (obj == p) { + return false; + } + p = p.getPrototype(); + } + + obj.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]); + } + + @Override + protected int findPrototypeId(String s) { + int id; + switch (s) { + case "toSource": + id = Id_toSource; + break; + case "apply": + id = Id_apply; + break; + case "construct": + id = Id_construct; + break; + case "defineProperty": + id = Id_defineProperty; + break; + case "deleteProperty": + id = Id_deleteProperty; + break; + case "get": + id = Id_get; + break; + case "getOwnPropertyDescriptor": + id = Id_getOwnPropertyDescriptor; + break; + case "getPrototypeOf": + id = Id_getPrototypeOf; + break; + case "has": + id = Id_has; + break; + case "isExtensible": + id = Id_isExtensible; + break; + case "ownKeys": + id = Id_ownKeys; + break; + case "preventExtensions": + id = Id_preventExtensions; + break; + case "set": + id = Id_set; + break; + case "setPrototypeOf": + id = Id_setPrototypeOf; + break; + + default: + id = 0; + break; + } + return id; + } + + private static final int Id_toSource = 1, + Id_apply = 2, + Id_construct = 3, + Id_defineProperty = 4, + Id_deleteProperty = 5, + Id_get = 6, + Id_getOwnPropertyDescriptor = 7, + Id_getPrototypeOf = 8, + Id_has = 9, + Id_isExtensible = 10, + Id_ownKeys = 11, + Id_preventExtensions = 12, + Id_set = 13, + Id_setPrototypeOf = 14, + LAST_METHOD_ID = Id_setPrototypeOf; +} diff --git a/src/org/mozilla/javascript/ScriptRuntime.java b/src/org/mozilla/javascript/ScriptRuntime.java index 0a5dfea781..c161da8e4c 100644 --- a/src/org/mozilla/javascript/ScriptRuntime.java +++ b/src/org/mozilla/javascript/ScriptRuntime.java @@ -286,6 +286,8 @@ public static ScriptableObject initSafeStandardObjects( NativeWeakMap.init(scope, sealed); NativeWeakSet.init(scope, sealed); NativeBigInt.init(scope, sealed); + + NativeReflect.init(scope, sealed); } if (scope instanceof TopLevel) { diff --git a/src/org/mozilla/javascript/Scriptable.java b/src/org/mozilla/javascript/Scriptable.java index cc37012fb3..26b7f7f240 100644 --- a/src/org/mozilla/javascript/Scriptable.java +++ b/src/org/mozilla/javascript/Scriptable.java @@ -126,6 +126,9 @@ public interface Scriptable { */ public boolean has(int index, Scriptable start); + /** A version of delete for properties with Symbol keys. */ + public boolean has(Symbol key, Scriptable start); + /** * Sets a named property in this object. * @@ -228,6 +231,9 @@ public interface Scriptable { */ public void delete(int index); + /** A version of delete for properties with Symbol keys. */ + public void delete(Symbol key); + /** * Get the prototype of the object. * diff --git a/src/org/mozilla/javascript/ScriptableObject.java b/src/org/mozilla/javascript/ScriptableObject.java index e1788091f3..0cf333d0c2 100644 --- a/src/org/mozilla/javascript/ScriptableObject.java +++ b/src/org/mozilla/javascript/ScriptableObject.java @@ -2280,6 +2280,14 @@ 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; + base.delete(key); + return !base.has(key, obj); + } + /** * Returns an array of all ids from an object and its prototypes. * diff --git a/src/org/mozilla/javascript/Undefined.java b/src/org/mozilla/javascript/Undefined.java index 3b30bac193..c9c79266b3 100644 --- a/src/org/mozilla/javascript/Undefined.java +++ b/src/org/mozilla/javascript/Undefined.java @@ -79,6 +79,11 @@ public boolean has(int index, Scriptable start) { return false; } + @Override + public boolean has(Symbol key, Scriptable start) { + return false; + } + @Override public void put(String name, Scriptable start, Object value) {} @@ -91,6 +96,9 @@ public void delete(String name) {} @Override public void delete(int index) {} + @Override + public void delete(Symbol key) {} + @Override public Scriptable getPrototype() { return null; diff --git a/testsrc/org/mozilla/javascript/tests/IterableTest.java b/testsrc/org/mozilla/javascript/tests/IterableTest.java index 5e3d8ad4bd..e4a46fc776 100644 --- a/testsrc/org/mozilla/javascript/tests/IterableTest.java +++ b/testsrc/org/mozilla/javascript/tests/IterableTest.java @@ -239,6 +239,11 @@ public boolean has(int index, Scriptable start) { throw new UnsupportedOperationException("Not supported yet."); } + @Override + public boolean has(Symbol key, Scriptable start) { + throw new UnsupportedOperationException("Not supported yet."); + } + @Override public void put(String name, Scriptable start, Object value) { throw new UnsupportedOperationException("Not supported yet."); @@ -259,6 +264,11 @@ public void delete(int index) { throw new UnsupportedOperationException("Not supported yet."); } + @Override + public void delete(Symbol key) { + throw new UnsupportedOperationException("Not supported yet."); + } + @Override public void setPrototype(Scriptable prototype) { throw new UnsupportedOperationException("Not supported yet."); diff --git a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java index 82670fedab..4bb174aae3 100644 --- a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java +++ b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java @@ -92,10 +92,6 @@ public class Test262SuiteTest { "Atomics", "IsHTMLDDA", "Proxy", - "Reflect", - "Reflect.construct", - "Reflect.set", - "Reflect.setPrototypeOf", "SharedArrayBuffer", "Symbol.species", "async-functions", diff --git a/testsrc/org/mozilla/javascript/tests/es6/NativeReflectTest.java b/testsrc/org/mozilla/javascript/tests/es6/NativeReflectTest.java new file mode 100644 index 0000000000..5cdeb5dab8 --- /dev/null +++ b/testsrc/org/mozilla/javascript/tests/es6/NativeReflectTest.java @@ -0,0 +1,357 @@ +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])"); + } + + @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) {" + " '' + 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) {" + + " '' + 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) {" + + " '' + 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 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 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)"; + // FF: 0,6,8,55,773,s1,str,-1,s2,str2 + testString("-1,0,6,8,55,773,s1,str,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({}).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; + }); + } +} diff --git a/testsrc/test262.properties b/testsrc/test262.properties index bafd3a036e..0aa822da44 100644 --- a/testsrc/test262.properties +++ b/testsrc/test262.properties @@ -14,9 +14,9 @@ built-ins/Array 188/2670 (7.04%) from/source-object-length-set-elem-prop-non-writable.js 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]} - length/define-own-prop-length-no-value-order.js {unsupported: [Reflect]} + length/define-own-prop-length-coercion-order.js + length/define-own-prop-length-coercion-order-set.js + length/define-own-prop-length-no-value-order.js length/define-own-prop-length-overflow-order.js of/does-not-use-set-for-indices.js of/proto-from-ctor-realm.js @@ -162,11 +162,11 @@ built-ins/Array 188/2670 (7.04%) prototype/methods-called-as-functions.js {unsupported: [Symbol.species, Array.prototype.flatMap]} prototype/Symbol.iterator.js Expects a particular string value Symbol.species 4/4 (100.0%) - 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 30/80 (37.5%) +built-ins/ArrayBuffer 29/80 (36.25%) isView/arg-is-dataview-subclass-instance.js {unsupported: [class]} isView/arg-is-typedarray-subclass-instance.js {unsupported: [class]} prototype/byteLength/detached-buffer.js @@ -189,10 +189,9 @@ built-ins/ArrayBuffer 30/80 (37.5%) prototype/slice/this-is-sharedarraybuffer.js {unsupported: [SharedArrayBuffer]} prototype/Symbol.toStringTag.js Symbol.species 4/4 (100.0%) - data-allocation-after-object-creation.js {unsupported: [Reflect.construct]} - newtarget-prototype-is-not-object.js {unsupported: [Reflect.construct]} - proto-from-ctor-realm.js {unsupported: [Reflect]} - prototype-from-newtarget.js {unsupported: [Reflect.construct]} + data-allocation-after-object-creation.js + proto-from-ctor-realm.js + prototype-from-newtarget.js undefined-newtarget-throws.js built-ins/ArrayIteratorPrototype 1/27 (3.7%) @@ -219,9 +218,9 @@ built-ins/BigInt 14/68 (20.59%) prototype/toString/thisbigintvalue-not-valid-throws.js Computed property is not support built-ins/Boolean 1/49 (2.04%) - proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm.js -built-ins/DataView 166/455 (36.48%) +built-ins/DataView 165/455 (36.26%) prototype/buffer/detached-buffer.js prototype/buffer/invoked-as-accessor.js prototype/buffer/length.js @@ -361,13 +360,12 @@ built-ins/DataView 166/455 (36.48%) 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]} - custom-proto-access-detaches-buffer.js {unsupported: [Reflect.construct]} - 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-detaches-buffer.js + 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.js + 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]} @@ -379,8 +377,8 @@ built-ins/DataView 166/455 (36.48%) 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]} @@ -405,7 +403,7 @@ built-ins/Date 39/707 (5.52%) prototype/Symbol.toPrimitive/name.js prototype/Symbol.toPrimitive/prop-desc.js prototype/Symbol.toPrimitive/this-val-non-obj.js - prototype/toJSON/builtin.js {unsupported: [Reflect.construct]} + prototype/toJSON/builtin.js prototype/toJSON/called-as-function.js prototype/toJSON/invoke-result.js prototype/toJSON/to-primitive-symbol.js @@ -414,10 +412,10 @@ built-ins/Date 39/707 (5.52%) prototype/no-date-value.js UTC/coercion-order.js coercion-order.js - 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 + subclassing.js value-get-symbol-to-prim-err.js value-symbol-to-prim-err.js value-symbol-to-prim-invocation.js @@ -453,7 +451,7 @@ built-ins/Error 5/42 (11.9%) prototype/toString/invalid-receiver.js prototype/no-error-data.js prototype/S15.11.4_A2.js - proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm.js built-ins/eval 3/9 (33.33%) length-non-configurable.js @@ -487,18 +485,18 @@ built-ins/Function 186/505 (36.83%) 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/proto-from-ctor-realm.js {unsupported: [Reflect]} + 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 @@ -544,7 +542,7 @@ built-ins/Function 186/505 (36.83%) 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 @@ -638,8 +636,8 @@ built-ins/Function 186/505 (36.83%) call-bind-this-realm-undef.js call-bind-this-realm-value.js private-identifiers-not-empty.js {unsupported: [class-fields-private]} - 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 @@ -688,7 +686,7 @@ built-ins/isNaN 8/16 (50.0%) ~built-ins/IteratorPrototype built-ins/JSON 36/140 (25.71%) - parse/builtin.js {unsupported: [Reflect.construct]} + parse/builtin.js parse/revived-proxy.js {unsupported: [Proxy]} parse/revived-proxy-revoked.js {unsupported: [Proxy]} parse/reviver-array-define-prop-err.js {unsupported: [Proxy]} @@ -704,7 +702,7 @@ built-ins/JSON 36/140 (25.71%) parse/reviver-object-non-configurable-prop-delete.js strict parse/reviver-object-own-keys-err.js {unsupported: [Proxy]} parse/text-negative-zero.js - stringify/builtin.js {unsupported: [Reflect.construct]} + stringify/builtin.js stringify/replacer-array-abrupt.js {unsupported: [Proxy]} stringify/replacer-array-number.js stringify/replacer-array-proxy.js {unsupported: [Proxy]} @@ -728,7 +726,7 @@ built-ins/JSON 36/140 (25.71%) built-ins/Map 6/145 (4.14%) Symbol.species 4/4 (100.0%) iterator-is-undefined-throws.js - proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm.js built-ins/MapIteratorPrototype 0/11 (0.0%) @@ -742,17 +740,17 @@ built-ins/NativeErrors 35/108 (32.41%) AggregateError/prototype 6/6 (100.0%) AggregateError 17/17 (100.0%) EvalError/prototype/not-error-object.js - EvalError/proto-from-ctor-realm.js {unsupported: [Reflect]} + EvalError/proto-from-ctor-realm.js RangeError/prototype/not-error-object.js - RangeError/proto-from-ctor-realm.js {unsupported: [Reflect]} + RangeError/proto-from-ctor-realm.js ReferenceError/prototype/not-error-object.js - ReferenceError/proto-from-ctor-realm.js {unsupported: [Reflect]} + ReferenceError/proto-from-ctor-realm.js SyntaxError/prototype/not-error-object.js - SyntaxError/proto-from-ctor-realm.js {unsupported: [Reflect]} + SyntaxError/proto-from-ctor-realm.js TypeError/prototype/not-error-object.js - TypeError/proto-from-ctor-realm.js {unsupported: [Reflect]} + TypeError/proto-from-ctor-realm.js URIError/prototype/not-error-object.js - URIError/proto-from-ctor-realm.js {unsupported: [Reflect]} + URIError/proto-from-ctor-realm.js built-ins/Number 9/283 (3.18%) prototype/toExponential/return-abrupt-tointeger-fractiondigits.js @@ -760,12 +758,12 @@ built-ins/Number 9/283 (3.18%) prototype/toExponential/undefined-fractiondigits.js prototype/toLocaleString/length.js prototype/toPrecision/nan.js - proto-from-ctor-realm.js {unsupported: [Reflect]} + 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 127/3150 (4.03%) +built-ins/Object 122/3150 (3.87%) 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]} @@ -809,7 +807,7 @@ built-ins/Object 127/3150 (4.03%) entries/observable-operations.js {unsupported: [Proxy]} entries/order-after-define-property.js freeze/abrupt-completion.js {unsupported: [Proxy]} - freeze/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy, Reflect]} + freeze/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy]} freeze/throws-when-false.js fromEntries/evaluation-order.js fromEntries/iterator-closed-for-null-entry.js @@ -824,7 +822,7 @@ built-ins/Object 127/3150 (4.03%) fromEntries/to-property-key.js fromEntries/uses-keys-not-iterator.js getOwnPropertyDescriptors/observable-operations.js {unsupported: [Proxy]} - getOwnPropertyDescriptors/order-after-define-property.js {unsupported: [Reflect]} + getOwnPropertyDescriptors/order-after-define-property.js getOwnPropertyDescriptors/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy]} getOwnPropertyDescriptors/proxy-undefined-descriptor.js {unsupported: [Proxy]} getOwnPropertyDescriptor/15.2.3.3-4-212.js @@ -841,12 +839,9 @@ built-ins/Object 127/3150 (4.03%) 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]} - 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 - isFrozen/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy, Reflect]} - isSealed/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy, Reflect]} + isFrozen/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy]} + isSealed/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy]} keys/order-after-define-property.js {unsupported: [Proxy]} keys/property-traps-order-with-proxied-array.js {unsupported: [Proxy]} keys/proxy-keys.js @@ -860,7 +855,7 @@ built-ins/Object 127/3150 (4.03%) 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/builtin.js prototype/isPrototypeOf/null-this-and-primitive-arg-returns-false.js prototype/isPrototypeOf/undefined-this-and-primitive-arg-returns-false.js prototype/propertyIsEnumerable/symbol_property_toPrimitive.js @@ -883,16 +878,14 @@ built-ins/Object 127/3150 (4.03%) prototype/toString/symbol-tag-str.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/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy, Reflect]} + seal/proxy-no-ownkeys-returned-keys-order.js {unsupported: [Proxy]} seal/throws-when-false.js setPrototypeOf/set-error.js {unsupported: [Proxy]} values/observable-operations.js {unsupported: [Proxy]} values/order-after-define-property.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/parseFloat 3/58 (5.17%) name.js @@ -904,7 +897,7 @@ built-ins/parseInt 3/60 (5.0%) S15.1.2.2_A2_T10_U180E.js {unsupported: [u180e]} S15.1.2.2_A9.2.js -built-ins/Promise 405/599 (67.61%) +built-ins/Promise 404/599 (67.45%) allSettled/capability-resolve-throws-reject.js {unsupported: [async]} allSettled/ctx-ctor.js {unsupported: [class]} allSettled/does-not-invoke-array-setters.js {unsupported: [async]} @@ -1114,15 +1107,15 @@ built-ins/Promise 405/599 (67.61%) any/species-get-error.js {unsupported: [Symbol.species]} 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/invokes-then-with-function.js prototype/finally/rejected-observable-then-calls.js {unsupported: [async]} - prototype/finally/rejected-observable-then-calls-argument.js {unsupported: [Reflect.construct, async]} + prototype/finally/rejected-observable-then-calls-argument.js {unsupported: [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]} @@ -1276,14 +1269,13 @@ built-ins/Promise 405/599 (67.61%) resolve/S25.Promise_resolve_foreign_thenable_1.js {unsupported: [async]} resolve/S25.Promise_resolve_foreign_thenable_2.js {unsupported: [async]} Symbol.species 5/5 (100.0%) - 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-nonconstructor.js {unsupported: [Reflect.construct]} - get-prototype-abrupt.js {unsupported: [Reflect.construct, Reflect]} - get-prototype-abrupt-executor-not-callable.js {unsupported: [Reflect.construct, Reflect]} - proto-from-ctor-realm.js {unsupported: [Reflect]} + executor-function-nonconstructor.js + get-prototype-abrupt.js + proto-from-ctor-realm.js reject-ignored-via-abrupt.js {unsupported: [async]} reject-ignored-via-fn-deferred.js {unsupported: [async]} reject-ignored-via-fn-immed.js {unsupported: [async]} @@ -1309,7 +1301,36 @@ built-ins/Promise 405/599 (67.61%) ~built-ins/Proxy -~built-ins/Reflect +built-ins/Reflect 29/139 (20.86%) + construct/newtarget-is-not-constructor-throws.js + construct/return-with-newtarget-argument.js + defineProperty/return-abrupt-from-property-key.js + defineProperty/return-abrupt-from-result.js {unsupported: [Proxy]} + deleteProperty/return-abrupt-from-result.js {unsupported: [Proxy]} + deleteProperty/return-boolean.js strict + getOwnPropertyDescriptor/return-abrupt-from-result.js {unsupported: [Proxy]} + getPrototypeOf/return-abrupt-from-result.js {unsupported: [Proxy]} + get/return-value-from-receiver.js + has/return-abrupt-from-result.js {unsupported: [Proxy]} + isExtensible/return-abrupt-from-result.js {unsupported: [Proxy]} + ownKeys/order-after-define-property.js + ownKeys/return-abrupt-from-result.js {unsupported: [Proxy]} + ownKeys/return-on-corresponding-order-large-index.js {unsupported: [computed-property-names]} + preventExtensions/return-abrupt-from-result.js {unsupported: [Proxy]} + preventExtensions/return-boolean-from-proxy-object.js {unsupported: [Proxy]} + setPrototypeOf/return-abrupt-from-result.js {unsupported: [Proxy]} + set/call-prototype-property-set.js + set/creates-a-data-descriptor.js + set/different-property-descriptors.js + set/receiver-is-not-object.js + set/return-abrupt-from-property-key.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 + set/set-value-on-accessor-descriptor-with-receiver.js + set/set-value-on-data-descriptor.js + set/symbol-property.js + Symbol.toStringTag.js built-ins/RegExp 897/1464 (61.27%) CharacterClassEscapes 24/24 (100.0%) @@ -1531,7 +1552,7 @@ built-ins/RegExp 897/1464 (61.27%) from-regexp-like-get-flags-err.js from-regexp-like-get-source-err.js from-regexp-like-short-circuit.js - 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 @@ -1548,7 +1569,7 @@ built-ins/RegExp 897/1464 (61.27%) built-ins/Set 5/188 (2.66%) Symbol.species 4/4 (100.0%) - proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm.js built-ins/SetIteratorPrototype 0/11 (0.0%) @@ -1617,11 +1638,11 @@ built-ins/String 120/1114 (10.77%) prototype/trimStart/this-value-object-valueof-returns-object-err.js prototype/trim/u180e.js {unsupported: [u180e]} prototype/valueOf/non-generic-realm.js - proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm.js built-ins/StringIteratorPrototype 0/7 (0.0%) -built-ins/Symbol 29/85 (34.12%) +built-ins/Symbol 28/85 (32.94%) asyncIterator/prop-desc.js for/cross-realm.js hasInstance/cross-realm.js @@ -1646,7 +1667,6 @@ built-ins/Symbol 29/85 (34.12%) toPrimitive/cross-realm.js toStringTag/cross-realm.js unscopables/cross-realm.js - is-constructor.js {unsupported: [Reflect.construct]} built-ins/ThrowTypeError 7/13 (53.85%) extensible.js @@ -1734,7 +1754,7 @@ built-ins/TypedArray 992/1070 (92.71%) prototype/every/callbackfn-not-called-on-empty.js prototype/every/callbackfn-return-does-not-change-instance.js prototype/every/callbackfn-returns-abrupt.js - prototype/every/callbackfn-set-value-during-interaction.js {unsupported: [Reflect.set]} + prototype/every/callbackfn-set-value-during-interaction.js prototype/every/callbackfn-this.js prototype/every/detached-buffer.js prototype/every/get-length-uses-internal-arraylength.js @@ -1782,7 +1802,7 @@ built-ins/TypedArray 992/1070 (92.71%) prototype/filter/callbackfn-not-called-on-empty.js prototype/filter/callbackfn-return-does-not-change-instance.js prototype/filter/callbackfn-returns-abrupt.js - prototype/filter/callbackfn-set-value-during-iteration.js {unsupported: [Reflect.set]} + prototype/filter/callbackfn-set-value-during-iteration.js prototype/filter/callbackfn-this.js prototype/filter/detached-buffer.js prototype/filter/invoked-as-func.js @@ -1857,7 +1877,7 @@ built-ins/TypedArray 992/1070 (92.71%) prototype/forEach/callbackfn-not-called-on-empty.js prototype/forEach/callbackfn-return-does-not-change-instance.js prototype/forEach/callbackfn-returns-abrupt.js - prototype/forEach/callbackfn-set-value-during-interaction.js {unsupported: [Reflect.set]} + prototype/forEach/callbackfn-set-value-during-interaction.js prototype/forEach/callbackfn-this.js prototype/forEach/detached-buffer.js prototype/forEach/invoked-as-func.js @@ -1965,7 +1985,7 @@ built-ins/TypedArray 992/1070 (92.71%) prototype/map/callbackfn-return-does-not-change-instance.js prototype/map/callbackfn-return-does-not-copy-non-integer-properties.js prototype/map/callbackfn-returns-abrupt.js - prototype/map/callbackfn-set-value-during-interaction.js {unsupported: [Reflect.set]} + prototype/map/callbackfn-set-value-during-interaction.js prototype/map/callbackfn-this.js prototype/map/detached-buffer.js prototype/map/invoked-as-func.js @@ -2002,7 +2022,7 @@ built-ins/TypedArray 992/1070 (92.71%) prototype/reduceRight/callbackfn-not-called-on-empty.js prototype/reduceRight/callbackfn-return-does-not-change-instance.js prototype/reduceRight/callbackfn-returns-abrupt.js - prototype/reduceRight/callbackfn-set-value-during-iteration.js {unsupported: [Reflect.set]} + prototype/reduceRight/callbackfn-set-value-during-iteration.js prototype/reduceRight/callbackfn-this.js prototype/reduceRight/detached-buffer.js prototype/reduceRight/empty-instance-return-initialvalue.js @@ -2025,7 +2045,7 @@ built-ins/TypedArray 992/1070 (92.71%) prototype/reduce/callbackfn-not-called-on-empty.js prototype/reduce/callbackfn-return-does-not-change-instance.js prototype/reduce/callbackfn-returns-abrupt.js - prototype/reduce/callbackfn-set-value-during-iteration.js {unsupported: [Reflect.set]} + prototype/reduce/callbackfn-set-value-during-iteration.js prototype/reduce/callbackfn-this.js prototype/reduce/detached-buffer.js prototype/reduce/empty-instance-return-initialvalue.js @@ -2130,7 +2150,7 @@ built-ins/TypedArray 992/1070 (92.71%) prototype/some/callbackfn-not-called-on-empty.js prototype/some/callbackfn-return-does-not-change-instance.js prototype/some/callbackfn-returns-abrupt.js - prototype/some/callbackfn-set-value-during-interaction.js {unsupported: [Reflect.set]} + prototype/some/callbackfn-set-value-during-interaction.js prototype/some/callbackfn-this.js prototype/some/detached-buffer.js prototype/some/get-length-uses-internal-arraylength.js @@ -2217,7 +2237,7 @@ built-ins/TypedArray 992/1070 (92.71%) name.js prototype.js -built-ins/TypedArrayConstructors 529/684 (77.34%) +built-ins/TypedArrayConstructors 518/684 (75.73%) BigInt64Array/prototype 4/4 (100.0%) BigInt64Array 7/7 (100.0%) BigUint64Array/prototype 4/4 (100.0%) @@ -2235,8 +2255,8 @@ built-ins/TypedArrayConstructors 529/684 (77.34%) 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 @@ -2251,30 +2271,27 @@ built-ins/TypedArrayConstructors 529/684 (77.34%) 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/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.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/length-arg/use-custom-proto-if-object.js + ctors/no-args/custom-proto-access-throws.js + ctors/no-args/proto-from-ctor-realm.js + ctors/no-args/use-custom-proto-if-object.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/iterating-throws.js ctors/object-arg/iterator-is-null-as-array-like.js ctors/object-arg/iterator-not-callable-throws.js @@ -2283,16 +2300,15 @@ built-ins/TypedArrayConstructors 529/684 (77.34%) 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/object-arg/use-custom-proto-if-object.js + ctors/typedarray-arg/custom-proto-access-throws.js ctors/typedarray-arg/detached-when-species-retrieved-different-type.js {unsupported: [Symbol.species]} ctors/typedarray-arg/detached-when-species-retrieved-same-type.js {unsupported: [Symbol.species]} ctors/typedarray-arg/other-ctor-buffer-ctor-access-throws.js @@ -2304,7 +2320,7 @@ built-ins/TypedArrayConstructors 529/684 (77.34%) ctors/typedarray-arg/other-ctor-buffer-ctor-species-null.js {unsupported: [Symbol.species]} ctors/typedarray-arg/other-ctor-buffer-ctor-species-prototype-throws.js {unsupported: [Symbol.species]} ctors/typedarray-arg/other-ctor-buffer-ctor-species-undefined.js {unsupported: [Symbol.species]} - ctors/typedarray-arg/proto-from-ctor-realm.js {unsupported: [Reflect]} + ctors/typedarray-arg/proto-from-ctor-realm.js ctors/typedarray-arg/same-ctor-buffer-ctor-access-throws.js ctors/typedarray-arg/same-ctor-buffer-ctor-species-custom.js {unsupported: [Symbol.species]} ctors/typedarray-arg/same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js {unsupported: [Symbol.species]} @@ -2315,8 +2331,7 @@ built-ins/TypedArrayConstructors 529/684 (77.34%) ctors/typedarray-arg/same-ctor-buffer-ctor-species-undefined.js {unsupported: [Symbol.species]} ctors/typedarray-arg/same-ctor-buffer-ctor-value-not-obj-throws.js ctors/typedarray-arg/src-typedarray-big-throws.js - 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/typedarray-arg/use-custom-proto-if-object.js Float32Array/prototype/not-typedarray-object.js Float32Array/prototype/proto.js Float64Array/prototype/not-typedarray-object.js @@ -2352,7 +2367,24 @@ built-ins/TypedArrayConstructors 529/684 (77.34%) Int8Array/prototype/not-typedarray-object.js Int8Array/prototype/proto.js internals/DefineOwnProperty/BigInt 20/20 (100.0%) - internals/DefineOwnProperty 22/22 (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 + internals/DefineOwnProperty/detached-buffer-realm.js + 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-desc-configurable.js + internals/DefineOwnProperty/key-is-numericindex-desc-not-enumerable.js + internals/DefineOwnProperty/key-is-numericindex-desc-not-writable.js + internals/DefineOwnProperty/non-extensible-redefine-key.js + internals/DefineOwnProperty/set-value.js + internals/DefineOwnProperty/tonumber-value-detached-buffer.js internals/Get/BigInt 14/14 (100.0%) internals/GetOwnProperty/BigInt 12/12 (100.0%) internals/GetOwnProperty/detached-buffer.js @@ -2375,22 +2407,34 @@ built-ins/TypedArrayConstructors 529/684 (77.34%) internals/Get/key-is-out-of-bounds.js internals/Get/key-is-symbol.js internals/HasProperty/BigInt 15/15 (100.0%) - internals/HasProperty 15/15 (100.0%) + internals/HasProperty/abrupt-from-ordinary-has-parent-hasproperty.js {unsupported: [Proxy]} + 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/indexed-value.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/OwnPropertyKeys/BigInt 4/4 (100.0%) internals/OwnPropertyKeys 4/4 (100.0%) internals/Set/BigInt 23/23 (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-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-symbol.js {unsupported: [Reflect]} - internals/Set/tonumber-value-detached-buffer.js {unsupported: [Reflect]} + internals/Set/indexed-value.js + internals/Set/key-is-minus-zero.js + internals/Set/key-is-not-canonical-index.js + internals/Set/key-is-not-integer.js + internals/Set/key-is-not-numeric-index.js + internals/Set/key-is-out-of-bounds.js + internals/Set/key-is-symbol.js + 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 @@ -2443,10 +2487,10 @@ built-ins/TypedArrayConstructors 529/684 (77.34%) built-ins/undefined 0/8 (0.0%) built-ins/WeakMap 1/88 (1.14%) - proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm.js built-ins/WeakSet 1/75 (1.33%) - proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm.js language/arguments-object 191/260 (73.46%) mapped/mapped-arguments-nonconfigurable-3.js non-strict @@ -5050,8 +5094,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 +language/expressions/typeof 1/16 (6.25%) proxy.js {unsupported: [Proxy]} language/expressions/unary-minus 1/14 (7.14%)