[[Delete]] ( P )

This commit is contained in:
Rick Waldron 2020-09-28 16:47:44 -04:00
parent 9c069a6810
commit 47be1e83e2
40 changed files with 1664 additions and 1 deletions

View File

@ -2,7 +2,8 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.slice
description: Throws a TypeError if _O_.[[ViewedArrayBuffer]] is detached on Get custom constructor.
description: >
Throws a TypeError if _O_.[[ViewedArrayBuffer]] is detached during Get custom constructor.
info: |
22.2.3.24 %TypedArray%.prototype.slice ( start, end )

View File

@ -0,0 +1,32 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Returns true when deleting any property if buffer is detached.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
...
Return ? OrdinaryDelete(O, P)
includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
var sample = new TA(1);
sample.string = "test262";
$DETACHBUFFER(sample.buffer);
assert.sameValue(delete sample.string, true, 'The value of `delete sample.string` is true');
assert.sameValue(delete sample.undef, true, 'The value of `delete sample.undef` is true');
assert.sameValue(delete sample[0], true, 'The value of `delete sample[0]` is true');
});

View File

@ -0,0 +1,28 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Calls OrdinaryDelete when key is a Symbol.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
...
Return ? OrdinaryDelete(O, P).
includes: [testTypedArray.js, detachArrayBuffer.js]
features: [Symbol, TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
let sample = new TA(1);
$DETACHBUFFER(sample.buffer);
let s = Symbol("1");
sample[s] = 1;
assert.sameValue(delete sample[s], true, 'The value of `delete sample[s]` is true');
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Returns true when deleting any property if buffer is detached
(honoring the Realm of the current execution context)
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
...
includes: [testTypedArray.js, detachArrayBuffer.js]
features: [cross-realm, TypedArray]
---*/
var other = $262.createRealm().global;
testWithTypedArrayConstructors(function(TA) {
var OtherTA = other[TA.name];
var sample = new OtherTA(1);
$DETACHBUFFER(sample.buffer);
assert.sameValue(delete sample[0], true, 'The value of `delete sample[0]` is true');
});

View File

@ -0,0 +1,31 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Returns true when deleting any property if buffer is detached.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
...
includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
var sample = new TA(1);
$DETACHBUFFER(sample.buffer);
assert.sameValue(delete sample[0], true, 'The value of `delete sample[0]` is true');
assert.sameValue(delete sample["1.1"], true, 'The value of `delete sample["1.1"]` is true');
assert.sameValue(delete sample["-0"], true, 'The value of `delete sample["-0"]` is true');
assert.sameValue(delete sample["-1"], true, 'The value of `delete sample["-1"]` is true');
assert.sameValue(delete sample["1"], true, 'The value of `delete sample["1"]` is true');
assert.sameValue(delete sample["2"], true, 'The value of `delete sample["2"]` is true');
});

View File

@ -0,0 +1,44 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return value from valid numeric index
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
flags: [noStrict]
includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
let descriptorGetterThrows = {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
};
Object.defineProperties(proto, {
["0"]: descriptorGetterThrows,
["1"]: descriptorGetterThrows,
});
let sample = new TA(2);
assert.sameValue(delete sample["0"], false, 'The value of `delete sample["0"]` is false');
assert.sameValue(delete sample[0], false, 'The value of `delete sample[0]` is false');
assert.sameValue(delete sample["1"], false, 'The value of `delete sample["1"]` is false');
assert.sameValue(delete sample[1], false, 'The value of `delete sample[1]` is false');
});

View File

@ -0,0 +1,52 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return value from valid numeric index
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
flags: [onlyStrict]
includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
let descriptorGetterThrows = {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
};
Object.defineProperties(proto, {
["0"]: descriptorGetterThrows,
["1"]: descriptorGetterThrows,
});
let sample = new TA(2);
assert.throws(TypeError, () => {
delete sample["0"];
}, '`delete sample["0"]` throws TypeError');
assert.throws(TypeError, () => {
delete sample["1"];
}, '`delete sample["1"]` throws TypeError');
assert.throws(TypeError, () => {
delete sample[0];
}, '`delete sample[0]` throws TypeError');
assert.throws(TypeError, () => {
delete sample[0];
}, '`delete sample[0]` throws TypeError');
});

View File

@ -0,0 +1,32 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return value from valid numeric index, with SharedArrayBuffer
flags: [noStrict]
includes: [testTypedArray.js]
features: [TypedArray, SharedArrayBuffer]
---*/
testWithTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
let descriptorGetterThrows = {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
};
Object.defineProperties(proto, {
["0"]: descriptorGetterThrows,
["1"]: descriptorGetterThrows,
});
let sab = new SharedArrayBuffer(TA.BYTES_PER_ELEMENT * 2);
let sample = new TA(sab);
assert.sameValue(delete sample["0"], false, 'The value of `delete sample["0"]` is false');
assert.sameValue(delete sample[0], false, 'The value of `delete sample["0"]` is false');
assert.sameValue(delete sample["1"], false, 'The value of `delete sample["1"]` is false');
assert.sameValue(delete sample[1], false, 'The value of `delete sample["1"]` is false');
});

View File

@ -0,0 +1,40 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Throws TypeError exception in strict mode.
flags: [onlyStrict]
includes: [testTypedArray.js]
features: [TypedArray, SharedArrayBuffer]
---*/
testWithTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
let descriptorGetterThrows = {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
};
Object.defineProperties(proto, {
["0"]: descriptorGetterThrows,
["1"]: descriptorGetterThrows,
});
let sab = new SharedArrayBuffer(TA.BYTES_PER_ELEMENT * 2);
let sample = new TA(sab);
assert.throws(TypeError, () => {
delete sample["0"];
});
assert.throws(TypeError, () => {
delete sample[0];
});
assert.throws(TypeError, () => {
delete sample["1"];
});
assert.throws(TypeError, () => {
delete sample[1];
});
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integerindexedelementget
description: >
"Infinity" is a canonical numeric string. Returns true when deleting any property if buffer is detached.
info: |
[[Delete]] ( P, Receiver )
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
CanonicalNumericIndexString ( argument )
...
Let n be ! ToNumber(argument).
If SameValue(! ToString(n), argument) is false, return undefined.
Return n.
includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
var sample = new TA(1);
$DETACHBUFFER(sample.buffer);
assert.sameValue(delete sample.Infinity, true, 'The value of `delete sample.Infinity` is true');
});

View File

@ -0,0 +1,67 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return true if key is not a CanonicalNumericIndex.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
flags: [noStrict]
includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
var keys = [
"1.0",
"+1",
"1000000000000000000000",
"0.0000001"
];
keys.forEach((key) => {
var sample = new TA(); // <- intentionally empty
assert.sameValue(
delete sample[key], true,
'The value of `delete sample[key]` is true'
);
TypedArray.prototype[key] = key;
assert.sameValue(
delete sample[key],
true,
'The value of `delete sample[key]` is true'
);
sample[key] = key;
assert.sameValue(
delete sample[key], true,
'The value of `delete sample[key]` is true'
);
Object.defineProperty(sample, key, {
get() { return key; }
});
assert.sameValue(
delete sample[key], false,
'The value of `delete sample[key]` is false'
);
delete TypedArray.prototype[key];
});
});

View File

@ -0,0 +1,66 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return true if key is not a CanonicalNumericIndex.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
flags: [onlyStrict]
includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
var keys = [
"1.0",
"+1",
"1000000000000000000000",
"0.0000001"
];
keys.forEach((key) => {
var sample = new TA(); // <- intentionally empty
assert.sameValue(
delete sample[key], true,
'The value of `delete sample[key]` is true'
);
TypedArray.prototype[key] = key;
assert.sameValue(
delete sample[key],
true,
'The value of `delete sample[key]` is true'
);
sample[key] = key;
assert.sameValue(
delete sample[key], true,
'The value of `delete sample[key]` is true'
);
Object.defineProperty(sample, key, {
get() { return key; }
});
assert.throws(TypeError, () => {
delete sample[key];
}, '`delete sample[key]` throws TypeError');
delete TypedArray.prototype[key];
});
});

View File

@ -0,0 +1,44 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return true if key is a CanonicalNumericIndex and IsValidIntegerIndex(O, numericIndex) is false.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
IntegerIndexedElementGet ( O, index )
...
If ! IsValidIntegerIndex(O, index) is false, return undefined.
...
flags: [noStrict]
includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
Object.defineProperty(proto, "-0", {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
});
let sample = new TA(1);
assert.sameValue(delete sample["-0"], true, 'The value of `delete sample["-0"]` is true');
assert.sameValue(delete sample[-0], false, 'The value of `delete sample[-0]` is false');
});

View File

@ -0,0 +1,46 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return true if key is a CanonicalNumericIndex and IsValidIntegerIndex(O, numericIndex) is false.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
IntegerIndexedElementGet ( O, index )
...
If ! IsValidIntegerIndex(O, index) is false, return undefined.
...
flags: [onlyStrict]
includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
Object.defineProperty(proto, "-0", {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
});
let sample = new TA(1);
assert.sameValue(delete sample["-0"], true, 'The value of `delete sample["-0"]` is true');
assert.throws(TypeError, () => {
delete sample[-0];
}, '`delete sample[-0]` throws TypeError');
});

View File

@ -0,0 +1,38 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Use OrginaryDelete if key is not a CanonicalNumericIndex
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
let sample = new TA(1);
Object.defineProperty(sample, "foo", {
get() {
throw new Test262Error();
}
});
assert.throws(Test262Error, () => {
sample.foo;
}, '`sample.foo` throws Test262Error');
});

View File

@ -0,0 +1,44 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Use OrginaryDelete if key is not a CanonicalNumericIndex
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
flags: [noStrict]
includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
TypedArray.prototype.baz = "baz";
let sample = new TA(1);
assert.sameValue(
delete sample.foo, true,
'The value of `delete sample.foo` is true'
);
sample.foo = "foo";
assert.sameValue(delete sample.foo, true, 'The value of `delete sample.foo` is true');
Object.defineProperty(sample, "bar", {
get() { return "bar"; }
});
assert.sameValue(delete sample.bar, false, 'The value of `delete sample.bar` is false');
assert.sameValue(delete sample.baz, true, 'The value of `delete sample.baz` is true');
});

View File

@ -0,0 +1,47 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Use OrginaryDelete if key is not a CanonicalNumericIndex
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
flags: [onlyStrict]
includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
TypedArray.prototype.baz = "baz";
let sample = new TA(1);
assert.sameValue(
delete sample.foo, true,
'The value of `delete sample.foo` is true'
);
sample.foo = "foo";
assert.sameValue(delete sample.foo, true, 'The value of `delete sample.foo` is true');
Object.defineProperty(sample, "bar", {
get() { return "bar"; }
});
assert.throws(TypeError, () => {
delete sample.bar;
}, '`delete sample.bar` throws TypeError');
assert.sameValue(delete sample.baz, true, 'The value of `delete sample.baz` is true');
});

View File

@ -0,0 +1,47 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return true if IsValidIntegerIndex(O, numericIndex) is false.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
flags: [noStrict]
includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
let descriptorGetterThrows = {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
};
Object.defineProperties(proto, {
["-1"]: descriptorGetterThrows,
["1"]: descriptorGetterThrows,
});
let sample = new TA(1);
assert.sameValue(delete sample["-1"], true, 'The value of `delete sample["-1"]` is true');
assert.sameValue(delete sample[-1], true, 'The value of `delete sample[-1]` is true');
assert.sameValue(delete sample["0"], false, 'The value of `delete sample["0"]` is false');
assert.sameValue(delete sample[0], false, 'The value of `delete sample[0]` is false');
assert.sameValue(delete sample["1"], true, 'The value of `delete sample["1"]` is true');
assert.sameValue(delete sample[1], true, 'The value of `delete sample[1]` is true');
});

View File

@ -0,0 +1,54 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return true if IsValidIntegerIndex(O, numericIndex) is false.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
flags: [onlyStrict]
includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
let descriptorGetterThrows = {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
};
Object.defineProperties(proto, {
["-1"]: descriptorGetterThrows,
["1"]: descriptorGetterThrows,
});
let sample = new TA(1);
assert.sameValue(delete sample["-1"], true, 'The value of `delete sample["-1"]` is true');
assert.sameValue(delete sample[-1], true, 'The value of `delete sample[-1]` is true');
assert.throws(TypeError, () => {
delete sample["0"];
}, '`delete sample["0"]` throws TypeError');
assert.throws(TypeError, () => {
delete sample[0];
}, '`delete sample[0]` throws TypeError');
assert.sameValue(delete sample["1"], true, 'The value of `delete sample["1"]` is true');
assert.sameValue(delete sample[1], true, 'The value of `delete sample[1]` is true');
});

View File

@ -0,0 +1,31 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Use OrginaryDelete if key is a Symbol
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
...
Return ? OrdinaryDelete(O, P).
includes: [testBigIntTypedArray.js]
features: [BigInt, Symbol, TypedArray]
---*/
testWithBigIntTypedArrayConstructors(function(TA) {
let sample = new TA(1);
let s = Symbol("1");
assert.sameValue(delete sample[s], true, 'The value of `delete sample[s]` is true');
assert.sameValue(Reflect.has(sample, s), false, 'Reflect.has(sample, s) must return false');
sample[s] = "";
assert.sameValue(delete sample[s], true, 'The value of `delete sample[s]` is true');
assert.sameValue(Reflect.has(sample, s), false, 'Reflect.has(sample, s) must return false');
});

View File

@ -0,0 +1,34 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Returns true when deleting any property if buffer is detached.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
...
Return ? OrdinaryDelete(O, P)
includes: [testTypedArray.js, detachArrayBuffer.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
let sample = new TA(1);
let key = "key";
sample.string = key;
$DETACHBUFFER(sample.buffer);
assert.sameValue(delete sample.string, true, 'The value of `delete sample.string` is true');
assert.sameValue(delete sample.undef, true, 'The value of `delete sample.undef` is true');
assert.sameValue(delete sample[key], true, 'The value of `delete sample.string` is true');
assert.sameValue(delete sample["undef"], true, 'The value of `delete sample.undef` is true');
});

View File

@ -0,0 +1,28 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Calls OrdinaryDelete when key is a Symbol.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
...
Return ? OrdinaryDelete(O, P).
includes: [testTypedArray.js, detachArrayBuffer.js]
features: [Symbol, TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
let sample = new TA(1);
$DETACHBUFFER(sample.buffer);
let s = Symbol("1");
sample[s] = 1;
assert.sameValue(delete sample[s], true, 'The value of `delete sample[s]` is true');
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Returns true when deleting any property if buffer is detached
(honoring the Realm of the current execution context)
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
...
includes: [testTypedArray.js, detachArrayBuffer.js]
features: [cross-realm, TypedArray]
---*/
var other = $262.createRealm().global;
testWithTypedArrayConstructors(function(TA) {
var OtherTA = other[TA.name];
var sample = new OtherTA(1);
$DETACHBUFFER(sample.buffer);
assert.sameValue(delete sample[0], true, 'The value of `delete sample[0]` is true');
});

View File

@ -0,0 +1,31 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Returns true when deleting any property if buffer is detached.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
...
includes: [testTypedArray.js, detachArrayBuffer.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
var sample = new TA(1);
$DETACHBUFFER(sample.buffer);
assert.sameValue(delete sample[0], true, 'The value of `delete sample[0]` is true');
assert.sameValue(delete sample["1.1"], true, 'The value of `delete sample["1.1"]` is true');
assert.sameValue(delete sample["-0"], true, 'The value of `delete sample["-0"]` is true');
assert.sameValue(delete sample["-1"], true, 'The value of `delete sample["-1"]` is true');
assert.sameValue(delete sample["1"], true, 'The value of `delete sample["1"]` is true');
assert.sameValue(delete sample["2"], true, 'The value of `delete sample["2"]` is true');
});

View File

@ -0,0 +1,44 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return value from valid numeric index
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
flags: [noStrict]
includes: [testTypedArray.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
let descriptorGetterThrows = {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
};
Object.defineProperties(proto, {
["0"]: descriptorGetterThrows,
["1"]: descriptorGetterThrows,
});
let sample = new TA(2);
assert.sameValue(delete sample["0"], false, 'The value of `delete sample["0"]` is false');
assert.sameValue(delete sample[0], false, 'The value of `delete sample[0]` is false');
assert.sameValue(delete sample["1"], false, 'The value of `delete sample["1"]` is false');
assert.sameValue(delete sample[1], false, 'The value of `delete sample[1]` is false');
});

View File

@ -0,0 +1,52 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return value from valid numeric index
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
flags: [onlyStrict]
includes: [testTypedArray.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
let descriptorGetterThrows = {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
};
Object.defineProperties(proto, {
["0"]: descriptorGetterThrows,
["1"]: descriptorGetterThrows,
});
let sample = new TA(2);
assert.throws(TypeError, () => {
delete sample["0"];
}, '`delete sample["0"]` throws TypeError');
assert.throws(TypeError, () => {
delete sample["1"];
}, '`delete sample["1"]` throws TypeError');
assert.throws(TypeError, () => {
delete sample[0];
}, '`delete sample[0]` throws TypeError');
assert.throws(TypeError, () => {
delete sample[0];
}, '`delete sample[0]` throws TypeError');
});

View File

@ -0,0 +1,32 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return value from valid numeric index, with SharedArrayBuffer
flags: [noStrict]
includes: [testTypedArray.js]
features: [TypedArray, SharedArrayBuffer]
---*/
testWithTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
let descriptorGetterThrows = {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
};
Object.defineProperties(proto, {
["0"]: descriptorGetterThrows,
["1"]: descriptorGetterThrows,
});
let sab = new SharedArrayBuffer(TA.BYTES_PER_ELEMENT * 2);
let sample = new TA(sab);
assert.sameValue(delete sample["0"], false, 'The value of `delete sample["0"]` is false');
assert.sameValue(delete sample[0], false, 'The value of `delete sample["0"]` is false');
assert.sameValue(delete sample["1"], false, 'The value of `delete sample["1"]` is false');
assert.sameValue(delete sample[1], false, 'The value of `delete sample["1"]` is false');
});

View File

@ -0,0 +1,40 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Throws TypeError exception in strict mode.
flags: [onlyStrict]
includes: [testTypedArray.js]
features: [TypedArray, SharedArrayBuffer]
---*/
testWithTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
let descriptorGetterThrows = {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
};
Object.defineProperties(proto, {
["0"]: descriptorGetterThrows,
["1"]: descriptorGetterThrows,
});
let sab = new SharedArrayBuffer(TA.BYTES_PER_ELEMENT * 2);
let sample = new TA(sab);
assert.throws(TypeError, () => {
delete sample["0"];
});
assert.throws(TypeError, () => {
delete sample[0];
});
assert.throws(TypeError, () => {
delete sample["1"];
});
assert.throws(TypeError, () => {
delete sample[1];
});
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integerindexedelementget
description: >
"Infinity" is a canonical numeric string. Returns true when deleting any property if buffer is detached.
info: |
[[Delete]] ( P, Receiver )
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
CanonicalNumericIndexString ( argument )
...
Let n be ! ToNumber(argument).
If SameValue(! ToString(n), argument) is false, return undefined.
Return n.
includes: [testTypedArray.js, detachArrayBuffer.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
var sample = new TA(1);
$DETACHBUFFER(sample.buffer);
assert.sameValue(delete sample.Infinity, true, 'The value of `delete sample.Infinity` is true');
});

View File

@ -0,0 +1,67 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return true if key is not a CanonicalNumericIndex.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
flags: [noStrict]
includes: [testTypedArray.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
var keys = [
"1.0",
"+1",
"1000000000000000000000",
"0.0000001"
];
keys.forEach((key) => {
var sample = new TA(); // <- intentionally empty
assert.sameValue(
delete sample[key], true,
'The value of `delete sample[key]` is true'
);
TypedArray.prototype[key] = key;
assert.sameValue(
delete sample[key],
true,
'The value of `delete sample[key]` is true'
);
sample[key] = key;
assert.sameValue(
delete sample[key], true,
'The value of `delete sample[key]` is true'
);
Object.defineProperty(sample, key, {
get() { return key; }
});
assert.sameValue(
delete sample[key], false,
'The value of `delete sample[key]` is false'
);
delete TypedArray.prototype[key];
});
});

View File

@ -0,0 +1,66 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return true if key is not a CanonicalNumericIndex.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
flags: [onlyStrict]
includes: [testTypedArray.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
var keys = [
"1.0",
"+1",
"1000000000000000000000",
"0.0000001"
];
keys.forEach((key) => {
var sample = new TA(); // <- intentionally empty
assert.sameValue(
delete sample[key], true,
'The value of `delete sample[key]` is true'
);
TypedArray.prototype[key] = key;
assert.sameValue(
delete sample[key],
true,
'The value of `delete sample[key]` is true'
);
sample[key] = key;
assert.sameValue(
delete sample[key], true,
'The value of `delete sample[key]` is true'
);
Object.defineProperty(sample, key, {
get() { return key; }
});
assert.throws(TypeError, () => {
delete sample[key];
}, '`delete sample[key]` throws TypeError');
delete TypedArray.prototype[key];
});
});

View File

@ -0,0 +1,42 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return true if key is a CanonicalNumericIndex and IsValidIntegerIndex(O, numericIndex) is false.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
IntegerIndexedElementGet ( O, index )
...
5. If IsInteger(index) is false, return undefined.
...
includes: [testTypedArray.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
Object.defineProperty(proto, "1.1", {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
});
let sample = new TA(1);
assert.sameValue(delete sample["1.1"], true, 'The value of `delete sample["1.1"]` is true');
assert.sameValue(delete sample[1.1], true, 'The value of `delete sample[1.1]` is true');
});

View File

@ -0,0 +1,44 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return true if key is a CanonicalNumericIndex and IsValidIntegerIndex(O, numericIndex) is false.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
IntegerIndexedElementGet ( O, index )
...
If ! IsValidIntegerIndex(O, index) is false, return undefined.
...
flags: [noStrict]
includes: [testTypedArray.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
Object.defineProperty(proto, "-0", {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
});
let sample = new TA(1);
assert.sameValue(delete sample["-0"], true, 'The value of `delete sample["-0"]` is true');
assert.sameValue(delete sample[-0], false, 'The value of `delete sample[-0]` is false');
});

View File

@ -0,0 +1,46 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return true if key is a CanonicalNumericIndex and IsValidIntegerIndex(O, numericIndex) is false.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
IntegerIndexedElementGet ( O, index )
...
If ! IsValidIntegerIndex(O, index) is false, return undefined.
...
flags: [onlyStrict]
includes: [testTypedArray.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
Object.defineProperty(proto, "-0", {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
});
let sample = new TA(1);
assert.sameValue(delete sample["-0"], true, 'The value of `delete sample["-0"]` is true');
assert.throws(TypeError, () => {
delete sample[-0];
}, '`delete sample[-0]` throws TypeError');
});

View File

@ -0,0 +1,38 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Use OrginaryDelete if key is not a CanonicalNumericIndex
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
includes: [testTypedArray.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
let sample = new TA(1);
Object.defineProperty(sample, "foo", {
get() {
throw new Test262Error();
}
});
assert.throws(Test262Error, () => {
sample.foo;
}, '`sample.foo` throws Test262Error');
});

View File

@ -0,0 +1,44 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Use OrginaryDelete if key is not a CanonicalNumericIndex
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
flags: [noStrict]
includes: [testTypedArray.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
TypedArray.prototype.baz = "baz";
let sample = new TA(1);
assert.sameValue(
delete sample.foo, true,
'The value of `delete sample.foo` is true'
);
sample.foo = "foo";
assert.sameValue(delete sample.foo, true, 'The value of `delete sample.foo` is true');
Object.defineProperty(sample, "bar", {
get() { return "bar"; }
});
assert.sameValue(delete sample.bar, false, 'The value of `delete sample.bar` is false');
assert.sameValue(delete sample.baz, true, 'The value of `delete sample.baz` is true');
});

View File

@ -0,0 +1,47 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Use OrginaryDelete if key is not a CanonicalNumericIndex
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
flags: [onlyStrict]
includes: [testTypedArray.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
TypedArray.prototype.baz = "baz";
let sample = new TA(1);
assert.sameValue(
delete sample.foo, true,
'The value of `delete sample.foo` is true'
);
sample.foo = "foo";
assert.sameValue(delete sample.foo, true, 'The value of `delete sample.foo` is true');
Object.defineProperty(sample, "bar", {
get() { return "bar"; }
});
assert.throws(TypeError, () => {
delete sample.bar;
}, '`delete sample.bar` throws TypeError');
assert.sameValue(delete sample.baz, true, 'The value of `delete sample.baz` is true');
});

View File

@ -0,0 +1,47 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return true if IsValidIntegerIndex(O, numericIndex) is false.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
flags: [noStrict]
includes: [testTypedArray.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
let descriptorGetterThrows = {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
};
Object.defineProperties(proto, {
["-1"]: descriptorGetterThrows,
["1"]: descriptorGetterThrows,
});
let sample = new TA(1);
assert.sameValue(delete sample["-1"], true, 'The value of `delete sample["-1"]` is true');
assert.sameValue(delete sample[-1], true, 'The value of `delete sample[-1]` is true');
assert.sameValue(delete sample["0"], false, 'The value of `delete sample["0"]` is false');
assert.sameValue(delete sample[0], false, 'The value of `delete sample[0]` is false');
assert.sameValue(delete sample["1"], true, 'The value of `delete sample["1"]` is true');
assert.sameValue(delete sample[1], true, 'The value of `delete sample[1]` is true');
});

View File

@ -0,0 +1,54 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Return true if IsValidIntegerIndex(O, numericIndex) is false.
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
Let numericIndex be ! CanonicalNumericIndexString(P).
If numericIndex is not undefined, then
If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, return true.
If ! IsValidIntegerIndex(O, numericIndex) is false, return true.
Return false.
...
Return ? OrdinaryDelete(O, P).
flags: [onlyStrict]
includes: [testTypedArray.js]
features: [TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
let proto = TypedArray.prototype;
let descriptorGetterThrows = {
configurable: true,
get() {
throw new Test262Error("OrdinaryGet was called!");
}
};
Object.defineProperties(proto, {
["-1"]: descriptorGetterThrows,
["1"]: descriptorGetterThrows,
});
let sample = new TA(1);
assert.sameValue(delete sample["-1"], true, 'The value of `delete sample["-1"]` is true');
assert.sameValue(delete sample[-1], true, 'The value of `delete sample[-1]` is true');
assert.throws(TypeError, () => {
delete sample["0"];
}, '`delete sample["0"]` throws TypeError');
assert.throws(TypeError, () => {
delete sample[0];
}, '`delete sample[0]` throws TypeError');
assert.sameValue(delete sample["1"], true, 'The value of `delete sample["1"]` is true');
assert.sameValue(delete sample[1], true, 'The value of `delete sample[1]` is true');
});

View File

@ -0,0 +1,31 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-delete-p
description: >
Use OrginaryDelete if key is a Symbol
info: |
[[Delete]] (P)
...
Assert: IsPropertyKey(P) is true.
Assert: O is an Integer-Indexed exotic object.
If Type(P) is String, then
...
Return ? OrdinaryDelete(O, P).
includes: [testTypedArray.js]
features: [Symbol, Symbol, TypedArray]
---*/
testWithTypedArrayConstructors(function(TA) {
let sample = new TA(1);
let s = Symbol("1");
assert.sameValue(delete sample[s], true, 'The value of `delete sample[s]` is true');
assert.sameValue(Reflect.has(sample, s), false, 'Reflect.has(sample, s) must return false');
sample[s] = "";
assert.sameValue(delete sample[s], true, 'The value of `delete sample[s]` is true');
assert.sameValue(Reflect.has(sample, s), false, 'Reflect.has(sample, s) must return false');
});