Skip to content

Commit

Permalink
Remove check for per-comparator call detach check in TypedArray.proto…
Browse files Browse the repository at this point in the history
…type.sort

This updates tests in line with the normative change in
tc39/ecma262#2723
  • Loading branch information
syg authored and rwaldron committed Apr 5, 2022
1 parent 3ac6b73 commit d7c0a20
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 130 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

16 changes: 6 additions & 10 deletions test/built-ins/TypedArray/prototype/sort/sort-tonumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@ testWithTypedArrayConstructors(function(TA) {
var ab = ta.buffer;

var called = false;
assert.throws(TypeError, function() {
ta.sort(function(a, b) {
// IsDetachedBuffer is checked right after calling comparefn.
// So, detach the ArrayBuffer to cause sort to throw, to make sure we're actually calling ToNumber immediately (as spec'd)
// (a possible bug is to wait until the result is inspected to call ToNumber, rather than immediately)
$DETACHBUFFER(ab);
return {
[Symbol.toPrimitive]() { called = true; }
};
});
ta.sort(function(a, b) {
// Detaching the buffer does not cause sort to throw.
$DETACHBUFFER(ab);
return {
[Symbol.toPrimitive]() { called = true; }
};
});

assert.sameValue(true, called);
Expand Down

0 comments on commit d7c0a20

Please sign in to comment.