From bd65623af6ce11c11ddecec89432c47c75a2c6f6 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Tue, 20 Apr 2021 09:56:01 -0400 Subject: [PATCH] Revert "Add valid index prototype chain [[Set]] tests" This reverts commit cc18d5bb144a47994555d31e65f74e4936bfd1ee. --- .../key-is-valid-index-prototype-chain-set.js | 87 ------------------- .../key-is-valid-index-prototype-chain-set.js | 87 ------------------- 2 files changed, 174 deletions(-) delete mode 100644 test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-valid-index-prototype-chain-set.js delete mode 100644 test/built-ins/TypedArrayConstructors/internals/Set/key-is-valid-index-prototype-chain-set.js diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-valid-index-prototype-chain-set.js b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-valid-index-prototype-chain-set.js deleted file mode 100644 index 15b80e4f97..0000000000 --- a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-valid-index-prototype-chain-set.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (C) 2021 Alexey Shvayka. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-integer-indexed-exotic-objects-set-p-v-receiver -description: > - If receiver is altered, OrdinarySet result is returned for valid indices. - Value is not coerced. -info: | - [[Set]] ( P, V, Receiver ) - - [...] - 2. If Type(P) is String, then - a. Let numericIndex be ! CanonicalNumericIndexString(P). - b. If numericIndex is not undefined, then - [...] - 3. Return ? OrdinarySet(O, P, V, Receiver). -includes: [testBigIntTypedArray.js] -features: [BigInt, TypedArray, Proxy] ----*/ - -var valueOfCalls = 0; -var value = { - valueOf: function() { - ++valueOfCalls; - return 2n; - }, -}; - -testWithBigIntTypedArrayConstructors(function(TA) { - var target, receiver; - - Object.defineProperty(TA.prototype, 0, { - get: function() { throw new Test262Error("0 getter should be unreachable!"); }, - set: function(_v) { throw new Test262Error("0 setter should be unreachable!"); }, - configurable: true, - }); - - - target = new TA([0n]); - receiver = Object.create(target); - receiver[0] = value; - assert.sameValue(target[0], 0n, "target[0] should remain unchanged (receiver: empty object)"); - assert.sameValue(receiver[0], value, "receiver[0] should be updated (receiver: empty object)"); - - - var proxyTrapCalls = 0; - target = new TA([0n]); - receiver = new Proxy(Object.create(target), { - defineProperty(_target, key, desc) { - ++proxyTrapCalls; - Object.defineProperty(_target, key, desc); - return true; - }, - }); - receiver[0] = value; - assert.sameValue(target[0], 0n, "target[0] should remain unchanged (receiver: proxy of an empty object)"); - assert.sameValue(receiver[0], value, "receiver[0] should be created (receiver: proxy of an empty object)"); - assert.sameValue(proxyTrapCalls, 1, "Proxy's [[DefineOwnProperty]] exotic method should be called"); - - - target = new TA([0n]); - receiver = Object.preventExtensions(Object.create(target)); - assert.throws(TypeError, function() { "use strict"; receiver[0] = value; }, - "setting receiver[0] should throw in strict mode (receiver: non-extensible empty object)"); - assert.sameValue(target[0], 0n, "target[0] should remain unchanged (receiver: non-extensible empty object)"); - assert(!receiver.hasOwnProperty(0), "receiver[0] should not be created (receiver: non-extensible empty object)"); - - - target = new TA([0n]); - receiver = Object.setPrototypeOf([], target); - receiver[0] = value; - assert.sameValue(target[0], 0n, "target[0] should remain unchanged (receiver: regular array)"); - assert.sameValue(receiver[0], value, "receiver[0] should be created (receiver: regular array)"); - assert.sameValue(receiver.length, 1, "Array's [[DefineOwnProperty]] exotic method should be called"); - - - target = new TA([0n]); - receiver = Object.setPrototypeOf(new String(""), target); - receiver[0] = value; - assert.sameValue(target[0], 0n, "target[0] should remain unchanged (receiver: empty String object)"); - assert.sameValue(receiver[0], value, "receiver[0] should be created (receiver: empty String object)"); - - - assert(delete TA.prototype[0]); -}); - -assert.sameValue(valueOfCalls, 0, "value should not be coerced"); diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/key-is-valid-index-prototype-chain-set.js b/test/built-ins/TypedArrayConstructors/internals/Set/key-is-valid-index-prototype-chain-set.js deleted file mode 100644 index 3816549054..0000000000 --- a/test/built-ins/TypedArrayConstructors/internals/Set/key-is-valid-index-prototype-chain-set.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (C) 2021 Alexey Shvayka. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-integer-indexed-exotic-objects-set-p-v-receiver -description: > - If receiver is altered, OrdinarySet result is returned for valid indices. - Value is not coerced. -info: | - [[Set]] ( P, V, Receiver ) - - [...] - 2. If Type(P) is String, then - a. Let numericIndex be ! CanonicalNumericIndexString(P). - b. If numericIndex is not undefined, then - [...] - 3. Return ? OrdinarySet(O, P, V, Receiver). -includes: [testTypedArray.js] -features: [TypedArray, Proxy] ----*/ - -var valueOfCalls = 0; -var value = { - valueOf: function() { - ++valueOfCalls; - return 2.3; - }, -}; - -testWithTypedArrayConstructors(function(TA) { - var target, receiver; - - Object.defineProperty(TA.prototype, 0, { - get: function() { throw new Test262Error("0 getter should be unreachable!"); }, - set: function(_v) { throw new Test262Error("0 setter should be unreachable!"); }, - configurable: true, - }); - - - target = new TA([0]); - receiver = Object.create(target); - receiver[0] = value; - assert.sameValue(target[0], 0, "target[0] should remain unchanged (receiver: empty object)"); - assert.sameValue(receiver[0], value, "receiver[0] should be updated (receiver: empty object)"); - - - var proxyTrapCalls = 0; - target = new TA([0]); - receiver = new Proxy(Object.create(target), { - defineProperty(_target, key, desc) { - ++proxyTrapCalls; - Object.defineProperty(_target, key, desc); - return true; - }, - }); - receiver[0] = value; - assert.sameValue(target[0], 0, "target[0] should remain unchanged (receiver: proxy of an empty object)"); - assert.sameValue(receiver[0], value, "receiver[0] should be created (receiver: proxy of an empty object)"); - assert.sameValue(proxyTrapCalls, 1, "Proxy's [[DefineOwnProperty]] exotic method should be called"); - - - target = new TA([0]); - receiver = Object.preventExtensions(Object.create(target)); - assert.throws(TypeError, function() { "use strict"; receiver[0] = value; }, - "setting receiver[0] should throw in strict mode (receiver: non-extensible empty object)"); - assert.sameValue(target[0], 0, "target[0] should remain unchanged (receiver: non-extensible empty object)"); - assert(!receiver.hasOwnProperty(0), "receiver[0] should not be created (receiver: non-extensible empty object)"); - - - target = new TA([0]); - receiver = Object.setPrototypeOf([], target); - receiver[0] = value; - assert.sameValue(target[0], 0, "target[0] should remain unchanged (receiver: regular array)"); - assert.sameValue(receiver[0], value, "receiver[0] should be created (receiver: regular array)"); - assert.sameValue(receiver.length, 1, "Array's [[DefineOwnProperty]] exotic method should be called"); - - - target = new TA([0]); - receiver = Object.setPrototypeOf(new String(""), target); - receiver[0] = value; - assert.sameValue(target[0], 0, "target[0] should remain unchanged (receiver: empty String object)"); - assert.sameValue(receiver[0], value, "receiver[0] should be created (receiver: empty String object)"); - - - assert(delete TA.prototype[0]); -}); - -assert.sameValue(valueOfCalls, 0, "value should not be coerced");