From d52b510a33b526d714089937ff7d1d5794511fd4 Mon Sep 17 00:00:00 2001 From: legendecas Date: Thu, 18 Nov 2021 05:55:09 +0800 Subject: [PATCH] Fix unexpected pass on ShadowRealm wrapped function (#3312) --- ...-function-throws-typeerror-on-non-primitive-arguments.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/built-ins/ShadowRealm/prototype/evaluate/wrapped-function-throws-typeerror-on-non-primitive-arguments.js b/test/built-ins/ShadowRealm/prototype/evaluate/wrapped-function-throws-typeerror-on-non-primitive-arguments.js index 4b82ede589..67fa230752 100644 --- a/test/built-ins/ShadowRealm/prototype/evaluate/wrapped-function-throws-typeerror-on-non-primitive-arguments.js +++ b/test/built-ins/ShadowRealm/prototype/evaluate/wrapped-function-throws-typeerror-on-non-primitive-arguments.js @@ -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, {