Index: test/mjsunit/regress/regress-595319.js |
diff --git a/test/mjsunit/regress/regress-595319.js b/test/mjsunit/regress/regress-595319.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1ebd3eff1e724383087a930411f8e9bbd1f46587 |
--- /dev/null |
+++ b/test/mjsunit/regress/regress-595319.js |
@@ -0,0 +1,25 @@ |
+// 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 appropraitely |
adamk
2016/03/17 19:22:21
Typo: s/appropraitely/appropriately/
Dan Ehrenberg
2016/03/17 20:26:33
Done
|
+ |
+// If adding a property does throw, the exception is propagated |
+class MyException extends Error { } |
+class MyArray extends Array { |
+ constructor(...args) { |
+ super(...args); |
+ return new Proxy(this, { |
+ defineProperty() { throw new MyException(); } |
+ }); |
+ } |
+} |
+assertThrows(() => new MyArray().concat([1]), MyException); |
+ |
+// Ensure elements are added to the instance, rather than calling [[Set]]. |
+Object.prototype.__defineGetter__(0, function(){}); |
+class MyArray2 extends Array { }; |
+Array.prototype.constructor = MyArray2; |
+assertArrayEquals([0.5], [].concat(0.5)); |