Skip to content
Snippets Groups Projects
Commit 7f96cb10 authored by André Bargull's avatar André Bargull Committed by Rick Waldron
Browse files

Add tests for accessing Infinity on detached typed arrays

parent 6b8bd307
No related branches found
No related tags found
No related merge requests found
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-integerindexedelementget
info: >
"Infinity" is a canonical numeric string, test with access on detached buffer.
description: |
9.4.5.4 [[Get]] ( P, Receiver )
...
2. If Type(P) is String, then
a. Let numericIndex be ! CanonicalNumericIndexString(P).
b. If numericIndex is not undefined, then
i. Return ? IntegerIndexedElementGet(O, numericIndex).
...
7.1.16 CanonicalNumericIndexString ( argument )
...
3. Let n be ! ToNumber(argument).
4. If SameValue(! ToString(n), argument) is false, return undefined.
5. Return n.
9.4.5.8 IntegerIndexedElementGet ( O, index )
...
3. Let buffer be O.[[ViewedArrayBuffer]].
4. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
...
includes: [testTypedArray.js, detachArrayBuffer.js]
---*/
testWithTypedArrayConstructors(function(TA) {
var sample = new TA(0);
$DETACHBUFFER(sample.buffer);
assert.throws(TypeError, function() {
sample.Infinity;
});
});
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-integer-indexed-exotic-objects-getownproperty-p
info: Test for-in enumeration with detached buffer.
description: |
9.4.5.1 [[GetOwnProperty]] ( P )
...
3. If Type(P) is String, then
a. Let numericIndex be ! CanonicalNumericIndexString(P).
b. If numericIndex is not undefined, then
i. Let value be ? IntegerIndexedElementGet(O, numericIndex).
...
9.4.5.8 IntegerIndexedElementGet ( O, index )
...
3. Let buffer be O.[[ViewedArrayBuffer]].
4. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
...
13.7.5.15 EnumerateObjectProperties (O)
...
EnumerateObjectProperties must obtain the own property keys of the
target object by calling its [[OwnPropertyKeys]] internal method.
Property attributes of the target object must be obtained by
calling its [[GetOwnProperty]] internal method.
includes: [testTypedArray.js, detachArrayBuffer.js]
---*/
testWithTypedArrayConstructors(function(TA) {
var sample = new TA(42);
$DETACHBUFFER(sample.buffer);
assert.throws(TypeError, function() {
for (var key in sample) {
throw new Test262Error();
}
});
});
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-integer-indexed-exotic-objects-hasproperty-p
info: >
"Infinity" is a canonical numeric string, test with access on detached buffer.
description: |
9.4.5.2 [[HasProperty]]( P )
...
3. If Type(P) is String, then
a. Let numericIndex be ! CanonicalNumericIndexString(P).
b. If numericIndex is not undefined, then
i. Let buffer be O.[[ViewedArrayBuffer]].
ii. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
...
7.1.16 CanonicalNumericIndexString ( argument )
...
3. Let n be ! ToNumber(argument).
4. If SameValue(! ToString(n), argument) is false, return undefined.
5. Return n.
flags: [noStrict]
includes: [testTypedArray.js, detachArrayBuffer.js]
---*/
testWithTypedArrayConstructors(function(TA) {
var sample = new TA(0);
$DETACHBUFFER(sample.buffer);
assert.throws(TypeError, function() {
with (sample) Infinity;
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment