Check the function proto of all wrap points for Shadow Realm (#3269)

This commit is contained in:
Phillip Mates 2021-10-15 20:05:22 +02:00 committed by GitHub
parent 8d420cef41
commit d351cfd445
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -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');