Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (C) 2026 dmvjs. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-array.prototype.toreversed
description: >
Return abrupt from ToLength(Get(O, "length")).
info: |
Array.prototype.toReversed ( )

1. Let O be ? ToObject(this value).
2. Let len be ? LengthOfArrayLike(O).
features: [change-array-by-copy]
---*/

var o1 = {};

Object.defineProperty(o1, 'length', {
get: function() {
throw new Test262Error();
},
configurable: true
});

assert.throws(Test262Error, function() {
Array.prototype.toReversed.call(o1);
});

var o2 = {
length: {
valueOf: function() {
throw new Test262Error();
}
}
};

assert.throws(Test262Error, function() {
Array.prototype.toReversed.call(o2);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (C) 2026 dmvjs. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-array.prototype.tosorted
description: >
Return abrupt from ToLength(Get(O, "length")).
info: |
Array.prototype.toSorted ( compareFn )

1. Let O be ? ToObject(this value).
2. Let len be ? LengthOfArrayLike(O).
features: [change-array-by-copy]
---*/

var o1 = {};

Object.defineProperty(o1, 'length', {
get: function() {
throw new Test262Error();
},
configurable: true
});

assert.throws(Test262Error, function() {
Array.prototype.toSorted.call(o1);
});

var o2 = {
length: {
valueOf: function() {
throw new Test262Error();
}
}
};

assert.throws(Test262Error, function() {
Array.prototype.toSorted.call(o2);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (C) 2026 dmvjs. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-array.prototype.tospliced
description: >
Return abrupt from ToLength(Get(O, "length")).
info: |
Array.prototype.toSpliced ( start, deleteCount, ...items )

1. Let O be ? ToObject(this value).
2. Let len be ? LengthOfArrayLike(O).
features: [change-array-by-copy]
---*/

var o1 = {};

Object.defineProperty(o1, 'length', {
get: function() {
throw new Test262Error();
},
configurable: true
});

assert.throws(Test262Error, function() {
Array.prototype.toSpliced.call(o1);
});

var o2 = {
length: {
valueOf: function() {
throw new Test262Error();
}
}
};

assert.throws(Test262Error, function() {
Array.prototype.toSpliced.call(o2);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (C) 2026 dmvjs. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-array.prototype.with
description: >
Return abrupt from ToLength(Get(O, "length")).
info: |
Array.prototype.with ( index, value )

1. Let O be ? ToObject(this value).
2. Let len be ? LengthOfArrayLike(O).
features: [change-array-by-copy]
---*/

var o1 = {};

Object.defineProperty(o1, 'length', {
get: function() {
throw new Test262Error();
},
configurable: true
});

assert.throws(Test262Error, function() {
Array.prototype.with.call(o1, 0, 1);
});

var o2 = {
length: {
valueOf: function() {
throw new Test262Error();
}
}
};

assert.throws(Test262Error, function() {
Array.prototype.with.call(o2, 0, 1);
});