From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../WrappedFunction/name-throws-typeerror.js | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 js/src/tests/test262/built-ins/ShadowRealm/WrappedFunction/name-throws-typeerror.js (limited to 'js/src/tests/test262/built-ins/ShadowRealm/WrappedFunction/name-throws-typeerror.js') diff --git a/js/src/tests/test262/built-ins/ShadowRealm/WrappedFunction/name-throws-typeerror.js b/js/src/tests/test262/built-ins/ShadowRealm/WrappedFunction/name-throws-typeerror.js new file mode 100644 index 0000000000..b12e345513 --- /dev/null +++ b/js/src/tests/test262/built-ins/ShadowRealm/WrappedFunction/name-throws-typeerror.js @@ -0,0 +1,39 @@ +// |reftest| shell-option(--enable-shadow-realms) skip-if(!xulRuntime.shell) -- requires shell-options +// Copyright (C) 2022 Chengzhong Wu. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-wrappedfunctioncreate +description: > + WrappedFunctionCreate throws a TypeError from its caller realm. +info: | + WrappedFunctionCreate ( callerRealm: a Realm Record, Target: a function object, ) + + ... + 7. Let result be CopyNameAndLength(wrapped, Target). + 8. If result is an Abrupt Completion, throw a TypeError exception. + ... + +features: [ShadowRealm] +---*/ + +assert.sameValue( + typeof ShadowRealm.prototype.evaluate, + 'function', + 'This test must fail if ShadowRealm.prototype.evaluate is not a function' +); + +const r = new ShadowRealm(); + +assert.throws(TypeError, () => r.evaluate(` +function fn() {} +Object.defineProperty(fn, 'name', { + get: () => { + throw new Error('blah'); + }, + enumerable: false, + configurable: true, +}); +fn; +`), 'expect a TypeError on name getter throwing'); + +reportCompare(0, 0); -- cgit v1.2.3