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

Side by Side Diff: test/mjsunit/harmony/array-species-constructor.js

Issue 1936393002: Make array __proto__ manipulations not disturb the species protector (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix review issues Created 4 years, 7 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
« no previous file with comments | « src/runtime/runtime-test.cc ('k') | test/mjsunit/harmony/array-species-constructor-accessor.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-species 5 // Flags: --harmony-species --allow-natives-syntax
6 6
7 // Overwriting the constructor of an instance updates the protector 7 // Overwriting the constructor of an instance updates the protector
8 8
9 let x = []; 9 let x = [];
10 10
11 assertEquals(Array, x.map(()=>{}).constructor); 11 assertEquals(Array, x.map(()=>{}).constructor);
12 assertEquals(Array, x.filter(()=>{}).constructor); 12 assertEquals(Array, x.filter(()=>{}).constructor);
13 assertEquals(Array, x.slice().constructor); 13 assertEquals(Array, x.slice().constructor);
14 assertEquals(Array, x.splice().constructor); 14 assertEquals(Array, x.splice().constructor);
15 assertEquals(Array, x.concat([1]).constructor); 15 assertEquals(Array, x.concat([1]).constructor);
16 assertEquals(1, x.concat([1])[0]); 16 assertEquals(1, x.concat([1])[0]);
17 17
18 class MyArray extends Array { } 18 class MyArray extends Array { }
19 19
20 x.constructor = MyArray; 20 x.constructor = MyArray;
21 assertFalse(%SpeciesProtector());
Camillo Bruni 2016/05/11 12:50:08 nit: could you also check that the SpeciesProtecto
Dan Ehrenberg 2016/05/11 14:32:16 No because apparently 'stress' runs happen multipl
21 22
22 assertEquals(MyArray, x.map(()=>{}).constructor); 23 assertEquals(MyArray, x.map(()=>{}).constructor);
23 assertEquals(MyArray, x.filter(()=>{}).constructor); 24 assertEquals(MyArray, x.filter(()=>{}).constructor);
24 assertEquals(MyArray, x.slice().constructor); 25 assertEquals(MyArray, x.slice().constructor);
25 assertEquals(MyArray, x.splice().constructor); 26 assertEquals(MyArray, x.splice().constructor);
26 assertEquals(MyArray, x.concat([1]).constructor); 27 assertEquals(MyArray, x.concat([1]).constructor);
27 assertEquals(1, x.concat([1])[0]); 28 assertEquals(1, x.concat([1])[0]);
OLDNEW
« no previous file with comments | « src/runtime/runtime-test.cc ('k') | test/mjsunit/harmony/array-species-constructor-accessor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698