Skip to content
Snippets Groups Projects
Commit 2878106c authored by Daniel Ehrenberg's avatar Daniel Ehrenberg Committed by Leo Balter
Browse files

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.
parent ab9738c4
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,6 @@ includes: [testTypedArray.js, detachArrayBuffer.js] ...@@ -15,6 +15,6 @@ includes: [testTypedArray.js, detachArrayBuffer.js]
testWithTypedArrayConstructors(function(TA) { testWithTypedArrayConstructors(function(TA) {
var offset = TA.BYTES_PER_ELEMENT; var offset = TA.BYTES_PER_ELEMENT;
var buffer = new ArrayBuffer(3 * offset); 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)); assert.throws(TypeError, () => new TA(buffer, byteOffset));
}); });
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