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 --- js/src/tests/non262/Symbol/enumeration-order.js | 40 +++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 js/src/tests/non262/Symbol/enumeration-order.js (limited to 'js/src/tests/non262/Symbol/enumeration-order.js') diff --git a/js/src/tests/non262/Symbol/enumeration-order.js b/js/src/tests/non262/Symbol/enumeration-order.js new file mode 100644 index 0000000000..8bcd1f02ff --- /dev/null +++ b/js/src/tests/non262/Symbol/enumeration-order.js @@ -0,0 +1,40 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ */ + +// Symbols follow all other property keys in the result list. +var log; +function LoggingProxy() { + return new Proxy({}, { + defineProperty: (t, key, desc) => { + log.push(key); + return true; + } + }); +} + +var keys = [ + "before", + Symbol(), + "during", + Symbol.for("during"), + Symbol.iterator, + "after" +]; +var descs = {}; +for (var k of keys) + descs[k] = {configurable: true, value: 0}; + +function test(descsObj) { + log = []; + Object.defineProperties(LoggingProxy(), descs); + assertEq(log.length, keys.length); + assertDeepEq(log.map(k => typeof k), ["string", "string", "string", "symbol", "symbol", "symbol"]); + for (var key of keys) + assertEq(log.indexOf(key) !== -1, true); +} + +test(descs); +test(new Proxy(descs, {})); + +if (typeof reportCompare === "function") + reportCompare(0, 0); -- cgit v1.2.3