Fix offset for detached TypedArray test (#946)

Bug was reported by @anba at
https://github.com/tc39/ecma262/pull/852#issuecomment-291781031

Without this change, you'd expect a RangeError rather than a TypeError.
This commit is contained in:
Daniel Ehrenberg 2017-04-06 18:05:43 +02:00 committed by Leo Balter
parent ab9738c471
commit 2878106ca0
1 changed files with 1 additions and 1 deletions

View File

@ -15,6 +15,6 @@ includes: [testTypedArray.js, detachArrayBuffer.js]
testWithTypedArrayConstructors(function(TA) {
var offset = TA.BYTES_PER_ELEMENT;
var buffer = new ArrayBuffer(3 * offset);
var byteOffset = { valueOf() { $DETACHBUFFER(buffer); return 1; } };
var byteOffset = { valueOf() { $DETACHBUFFER(buffer); return offset; } };
assert.throws(TypeError, () => new TA(buffer, byteOffset));
});