// Copyright 2016 the V8 project authors. All rights reserved.// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.// https://bugs.chromium.org/p/chromium/issues/detail?id=595319// Ensure exceptions are checked for by Array.prototype.concat from adding// an element, and that elements are added to array subclasses appropriately// If adding a property does throw, the exception is propagatedclassMyExceptionextendsError{}classNoDefinePropertyArrayextendsArray{constructor(...args){super(...args);returnnewProxy(this,{defineProperty(){thrownewMyException();}});}}assertThrows(()=>newNoDefinePropertyArray().concat([1]),MyException);// Ensure elements are added to the instance, rather than calling [[Set]].classZeroGetterArrayextendsArray{get0(){}};assertArrayEquals([1],newZeroGetterArray().concat(1));// Frozen arrays lead to throwingclassFrozenArrayextendsArray{constructor(...args){super(...args);Object.freeze(this);}}assertThrows(()=>newFrozenArray().concat([1]),TypeError);// Non-configurable non-writable zero leads to throwingclassZeroFrozenArrayextendsArray{constructor(...args){super(...args);Object.defineProperty(this,0,{value:1});}}assertThrows(()=>newZeroFrozenArray().concat([1]),TypeError);