From 7d998a098e5420cb4b6ee4a05eb8c386d750c596 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Mon, 19 Oct 2020 17:29:14 -0400 Subject: [PATCH] Align detached buffer semantics with web reality, R2 --- .../BigInt/detached-buffer-realm.js | 2 +- .../key-is-numericindex-desc-configurable.js | 14 +++++++++----- .../BigInt/key-is-numericindex.js | 10 ++++++---- .../key-is-numericindex-desc-configurable.js | 10 +++++++--- .../DefineOwnProperty/key-is-numericindex.js | 15 ++++++++++----- 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js index 8bcfc04409..893787aaed 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js @@ -22,7 +22,7 @@ info: | ... Let buffer be O.[[ViewedArrayBuffer]]. If IsDetachedBuffer(buffer) is true, return false. - ... + includes: [testBigIntTypedArray.js, detachArrayBuffer.js] features: [align-detached-buffer-semantics-with-web-reality, BigInt, cross-realm, Reflect, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js index 59b5abd434..dc16883a88 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js @@ -3,7 +3,7 @@ /*--- esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc description: > - Returns false if key is a numeric index and Desc.[[Configurable]] is true + Returns true if key is a numeric index and Desc.[[Configurable]] is true info: | 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) ... @@ -11,8 +11,12 @@ info: | a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then ... - viii. If Desc has a [[Configurable]] field and if Desc.[[Configurable]] is - true, return false. + If Desc has a [[Configurable]] field and if Desc.[[Configurable]] is false, return false. + ... + + If Desc has a [[Value]] field, then + Let value be Desc.[[Value]]. + Return ? IntegerIndexedElementSet(O, numericIndex, value). ... includes: [testBigIntTypedArray.js] features: [BigInt, Reflect, TypedArray] @@ -28,8 +32,8 @@ testWithBigIntTypedArrayConstructors(function(TA) { enumerable: true, writable: true }), - false, + true, "defineProperty's result" ); - assert.sameValue(sample[0], 0n, "side effect check"); + assert.sameValue(sample[0], 42n, "side effect check"); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-numericindex.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-numericindex.js index 8f846f0e50..fa3b7dc841 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-numericindex.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-numericindex.js @@ -11,8 +11,10 @@ info: | a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then ... - v. If Desc has a [[Writable]] field and if Desc.[[Writable]] is false, - return false. + If Desc has a [[Value]] field, then + Let value be Desc.[[Value]]. + Return ? IntegerIndexedElementSet(O, numericIndex, value). + ... includes: [testBigIntTypedArray.js, propertyHelper.js] features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, TypedArray] @@ -30,7 +32,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(sample[0], 8n, 'The value of sample[0] is 8n'); var desc = Object.getOwnPropertyDescriptor(sample, '0'); assert.sameValue(desc.value, 8n, 'The value of desc.value is 8n'); + assert.sameValue(desc.configurable, true, 'The value of desc.configurable is true'); + assert.sameValue(desc.enumerable, true, 'The value of desc.enumerable is true'); assert.sameValue(desc.writable, true, 'The value of desc.writable is true'); - verifyEnumerable(sample, '0'); - verifyNotConfigurable(sample, '0'); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js index 133f3343d5..f2826e594a 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js @@ -3,7 +3,7 @@ /*--- esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc description: > - Returns false if key is a numeric index and Desc.[[Configurable]] is true + Returns true if key is a numeric index and Desc.[[Configurable]] is true info: | 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) ... @@ -11,8 +11,12 @@ info: | a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then ... - viii. If Desc has a [[Configurable]] field and if Desc.[[Configurable]] is + If Desc has a [[Configurable]] field and if Desc.[[Configurable]] is true, return false. + ... + If Desc has a [[Value]] field, then + Let value be Desc.[[Value]]. + Return ? IntegerIndexedElementSet(O, numericIndex, value). ... includes: [testTypedArray.js] features: [Reflect, TypedArray] @@ -28,7 +32,7 @@ testWithTypedArrayConstructors(function(TA) { enumerable: true, writable: true }), - false, + true, "defineProperty's result" ); assert.sameValue(sample[0], 0, "side effect check"); diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-numericindex.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-numericindex.js index d815738b6e..d470c24baa 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-numericindex.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-numericindex.js @@ -10,10 +10,15 @@ info: | 3. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - ... - x. If Desc has a [[Writable]] field and if Desc.[[Writable]] is false, - return false. - ... + If ! IsValidIntegerIndex(O, numericIndex) is false, return false. + If IsAccessorDescriptor(Desc) is true, return false. + If Desc has a [[Configurable]] field and if Desc.[[Configurable]] is false, return false. + If Desc has an [[Enumerable]] field and if Desc.[[Enumerable]] is false, return false. + If Desc has a [[Writable]] field and if Desc.[[Writable]] is false, return false. + If Desc has a [[Value]] field, then + Let value be Desc.[[Value]]. + Return ? IntegerIndexedElementSet(O, numericIndex, value). + includes: [testTypedArray.js, propertyHelper.js] features: [Reflect, TypedArray] ---*/ @@ -24,7 +29,7 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue( Reflect.defineProperty(sample, "0", { value: 8, - configurable: false, + configurable: true, enumerable: true, writable: true }),