From e0f00962d3c41dc71cd8ffd4cc0cfce1f944c2c8 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Mon, 23 May 2022 17:34:15 +0200 Subject: [PATCH 1/6] Make the $262 object available within the test262 tests --- .../javascript/tests/Test262SuiteTest.java | 54 ++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java index 1ed9dfb5d0..41ab09e170 100644 --- a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java +++ b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java @@ -44,6 +44,9 @@ import org.mozilla.javascript.RhinoException; import org.mozilla.javascript.Script; import org.mozilla.javascript.Scriptable; +import org.mozilla.javascript.ScriptableObject; +import org.mozilla.javascript.annotations.JSFunction; +import org.mozilla.javascript.annotations.JSGetter; import org.mozilla.javascript.drivers.TestUtils; import org.mozilla.javascript.tools.SourceReader; import org.mozilla.javascript.tools.shell.ShellContextFactory; @@ -102,7 +105,6 @@ public class Test262SuiteTest { "class-fields-private", "class-fields-public", "computed-property-names", - "cross-realm", "default-arg", "default-parameters", "new.target", @@ -436,6 +438,50 @@ public static void tearDownClass() { private final Test262Case testCase; private final boolean markedAsFailing; + /** + * @see https://github.com/tc39/test262/blob/main/INTERPRETING.md#host-defined-functions + */ + private class $262 { + private ScriptableObject scope; + + public $262(ScriptableObject scope) { + this.scope = scope; + + scope.put("$262", scope, this); + scope.setAttributes("$262", ScriptableObject.DONTENUM); + }; + + @JSFunction + public void gc() { + System.gc(); + } + + @JSFunction + public Object evalScript(String source) { + return Context.getCurrentContext().evaluateString(this.scope, source, "", 1, null); + } + + @JSGetter + public Object getGlobal() { + return this.scope; + } + + @JSFunction + public $262 createRealm() { + return new $262(Context.getCurrentContext().initSafeStandardObjects()); + } + + @JSFunction + public void detachArrayBuffer() { + throw new UnsupportedOperationException("$262.detachArrayBuffer() method not yet implemented"); + } + + @JSGetter + public Object getAgent() { + throw new UnsupportedOperationException("#262.agent property not yet implemented"); + } + }; + public Test262SuiteTest( String testFilePath, int optLevel, @@ -450,7 +496,8 @@ public Test262SuiteTest( } private Scriptable buildScope(Context cx) throws IOException { - Scriptable scope = cx.initSafeStandardObjects(); + ScriptableObject scope = cx.initSafeStandardObjects(); + for (String harnessFile : testCase.harnessFiles) { if (!HARNESS_SCRIPT_CACHE.get(optLevel).containsKey(harnessFile)) { String harnessPath = testHarnessDir + harnessFile; @@ -462,6 +509,9 @@ private Scriptable buildScope(Context cx) throws IOException { } HARNESS_SCRIPT_CACHE.get(optLevel).get(harnessFile).exec(cx, scope); } + + new $262(scope); + return scope; } From 614496df152797581b977ec666f0d9668a1bcb74 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Mon, 23 May 2022 17:44:25 +0200 Subject: [PATCH 2/6] Formatting (as always) --- .../mozilla/javascript/tests/Test262SuiteTest.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java index 41ab09e170..c7f4708451 100644 --- a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java +++ b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java @@ -33,6 +33,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; + import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -438,9 +439,7 @@ public static void tearDownClass() { private final Test262Case testCase; private final boolean markedAsFailing; - /** - * @see https://github.com/tc39/test262/blob/main/INTERPRETING.md#host-defined-functions - */ + /** @see https://github.com/tc39/test262/blob/main/INTERPRETING.md#host-defined-functions */ private class $262 { private ScriptableObject scope; @@ -458,7 +457,8 @@ public void gc() { @JSFunction public Object evalScript(String source) { - return Context.getCurrentContext().evaluateString(this.scope, source, "", 1, null); + return Context.getCurrentContext() + .evaluateString(this.scope, source, "", 1, null); } @JSGetter @@ -473,12 +473,13 @@ public Object getGlobal() { @JSFunction public void detachArrayBuffer() { - throw new UnsupportedOperationException("$262.detachArrayBuffer() method not yet implemented"); + throw new UnsupportedOperationException( + "$262.detachArrayBuffer() method not yet implemented"); } @JSGetter public Object getAgent() { - throw new UnsupportedOperationException("#262.agent property not yet implemented"); + throw new UnsupportedOperationException("#262.agent property not yet implemented"); } }; From a8fb3e9355a16ce99bd1cea5bfb20d725c75b258 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Mon, 23 May 2022 17:49:51 +0200 Subject: [PATCH 3/6] fixed typo and formatting (again) --- testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java index c7f4708451..090cadb70a 100644 --- a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java +++ b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java @@ -33,7 +33,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -479,7 +478,7 @@ public void detachArrayBuffer() { @JSGetter public Object getAgent() { - throw new UnsupportedOperationException("#262.agent property not yet implemented"); + throw new UnsupportedOperationException("$262.agent property not yet implemented"); } }; From dfe04b87286de617927b62b2202cba501818427d Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Mon, 23 May 2022 19:31:11 +0200 Subject: [PATCH 4/6] still more formatting... --- testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java index 090cadb70a..34d8f9b0c7 100644 --- a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java +++ b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java @@ -447,7 +447,7 @@ private class $262 { scope.put("$262", scope, this); scope.setAttributes("$262", ScriptableObject.DONTENUM); - }; + } @JSFunction public void gc() { @@ -480,7 +480,7 @@ public void detachArrayBuffer() { public Object getAgent() { throw new UnsupportedOperationException("$262.agent property not yet implemented"); } - }; + } public Test262SuiteTest( String testFilePath, From daf39764bf32702d0e3cc485f1b4a544910927b6 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Mon, 23 May 2022 20:56:24 +0200 Subject: [PATCH 5/6] Update test262.properties Fix $262 object --- .../javascript/tests/Test262SuiteTest.java | 4 +- testsrc/test262.properties | 201 +++++++++--------- 2 files changed, 101 insertions(+), 104 deletions(-) diff --git a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java index 34d8f9b0c7..db78f4627b 100644 --- a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java +++ b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java @@ -439,9 +439,11 @@ public static void tearDownClass() { private final boolean markedAsFailing; /** @see https://github.com/tc39/test262/blob/main/INTERPRETING.md#host-defined-functions */ - private class $262 { + public class $262 { private ScriptableObject scope; + public $262() {} + public $262(ScriptableObject scope) { this.scope = scope; diff --git a/testsrc/test262.properties b/testsrc/test262.properties index ee436b733b..cb085c3d62 100644 --- a/testsrc/test262.properties +++ b/testsrc/test262.properties @@ -1,12 +1,12 @@ # This is a configuration file for Test262SuiteTest.java. See ./README.md for more info about this file -built-ins/Array 239/2670 (8.95%) +built-ins/Array 238/2670 (8.91%) 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/proto-from-ctor-realm.js {unsupported: [cross-realm]} + from/proto-from-ctor-realm.js from/source-object-constructor.js Error propagation needs work in general from/source-object-iterator-1.js Uses "get" syntax that's not implemented from/source-object-iterator-2.js Uses "get" syntax that's not implemented @@ -18,9 +18,8 @@ built-ins/Array 239/2670 (8.95%) 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-overflow-order.js - length/define-own-prop-length-overflow-realm.js {unsupported: [cross-realm]} of/does-not-use-set-for-indices.js - of/proto-from-ctor-realm.js {unsupported: [cross-realm]} + of/proto-from-ctor-realm.js of/return-abrupt-from-data-property.js Object.preventExtensions doesn't seem to throw of/return-abrupt-from-data-property-using-proxy.js {unsupported: [Proxy]} prototype/concat/arg-length-exceeding-integer-limit.js {unsupported: [Proxy]} @@ -43,8 +42,8 @@ built-ins/Array 239/2670 (8.95%) prototype/concat/Array.prototype.concat_strict-arguments.js prototype/concat/create-ctor-non-object.js prototype/concat/create-ctor-poisoned.js - prototype/concat/create-proto-from-ctor-realm-array.js {unsupported: [cross-realm, Symbol.species]} - prototype/concat/create-proto-from-ctor-realm-non-array.js {unsupported: [cross-realm, Symbol.species]} + prototype/concat/create-proto-from-ctor-realm-array.js {unsupported: [Symbol.species]} + prototype/concat/create-proto-from-ctor-realm-non-array.js {unsupported: [Symbol.species]} prototype/concat/create-proxy.js {unsupported: [Proxy, Symbol.species]} prototype/concat/create-revoked-proxy.js {unsupported: [Proxy]} prototype/concat/create-species.js {unsupported: [Symbol.species]} @@ -91,8 +90,8 @@ built-ins/Array 239/2670 (8.95%) prototype/filter/15.4.4.20-5-1-s.js non-strict prototype/filter/create-ctor-non-object.js prototype/filter/create-ctor-poisoned.js - prototype/filter/create-proto-from-ctor-realm-array.js {unsupported: [cross-realm, Symbol.species]} - prototype/filter/create-proto-from-ctor-realm-non-array.js {unsupported: [cross-realm, Symbol.species]} + prototype/filter/create-proto-from-ctor-realm-array.js {unsupported: [Symbol.species]} + prototype/filter/create-proto-from-ctor-realm-non-array.js {unsupported: [Symbol.species]} prototype/filter/create-proxy.js {unsupported: [Proxy, Symbol.species]} prototype/filter/create-revoked-proxy.js {unsupported: [Proxy]} prototype/filter/create-species.js {unsupported: [Symbol.species]} @@ -117,8 +116,8 @@ built-ins/Array 239/2670 (8.95%) prototype/map/15.4.4.19-5-1-s.js non-strict prototype/map/create-ctor-non-object.js prototype/map/create-ctor-poisoned.js - prototype/map/create-proto-from-ctor-realm-array.js {unsupported: [cross-realm, Symbol.species]} - prototype/map/create-proto-from-ctor-realm-non-array.js {unsupported: [cross-realm, Symbol.species]} + prototype/map/create-proto-from-ctor-realm-array.js {unsupported: [Symbol.species]} + prototype/map/create-proto-from-ctor-realm-non-array.js {unsupported: [Symbol.species]} prototype/map/create-proxy.js {unsupported: [Proxy, Symbol.species]} prototype/map/create-revoked-proxy.js {unsupported: [Proxy]} prototype/map/create-species.js {unsupported: [Symbol.species]} @@ -143,8 +142,8 @@ built-ins/Array 239/2670 (8.95%) prototype/shift/throws-when-this-value-length-is-writable-false.js prototype/slice/create-ctor-non-object.js prototype/slice/create-ctor-poisoned.js - prototype/slice/create-proto-from-ctor-realm-array.js {unsupported: [cross-realm, Symbol.species]} - prototype/slice/create-proto-from-ctor-realm-non-array.js {unsupported: [cross-realm, Symbol.species]} + prototype/slice/create-proto-from-ctor-realm-array.js {unsupported: [Symbol.species]} + prototype/slice/create-proto-from-ctor-realm-non-array.js {unsupported: [Symbol.species]} prototype/slice/create-proxied-array-invalid-len.js {unsupported: [Proxy]} prototype/slice/create-proxy.js {unsupported: [Proxy, Symbol.species]} prototype/slice/create-revoked-proxy.js {unsupported: [Proxy]} @@ -167,8 +166,8 @@ built-ins/Array 239/2670 (8.95%) 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-array.js {unsupported: [cross-realm, Symbol.species]} - prototype/splice/create-proto-from-ctor-realm-non-array.js {unsupported: [cross-realm, Symbol.species]} + prototype/splice/create-proto-from-ctor-realm-array.js {unsupported: [Symbol.species]} + prototype/splice/create-proto-from-ctor-realm-non-array.js {unsupported: [Symbol.species]} prototype/splice/create-proxy.js {unsupported: [Proxy, Symbol.species]} prototype/splice/create-revoked-proxy.js {unsupported: [Proxy]} prototype/splice/create-species.js {unsupported: [Symbol.species]} @@ -197,9 +196,9 @@ built-ins/Array 239/2670 (8.95%) prototype/methods-called-as-functions.js {unsupported: [Symbol.species, Array.prototype.flat, 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, cross-realm]} - proto-from-ctor-realm-two.js {unsupported: [Reflect, cross-realm]} - proto-from-ctor-realm-zero.js {unsupported: [Reflect, cross-realm]} + proto-from-ctor-realm-one.js {unsupported: [Reflect]} + proto-from-ctor-realm-two.js {unsupported: [Reflect]} + proto-from-ctor-realm-zero.js {unsupported: [Reflect]} built-ins/ArrayBuffer 30/80 (37.5%) isView/arg-is-dataview-subclass-instance.js {unsupported: [class]} @@ -226,7 +225,7 @@ built-ins/ArrayBuffer 30/80 (37.5%) 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, cross-realm]} + proto-from-ctor-realm.js {unsupported: [Reflect]} prototype-from-newtarget.js {unsupported: [Reflect.construct]} undefined-newtarget-throws.js @@ -237,7 +236,7 @@ built-ins/ArrayIteratorPrototype 1/27 (3.7%) ~built-ins/Atomics -built-ins/BigInt 15/68 (22.06%) +built-ins/BigInt 14/68 (20.59%) asIntN/bigint-tobigint-errors.js {unsupported: [computed-property-names]} asIntN/bigint-tobigint-toprimitive.js {unsupported: [computed-property-names]} asIntN/bigint-tobigint-wrapped-values.js {unsupported: [computed-property-names]} @@ -252,10 +251,9 @@ built-ins/BigInt 15/68 (22.06%) asUintN/bits-toindex-wrapped-values.js {unsupported: [computed-property-names]} prototype/toString/prototype-call.js Check IsInteger in ES2020, not IsSafeInteger, https://github.com/tc39/test262/commit/bf1b79d65a760a5f03df1198557da2d010f8f397#diff-3ecd6a0c50da5c8f8eff723afb6182a889b7315d99545b055559e22d302cc453 prototype/toString/thisbigintvalue-not-valid-throws.js Computed property is not support - prototype/valueOf/cross-realm.js {unsupported: [cross-realm]} built-ins/Boolean 1/49 (2.04%) - proto-from-ctor-realm.js {unsupported: [Reflect, cross-realm]} + proto-from-ctor-realm.js {unsupported: [Reflect]} built-ins/DataView 166/455 (36.48%) prototype/buffer/detached-buffer.js @@ -415,8 +413,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, cross-realm]} - proto-from-ctor-realm-sab.js {unsupported: [SharedArrayBuffer, Reflect, cross-realm]} + proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm-sab.js {unsupported: [SharedArrayBuffer, Reflect]} 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]} @@ -450,9 +448,9 @@ 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, cross-realm]} - proto-from-ctor-realm-two.js {unsupported: [Reflect, cross-realm]} - proto-from-ctor-realm-zero.js {unsupported: [Reflect, cross-realm]} + 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]} value-get-symbol-to-prim-err.js value-symbol-to-prim-err.js @@ -489,7 +487,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, cross-realm]} + proto-from-ctor-realm.js {unsupported: [Reflect]} built-ins/eval 3/9 (33.33%) length-non-configurable.js @@ -509,7 +507,7 @@ built-ins/Function 194/505 (38.42%) prototype/apply/15.3.4.3-2-s.js strict prototype/apply/15.3.4.3-3-s.js strict prototype/apply/argarray-not-object.js - prototype/apply/argarray-not-object-realm.js {unsupported: [cross-realm]} + prototype/apply/argarray-not-object-realm.js prototype/apply/S15.3.4.3_A3_T1.js non-interpreted prototype/apply/S15.3.4.3_A3_T2.js non-interpreted prototype/apply/S15.3.4.3_A3_T3.js non-interpreted @@ -523,10 +521,10 @@ built-ins/Function 194/505 (38.42%) prototype/apply/S15.3.4.3_A7_T2.js non-interpreted prototype/apply/S15.3.4.3_A7_T5.js non-interpreted prototype/apply/S15.3.4.3_A7_T7.js non-interpreted - prototype/apply/this-not-callable-realm.js {unsupported: [cross-realm]} + prototype/apply/this-not-callable-realm.js prototype/bind/BoundFunction_restricted-properties.js - prototype/bind/get-fn-realm.js {unsupported: [Reflect, cross-realm]} - prototype/bind/get-fn-realm-recursive.js {unsupported: [Reflect, cross-realm]} + 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/instance-construct-newtarget-self-new.js {unsupported: [new.target]} @@ -539,7 +537,7 @@ built-ins/Function 194/505 (38.42%) prototype/bind/instance-name-chained.js prototype/bind/instance-name-error.js prototype/bind/instance-name-non-string.js - prototype/bind/proto-from-ctor-realm.js {unsupported: [Reflect, cross-realm]} + prototype/bind/proto-from-ctor-realm.js {unsupported: [Reflect]} 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 @@ -678,12 +676,12 @@ built-ins/Function 194/505 (38.42%) 15.3.5.4_2-5gs.js strict 15.3.5.4_2-7gs.js strict 15.3.5.4_2-9gs.js strict - call-bind-this-realm-undef.js {unsupported: [cross-realm]} - call-bind-this-realm-value.js {unsupported: [cross-realm]} + call-bind-this-realm-undef.js + call-bind-this-realm-value.js instance-name.js private-identifiers-not-empty.js {unsupported: [class-fields-private]} - proto-from-ctor-realm.js {unsupported: [Reflect, cross-realm]} - proto-from-ctor-realm-prototype.js {unsupported: [Reflect, cross-realm]} + proto-from-ctor-realm.js {unsupported: [Reflect]} + proto-from-ctor-realm-prototype.js {unsupported: [Reflect]} StrictFunction_restricted-properties.js strict ~built-ins/GeneratorFunction @@ -753,7 +751,7 @@ built-ins/JSON 36/140 (25.71%) stringify/replacer-array-number.js stringify/replacer-array-proxy.js {unsupported: [Proxy]} stringify/replacer-array-proxy-revoked.js {unsupported: [Proxy]} - stringify/replacer-array-proxy-revoked-realm.js {unsupported: [Proxy, cross-realm]} + stringify/replacer-array-proxy-revoked-realm.js {unsupported: [Proxy]} stringify/replacer-array-wrong-type.js {unsupported: [Proxy]} stringify/replacer-function-arguments.js stringify/replacer-function-object-deleted-property.js @@ -761,7 +759,7 @@ built-ins/JSON 36/140 (25.71%) stringify/value-array-abrupt.js {unsupported: [Proxy]} stringify/value-array-proxy.js {unsupported: [Proxy]} stringify/value-array-proxy-revoked.js {unsupported: [Proxy]} - stringify/value-bigint-cross-realm.js {unsupported: [cross-realm]} + 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]} @@ -773,7 +771,7 @@ built-ins/Map 7/145 (4.83%) Symbol.species 4/4 (100.0%) iterable-calls-set.js iterator-is-undefined-throws.js - proto-from-ctor-realm.js {unsupported: [Reflect, cross-realm]} + proto-from-ctor-realm.js {unsupported: [Reflect]} built-ins/MapIteratorPrototype 0/11 (0.0%) @@ -787,17 +785,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, cross-realm]} + EvalError/proto-from-ctor-realm.js {unsupported: [Reflect]} RangeError/prototype/not-error-object.js - RangeError/proto-from-ctor-realm.js {unsupported: [Reflect, cross-realm]} + RangeError/proto-from-ctor-realm.js {unsupported: [Reflect]} ReferenceError/prototype/not-error-object.js - ReferenceError/proto-from-ctor-realm.js {unsupported: [Reflect, cross-realm]} + ReferenceError/proto-from-ctor-realm.js {unsupported: [Reflect]} SyntaxError/prototype/not-error-object.js - SyntaxError/proto-from-ctor-realm.js {unsupported: [Reflect, cross-realm]} + SyntaxError/proto-from-ctor-realm.js {unsupported: [Reflect]} TypeError/prototype/not-error-object.js - TypeError/proto-from-ctor-realm.js {unsupported: [Reflect, cross-realm]} + TypeError/proto-from-ctor-realm.js {unsupported: [Reflect]} URIError/prototype/not-error-object.js - URIError/proto-from-ctor-realm.js {unsupported: [Reflect, cross-realm]} + URIError/proto-from-ctor-realm.js {unsupported: [Reflect]} built-ins/Number 9/283 (3.18%) prototype/toExponential/return-abrupt-tointeger-fractiondigits.js @@ -805,7 +803,7 @@ 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, cross-realm]} + proto-from-ctor-realm.js {unsupported: [Reflect]} 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]} @@ -950,7 +948,7 @@ built-ins/Object 141/3150 (4.48%) values/observable-operations.js {unsupported: [Proxy]} values/order-after-define-property.js values/return-order.js - proto-from-ctor-realm.js {unsupported: [Reflect, cross-realm]} + proto-from-ctor-realm.js {unsupported: [Reflect]} subclass-object-arg.js {unsupported: [Reflect.construct, Reflect, class]} built-ins/parseFloat 3/58 (5.17%) @@ -1343,7 +1341,7 @@ built-ins/Promise 406/599 (67.78%) 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, cross-realm]} + proto-from-ctor-realm.js {unsupported: [Reflect]} reject-ignored-via-abrupt.js {unsupported: [async]} reject-ignored-via-fn-deferred.js {unsupported: [async]} reject-ignored-via-fn-immed.js {unsupported: [async]} @@ -1401,24 +1399,24 @@ built-ins/RegExp 897/1464 (61.27%) prototype/flags/this-val-regexp.js {unsupported: [regexp-dotall]} prototype/flags/this-val-regexp-prototype.js prototype/global/15.10.7.2-2.js - prototype/global/cross-realm.js {unsupported: [cross-realm]} + prototype/global/cross-realm.js prototype/global/length.js prototype/global/name.js prototype/global/S15.10.7.2_A9.js prototype/global/this-val-regexp-prototype.js prototype/ignoreCase/15.10.7.3-2.js - prototype/ignoreCase/cross-realm.js {unsupported: [cross-realm]} + prototype/ignoreCase/cross-realm.js prototype/ignoreCase/length.js prototype/ignoreCase/name.js prototype/ignoreCase/S15.10.7.3_A9.js prototype/ignoreCase/this-val-regexp-prototype.js prototype/multiline/15.10.7.4-2.js - prototype/multiline/cross-realm.js {unsupported: [cross-realm]} + prototype/multiline/cross-realm.js prototype/multiline/length.js prototype/multiline/name.js prototype/multiline/S15.10.7.4_A9.js prototype/multiline/this-val-regexp-prototype.js - prototype/source/cross-realm.js {unsupported: [cross-realm]} + prototype/source/cross-realm.js prototype/source/length.js prototype/source/name.js prototype/source/prop-desc.js @@ -1426,7 +1424,7 @@ built-ins/RegExp 897/1464 (61.27%) prototype/source/value-empty.js prototype/source/value-line-terminator.js prototype/source/value-u.js - prototype/sticky/cross-realm.js {unsupported: [cross-realm]} + prototype/sticky/cross-realm.js prototype/sticky/length.js prototype/sticky/name.js prototype/sticky/prop-desc.js @@ -1553,7 +1551,7 @@ built-ins/RegExp 897/1464 (61.27%) prototype/Symbol.split/species-ctor-species-non-ctor.js {unsupported: [Symbol.species]} prototype/Symbol.split/species-ctor-species-undef.js {unsupported: [Symbol.species]} prototype/Symbol.split/species-ctor-y.js {unsupported: [Symbol.species]} - prototype/Symbol.split/splitter-proto-from-ctor-realm.js {unsupported: [cross-realm, Symbol.species]} + prototype/Symbol.split/splitter-proto-from-ctor-realm.js {unsupported: [Symbol.species]} prototype/Symbol.split/str-adv-thru-empty-match.js prototype/Symbol.split/str-coerce-lastindex.js {unsupported: [Symbol.species]} prototype/Symbol.split/str-coerce-lastindex-err.js {unsupported: [Symbol.species]} @@ -1591,7 +1589,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, cross-realm]} + proto-from-ctor-realm.js {unsupported: [Reflect]} quantifier-integer-limit.js S15.10.1_A1_T13.js S15.10.1_A1_T14.js @@ -1608,7 +1606,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, cross-realm]} + proto-from-ctor-realm.js {unsupported: [Reflect]} built-ins/SetIteratorPrototype 0/11 (0.0%) @@ -1649,7 +1647,7 @@ built-ins/String 121/1114 (10.86%) prototype/toLocaleLowerCase/special_casing_conditional.js prototype/toLowerCase/Final_Sigma_U180E.js {unsupported: [u180e]} prototype/toLowerCase/special_casing_conditional.js - prototype/toString/non-generic-realm.js {unsupported: [cross-realm]} + prototype/toString/non-generic-realm.js prototype/trimEnd/this-value-object-cannot-convert-to-primitive-err.js prototype/trimEnd/this-value-object-toprimitive-call-err.js prototype/trimEnd/this-value-object-toprimitive-meth-err.js @@ -1677,21 +1675,21 @@ built-ins/String 121/1114 (10.86%) prototype/trimStart/this-value-object-valueof-meth-priority.js prototype/trimStart/this-value-object-valueof-returns-object-err.js prototype/trim/u180e.js {unsupported: [u180e]} - prototype/valueOf/non-generic-realm.js {unsupported: [cross-realm]} - proto-from-ctor-realm.js {unsupported: [Reflect, cross-realm]} + prototype/valueOf/non-generic-realm.js + proto-from-ctor-realm.js {unsupported: [Reflect]} built-ins/StringIteratorPrototype 0/7 (0.0%) -built-ins/Symbol 30/85 (35.29%) - asyncIterator 2/2 (100.0%) - for/cross-realm.js {unsupported: [cross-realm]} - hasInstance/cross-realm.js {unsupported: [cross-realm]} - isConcatSpreadable/cross-realm.js {unsupported: [cross-realm]} - iterator/cross-realm.js {unsupported: [cross-realm]} +built-ins/Symbol 29/85 (34.12%) + asyncIterator/prop-desc.js + for/cross-realm.js + hasInstance/cross-realm.js + isConcatSpreadable/cross-realm.js + iterator/cross-realm.js keyFor/arg-non-symbol.js - keyFor/cross-realm.js {unsupported: [cross-realm]} + keyFor/cross-realm.js matchAll 2/2 (100.0%) - match/cross-realm.js {unsupported: [cross-realm]} + match/cross-realm.js prototype/description/description-symboldescriptivestring.js prototype/description/descriptor.js prototype/description/get.js @@ -1700,17 +1698,16 @@ built-ins/Symbol 30/85 (35.29%) prototype/description/wrapper.js prototype/Symbol.toPrimitive/name.js prototype/Symbol.toPrimitive/prop-desc.js - replace/cross-realm.js {unsupported: [cross-realm]} - search/cross-realm.js {unsupported: [cross-realm]} + replace/cross-realm.js + search/cross-realm.js species 4/4 (100.0%) - split/cross-realm.js {unsupported: [cross-realm]} - toPrimitive/cross-realm.js {unsupported: [cross-realm]} - toStringTag/cross-realm.js {unsupported: [cross-realm]} - unscopables/cross-realm.js {unsupported: [cross-realm]} + split/cross-realm.js + toPrimitive/cross-realm.js + toStringTag/cross-realm.js + unscopables/cross-realm.js is-constructor.js {unsupported: [Reflect.construct]} -built-ins/ThrowTypeError 8/13 (61.54%) - distinct-cross-realm.js {unsupported: [cross-realm]} +built-ins/ThrowTypeError 7/13 (53.85%) extensible.js forbidden-arguments.js frozen.js @@ -2327,8 +2324,8 @@ built-ins/TypedArrayConstructors 530/684 (77.49%) 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, cross-realm]} - ctors/buffer-arg/proto-from-ctor-realm-sab.js {unsupported: [SharedArrayBuffer, Reflect, cross-realm]} + 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/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]} @@ -2341,12 +2338,12 @@ built-ins/TypedArrayConstructors 530/684 (77.49%) 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, cross-realm]} + ctors/length-arg/proto-from-ctor-realm.js {unsupported: [Reflect]} 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, cross-realm]} + 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/object-arg/as-generator-iterable-returns.js @@ -2360,7 +2357,7 @@ built-ins/TypedArrayConstructors 530/684 (77.49%) 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, cross-realm]} + ctors/object-arg/proto-from-ctor-realm.js {unsupported: [Reflect]} ctors/object-arg/returns.js ctors/object-arg/throws-from-property.js ctors/object-arg/throws-setting-obj-to-primitive.js @@ -2374,17 +2371,17 @@ built-ins/TypedArrayConstructors 530/684 (77.49%) ctors/typedarray-arg/detached-when-species-retrieved-same-type.js {unsupported: [Symbol.species]} ctors/typedarray-arg/other-ctor-buffer-ctor-access-throws.js ctors/typedarray-arg/other-ctor-buffer-ctor-custom-species.js {unsupported: [Symbol.species]} - ctors/typedarray-arg/other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js {unsupported: [cross-realm, Symbol.species]} + ctors/typedarray-arg/other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js {unsupported: [Symbol.species]} ctors/typedarray-arg/other-ctor-buffer-ctor-not-object-throws.js ctors/typedarray-arg/other-ctor-buffer-ctor-species-access-throws.js {unsupported: [Symbol.species]} ctors/typedarray-arg/other-ctor-buffer-ctor-species-not-ctor-throws.js {unsupported: [Symbol.species]} 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, cross-realm]} + ctors/typedarray-arg/proto-from-ctor-realm.js {unsupported: [Reflect]} 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: [cross-realm, Symbol.species]} + ctors/typedarray-arg/same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js {unsupported: [Symbol.species]} ctors/typedarray-arg/same-ctor-buffer-ctor-species-not-ctor.js {unsupported: [Symbol.species]} ctors/typedarray-arg/same-ctor-buffer-ctor-species-null.js {unsupported: [Symbol.species]} ctors/typedarray-arg/same-ctor-buffer-ctor-species-prototype-throws.js {unsupported: [Symbol.species]} @@ -2435,13 +2432,13 @@ built-ins/TypedArrayConstructors 530/684 (77.49%) internals/GetOwnProperty/detached-buffer.js internals/GetOwnProperty/detached-buffer-key-is-not-number.js internals/GetOwnProperty/detached-buffer-key-is-symbol.js - internals/GetOwnProperty/detached-buffer-realm.js {unsupported: [cross-realm]} + internals/GetOwnProperty/detached-buffer-realm.js internals/GetOwnProperty/enumerate-detached-buffer.js internals/GetOwnProperty/index-prop-desc.js internals/Get/detached-buffer.js internals/Get/detached-buffer-key-is-not-numeric-index.js internals/Get/detached-buffer-key-is-symbol.js - internals/Get/detached-buffer-realm.js {unsupported: [cross-realm]} + internals/Get/detached-buffer-realm.js internals/Get/indexed-value.js internals/Get/indexed-value-sab.js {unsupported: [SharedArrayBuffer]} internals/Get/infinity-detached-buffer.js @@ -2459,7 +2456,7 @@ built-ins/TypedArrayConstructors 530/684 (77.49%) 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-realm.js {unsupported: [cross-realm]} + 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]} @@ -2520,10 +2517,10 @@ built-ins/TypedArrayConstructors 530/684 (77.49%) built-ins/undefined 0/8 (0.0%) built-ins/WeakMap 1/88 (1.14%) - proto-from-ctor-realm.js {unsupported: [Reflect, cross-realm]} + proto-from-ctor-realm.js {unsupported: [Reflect]} built-ins/WeakSet 1/75 (1.33%) - proto-from-ctor-realm.js {unsupported: [Reflect, cross-realm]} + proto-from-ctor-realm.js {unsupported: [Reflect]} language/arguments-object 191/260 (73.46%) mapped/mapped-arguments-nonconfigurable-3.js non-strict @@ -3084,7 +3081,7 @@ language/eval-code 259/349 (74.21%) indirect/non-definable-function-with-function.js indirect/non-definable-function-with-variable.js indirect/non-definable-global-var.js non-strict - indirect/realm.js {unsupported: [cross-realm]} + indirect/realm.js indirect/super-call.js {unsupported: [super]} indirect/super-prop.js {unsupported: [super]} indirect/switch-case-decl-strict.js @@ -3395,7 +3392,7 @@ language/expressions/call 64/96 (66.67%) 11.2.3-3_6.js 11.2.3-3_7.js 11.2.3-3_8.js non-strict - eval-realm-indirect.js {unsupported: [cross-realm]} + eval-realm-indirect.js non-strict eval-spread.js eval-spread-empty.js eval-spread-empty-leading.js @@ -3442,10 +3439,10 @@ language/expressions/call 64/96 (66.67%) spread-sngl-literal.js spread-sngl-obj-ident.js tco-call-args.js {unsupported: [tail-call-optimization]} - tco-cross-realm-class-construct.js {unsupported: [tail-call-optimization, cross-realm, class]} - tco-cross-realm-class-derived-construct.js {unsupported: [tail-call-optimization, cross-realm, class]} - tco-cross-realm-fun-call.js {unsupported: [tail-call-optimization, cross-realm, class]} - tco-cross-realm-fun-construct.js {unsupported: [tail-call-optimization, cross-realm, class]} + tco-cross-realm-class-construct.js {unsupported: [tail-call-optimization, class]} + tco-cross-realm-class-derived-construct.js {unsupported: [tail-call-optimization, class]} + tco-cross-realm-fun-call.js {unsupported: [tail-call-optimization, class]} + tco-cross-realm-fun-construct.js {unsupported: [tail-call-optimization, class]} tco-member-args.js {unsupported: [tail-call-optimization]} tco-non-eval-function.js {unsupported: [tail-call-optimization]} tco-non-eval-function-dynamic.js {unsupported: [tail-call-optimization]} @@ -3976,7 +3973,7 @@ language/expressions/generators 235/275 (85.45%) dflt-params-ref-self.js {unsupported: [default-parameters]} dflt-params-rest.js {unsupported: [default-parameters]} dflt-params-trailing-comma.js - eval-body-proto-realm.js {unsupported: [cross-realm]} + eval-body-proto-realm.js eval-var-scope-syntax-err.js {unsupported: [default-parameters]} generator-created-after-decl-inst.js has-instance.js @@ -5122,8 +5119,7 @@ language/expressions/subtraction 4/38 (10.53%) ~language/expressions/super -language/expressions/tagged-template 4/27 (14.81%) - cache-realm.js {unsupported: [cross-realm]} +language/expressions/tagged-template 3/27 (11.11%) call-expression-context-strict.js strict tco-call.js {unsupported: [tail-call-optimization]} tco-member.js {unsupported: [tail-call-optimization]} @@ -5285,7 +5281,7 @@ language/function-code 123/217 (56.68%) ~language/future-reserved-words -language/global-code 30/41 (73.17%) +language/global-code 29/41 (70.73%) block-decl-strict.js strict decl-lex.js decl-lex-configurable-global.js @@ -5298,9 +5294,8 @@ language/global-code 30/41 (73.17%) new.target.js {unsupported: [new.target]} new.target-arrow.js {unsupported: [new.target]} script-decl-func.js - script-decl-func-dups.js script-decl-func-err-non-configurable.js - script-decl-func-err-non-extensible.js + script-decl-func-err-non-extensible.js non-strict script-decl-lex.js script-decl-lex-deletion.js non-strict script-decl-lex-lex.js @@ -5308,7 +5303,7 @@ language/global-code 30/41 (73.17%) script-decl-lex-var.js script-decl-var.js script-decl-var-collision.js - script-decl-var-err.js + script-decl-var-err.js non-strict super-call.js {unsupported: [super]} super-call-arrow.js {unsupported: [super]} super-prop.js {unsupported: [super]} @@ -6636,9 +6631,9 @@ language/types 9/113 (7.96%) number/S8.5_A10_T2.js non-strict number/S8.5_A4_T1.js number/S8.5_A4_T2.js non-strict - reference/get-value-prop-base-primitive-realm.js {unsupported: [cross-realm]} + 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, cross-realm]} + reference/put-value-prop-base-primitive-realm.js {unsupported: [Proxy]} undefined/S8.1_A3_T1.js undefined/S8.1_A3_T2.js non-strict From 03424146dc0eb42620bb823382591fce56da143d Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Tue, 24 May 2022 10:38:22 +0200 Subject: [PATCH 6/6] Small refactor for more clarity --- .../javascript/tests/Test262SuiteTest.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java index db78f4627b..ca71c2e85a 100644 --- a/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java +++ b/testsrc/org/mozilla/javascript/tests/Test262SuiteTest.java @@ -439,16 +439,20 @@ public static void tearDownClass() { private final boolean markedAsFailing; /** @see https://github.com/tc39/test262/blob/main/INTERPRETING.md#host-defined-functions */ - public class $262 { + public static class $262 { private ScriptableObject scope; - public $262() {} + static $262 install(ScriptableObject scope) { + $262 instance = new $262(scope); - public $262(ScriptableObject scope) { - this.scope = scope; - - scope.put("$262", scope, this); + scope.put("$262", scope, instance); scope.setAttributes("$262", ScriptableObject.DONTENUM); + + return instance; + } + + $262(ScriptableObject scope) { + this.scope = scope; } @JSFunction @@ -469,7 +473,9 @@ public Object getGlobal() { @JSFunction public $262 createRealm() { - return new $262(Context.getCurrentContext().initSafeStandardObjects()); + ScriptableObject realm = Context.getCurrentContext().initSafeStandardObjects(); + + return $262.install(realm); } @JSFunction @@ -512,7 +518,7 @@ private Scriptable buildScope(Context cx) throws IOException { HARNESS_SCRIPT_CACHE.get(optLevel).get(harnessFile).exec(cx, scope); } - new $262(scope); + $262.install(scope); return scope; }