diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/Proxy/set/call-parameters-prototype-dunder-proto.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Proxy/set/call-parameters-prototype-dunder-proto.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Proxy/set/call-parameters-prototype-dunder-proto.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Proxy/set/call-parameters-prototype-dunder-proto.js b/js/src/tests/test262/built-ins/Proxy/set/call-parameters-prototype-dunder-proto.js new file mode 100644 index 0000000000..8b4ec874d2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Proxy/set/call-parameters-prototype-dunder-proto.js @@ -0,0 +1,58 @@ +// Copyright (C) 2019 Alexey Shvayka. 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-set-p-v-receiver +description: > + Ordinary [[Set]] forwards call to Proxy "set" trap with correct arguments. + Property name is "__proto__". +info: | + OrdinarySet ( O, P, V, Receiver ) + + ... + 3. Return OrdinarySetWithOwnDescriptor(O, P, V, Receiver, ownDesc). + + OrdinarySetWithOwnDescriptor ( O, P, V, Receiver, ownDesc ) + + ... + 2. If ownDesc is undefined, then + a. Let parent be ? O.[[GetPrototypeOf]](). + b. If parent is not null, then + i. Return ? parent.[[Set]](P, V, Receiver). + + [[Set]] ( P, V, Receiver ) + + ... + 8. Let booleanTrapResult be ! ToBoolean(? Call(trap, handler, « target, P, V, Receiver »)). + ... + 12. Return true. +includes: [proxyTrapsHelper.js] +features: [Proxy, __proto__] +---*/ + +var _handler, _target, _prop, _value, _receiver; +var target = {}; +var handler = allowProxyTraps({ + set: function(target, prop, value, receiver) { + _handler = this; + _target = target; + _prop = prop; + _value = value; + _receiver = receiver; + return true; + }, +}); + +var proxy = new Proxy(target, handler); +var receiver = Object.create(proxy); +var prop = '__proto__'; +var value = {}; + +receiver[prop] = value; + +assert.sameValue(_handler, handler, 'handler object is the trap context'); +assert.sameValue(_target, target, 'first argument is the target object'); +assert.sameValue(_prop, prop, 'second argument is the property name'); +assert.sameValue(_value, value, 'third argument is the new value'); +assert.sameValue(_receiver, receiver, 'fourth argument is the receiver object'); + +reportCompare(0, 0); |