Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: test/mjsunit/regress/regress-595319.js

Issue 1814933002: Throw the right exceptions from setting elements in Array.prototype.concat (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/builtins.cc ('K') | « src/builtins.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // https://bugs.chromium.org/p/chromium/issues/detail?id=595319
6 // Ensure exceptions are checked for by Array.prototype.concat from adding
7 // 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
8
9 // If adding a property does throw, the exception is propagated
10 class MyException extends Error { }
11 class MyArray extends Array {
12 constructor(...args) {
13 super(...args);
14 return new Proxy(this, {
15 defineProperty() { throw new MyException(); }
16 });
17 }
18 }
19 assertThrows(() => new MyArray().concat([1]), MyException);
20
21 // Ensure elements are added to the instance, rather than calling [[Set]].
22 Object.prototype.__defineGetter__(0, function(){});
23 class MyArray2 extends Array { };
24 Array.prototype.constructor = MyArray2;
25 assertArrayEquals([0.5], [].concat(0.5));
OLDNEW
« src/builtins.cc ('K') | « src/builtins.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698