Fix unexpected pass on ShadowRealm wrapped function (#3312)

This commit is contained in:
legendecas 2021-11-18 05:55:09 +08:00 committed by GitHub
parent cba42e88c7
commit d52b510a33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -16,6 +16,12 @@ assert.sameValue(
const r = new ShadowRealm();
const wrappedFunction = r.evaluate('() => {}');
assert.sameValue(
typeof wrappedFunction,
'function',
'This test must fail if wrappedFunction is not a function'
);
assert.throws(TypeError, () => wrappedFunction(1, globalThis), 'globalThis');
assert.throws(TypeError, () => wrappedFunction(1, []), 'array literal');
assert.throws(TypeError, () => wrappedFunction(1, {