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/defineProperty/call-parameters.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/defineProperty/call-parameters.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Proxy/defineProperty/call-parameters.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Proxy/defineProperty/call-parameters.js b/js/src/tests/test262/built-ins/Proxy/defineProperty/call-parameters.js new file mode 100644 index 0000000000..2675515d04 --- /dev/null +++ b/js/src/tests/test262/built-ins/Proxy/defineProperty/call-parameters.js @@ -0,0 +1,55 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 9.5.6 +description: > + Trap is called with handler as context and parameters are target, P, and the + descriptor object. +info: | + [[DefineOwnProperty]] (P, Desc) + + ... + 9. Let descObj be FromPropertyDescriptor(Desc). + 10. Let booleanTrapResult be ToBoolean(Call(trap, handler, «target, P, + descObj»)). + ... +features: [Proxy] +---*/ + +var _handler, _target, _prop, _desc; +var target = {}; +var descriptor = { + configurable: true, + enumerable: true, + writable: true, + value: 1 +}; +var handler = { + defineProperty: function(t, prop, desc) { + _handler = this; + _target = t; + _prop = prop; + _desc = desc; + + return true; + } +}; +var p = new Proxy(target, handler); + +Object.defineProperty(p, "attr", descriptor); + +assert.sameValue(_handler, handler); +assert.sameValue(_target, target); +assert.sameValue(_prop, "attr"); + +assert.sameValue( + Object.keys(_desc).length, 4, + "descriptor arg has the same amount of keys as given descriptor" +); + +assert(_desc.configurable); +assert(_desc.writable); +assert(_desc.enumerable); +assert.sameValue(_desc.value, 1); + +reportCompare(0, 0); |