mirror of https://github.com/tc39/test262.git
Fix isWritable throwing RangeError on Array "length"
This commit is contained in:
parent
1eff480aca
commit
17fc10942e
|
@ -140,7 +140,8 @@ function isSameValue(a, b) {
|
|||
}
|
||||
|
||||
function isWritable(obj, name, verifyProp, value) {
|
||||
var newValue = value || "unlikelyValue";
|
||||
var unlikelyValue = Array.isArray(obj) && name === "length" ? 217493 : "unlikelyValue";
|
||||
var newValue = value || unlikelyValue;
|
||||
var hadValue = Object.prototype.hasOwnProperty.call(obj, name);
|
||||
var oldValue = obj[name];
|
||||
var writeSucceeded;
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
"length" property of Arrays is tested with valid value.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var array = [1, 2, 3];
|
||||
|
||||
verifyWritable(array, "length");
|
||||
|
||||
assert.sameValue(array.length, 3, '`verifyWritable` should be non-destructive.');
|
Loading…
Reference in New Issue