From 516623f43a8cd9938bb7d6f2cf0a9c3fe319ea94 Mon Sep 17 00:00:00 2001 From: legendecas Date: Mon, 1 Nov 2021 16:09:36 +0800 Subject: [PATCH] Add coverage on mixing realm shadowrealm prototype calls --- .../evaluate/wrapped-function-proto-from-caller-realm.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/built-ins/ShadowRealm/prototype/evaluate/wrapped-function-proto-from-caller-realm.js b/test/built-ins/ShadowRealm/prototype/evaluate/wrapped-function-proto-from-caller-realm.js index fe0ac03c16..8796b335d4 100644 --- a/test/built-ins/ShadowRealm/prototype/evaluate/wrapped-function-proto-from-caller-realm.js +++ b/test/built-ins/ShadowRealm/prototype/evaluate/wrapped-function-proto-from-caller-realm.js @@ -35,6 +35,10 @@ var other = $262.createRealm().global; var OtherShadowRealm = other.ShadowRealm; var OtherFunctionPrototype = other.Function.prototype; +var yetAnother = $262.createRealm().global; +var YetAnotherShadowRealm = yetAnother.ShadowRealm; +var YetAnotherFunctionPrototype = yetAnother.Function.prototype; + var realm = Reflect.construct(OtherShadowRealm, []); var checkArgWrapperFn = realm.evaluate('(x) => { return Object.getPrototypeOf(x) === Function.prototype }') @@ -43,3 +47,7 @@ assert.sameValue(checkArgWrapperFn(() => {}), true, 'callable arguments passed i var fn = realm.evaluate('() => { return () => { return 1 } }'); assert.sameValue(Object.getPrototypeOf(fn), OtherFunctionPrototype, 'WrappedFunction should be derived from the caller realm'); assert.sameValue(Object.getPrototypeOf(fn()), OtherFunctionPrototype, 'callable results from WrappedFunction should be wrapped in caller realm'); + +var fn = YetAnotherShadowRealm.prototype.evaluate.call(realm, '() => { return () => { return 1 } }'); +assert.sameValue(Object.getPrototypeOf(fn), YetAnotherFunctionPrototype, 'WrappedFunction should be derived from the caller realm'); +assert.sameValue(Object.getPrototypeOf(fn()), YetAnotherFunctionPrototype, 'callable results from WrappedFunction should be wrapped in caller realm');