From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- ...-target-not-extensible-not-same-proto-throws.js | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Proxy/getPrototypeOf/instanceof-target-not-extensible-not-same-proto-throws.js (limited to 'js/src/tests/test262/built-ins/Proxy/getPrototypeOf/instanceof-target-not-extensible-not-same-proto-throws.js') diff --git a/js/src/tests/test262/built-ins/Proxy/getPrototypeOf/instanceof-target-not-extensible-not-same-proto-throws.js b/js/src/tests/test262/built-ins/Proxy/getPrototypeOf/instanceof-target-not-extensible-not-same-proto-throws.js new file mode 100644 index 0000000000..7084f5e92a --- /dev/null +++ b/js/src/tests/test262/built-ins/Proxy/getPrototypeOf/instanceof-target-not-extensible-not-same-proto-throws.js @@ -0,0 +1,49 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-proxy-object-internal-methods-and-internal-slots-getprototypeof +description: > + instanceof operator observes the TypeError from a custom trap result that would return true if + the target were extensible. +info: | + Runtime Semantics: InstanceofOperator ( V, target ) + + 5. Return ? OrdinaryHasInstance(target, V). + + OrdinaryHasInstance ( C, O ) + + 4. Let P be ? Get(C, "prototype"). + ... + 6. Repeat, + a. Set O to ? O.[[GetPrototypeOf]](). + b. If O is null, return false. + c. If SameValue(P, O) is true, return true. + + [[GetPrototypeOf]] ( ) + + 7. Let handlerProto be ? Call(trap, handler, « target »). + 8. If Type(handlerProto) is neither Object nor Null, throw a TypeError exception. + 9. Let extensibleTarget be ? IsExtensible(target). + 10. If extensibleTarget is true, return handlerProto. + 11. Let targetProto be ? target.[[GetPrototypeOf]](). + 12. If SameValue(handlerProto, targetProto) is false, throw a TypeError exception. +features: [Proxy] +---*/ + +function Custom() {} + +var target = {}; + +var p = new Proxy(target, { + getPrototypeOf() { + return Custom.prototype; + } +}); + +Object.preventExtensions(target); + +assert.throws(TypeError, () => { + p instanceof Custom +}); + +reportCompare(0, 0); -- cgit v1.2.3