From d351cfd4451fe58357dc82ecb46ba5f0d8d9ceee Mon Sep 17 00:00:00 2001 From: Phillip Mates Date: Fri, 15 Oct 2021 20:05:22 +0200 Subject: [PATCH] Check the function proto of all wrap points for Shadow Realm (#3269) --- .../evaluate/wrapped-function-proto-from-caller-realm.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 9f509a24469..111e947b777 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,5 +35,10 @@ var other = $262.createRealm().global; var OtherShadowRealm = other.ShadowRealm; var realm = Reflect.construct(OtherShadowRealm, []); -var fn = realm.evaluate('() => {}'); + +var checkArgWrapperFn = realm.evaluate('(x) => { return Object.getPrototypeOf(x) === Function.prototype }') +assert.sameValue(checkArgWrapperFn(() => {}), true, 'callable arguments passed into WrappedFunction should be wrapped in target realm'); + +var fn = realm.evaluate('() => { return () => { return 1 } }'); assert.sameValue(Object.getPrototypeOf(fn), Function.prototype, 'WrappedFunction should be derived from the caller realm'); +assert.sameValue(Object.getPrototypeOf(fn()), Function.prototype, 'callable results from WrappedFunction should be wrapped in caller realm');