Array#shift throws TypeError if this value's "length" property was defined with [[Writable]]: false. Fixes gh-2773

This commit is contained in:
Rick Waldron 2020-09-14 14:31:22 -04:00
parent 9fc299915d
commit f94fc660cc
1 changed files with 9 additions and 1 deletions

View File

@ -3,7 +3,7 @@
/*---
esid: sec-array.prototype.shift
description: >
Array#shift throws TypeError upon attempting to modify a string
Array#shift throws TypeError if this value's "length" property was defined with [[Writable]]: false.
info: |
Array.prototype.shift ( )
...
@ -25,3 +25,11 @@ assert.throws(TypeError, () => {
assert.throws(TypeError, () => {
Array.prototype.shift.call('abc');
}, "Array.prototype.shift.call('abc')");
assert.throws(TypeError, () => {
Array.prototype.shift.call(function() {});
}, "Array.prototype.shift.call(function() {})");
assert.throws(TypeError, () => {
Array.prototype.shift.call(Object.defineProperty({}, 'length', {writable: false}));
}, "Array.prototype.shift.call(Object.defineProperty({}, 'length', {writable: false}))");