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

Side by Side Diff: test/mjsunit/es6/built-in-accessor-names.js

Issue 1192433003: Revert of Add %TypedArray% to proto chain (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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/typedarray.js ('k') | test/mjsunit/get-prototype-of.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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-tostring 5 // Flags: --harmony-tostring
6 6
7 'use strict'; 7 'use strict';
8 8
9 function getPropertyDescriptor(object, field, expectedDepth) { 9 function assertGetterName(expected, object, name) {
10 for (var depth = 0; depth < expectedDepth; depth++) { 10 var descr = Object.getOwnPropertyDescriptor(object, name);
11 assertFalse(Object.hasOwnProperty(object, field));
12 object = object.__proto__;
13 }
14 return Object.getOwnPropertyDescriptor(object, field);
15 }
16
17 function assertGetterName(expected, object, name, expectedDepth) {
18 var descr = getPropertyDescriptor(object, name, expectedDepth);
19 assertSame(expected, descr.get.name); 11 assertSame(expected, descr.get.name);
20 } 12 }
21 13
22 14
23 function assertSetterName(expected, object, name, indirect) { 15 function assertSetterName(expected, object, name) {
24 var descr = getPropertyDescriptor(object, name); 16 var descr = Object.getOwnPropertyDescriptor(object, name);
25 assertSame(expected, descr.set.name); 17 assertSame(expected, descr.set.name);
26 } 18 }
27 19
28 20
29 assertGetterName('get byteLength', ArrayBuffer.prototype, 'byteLength'); 21 assertGetterName('get byteLength', ArrayBuffer.prototype, 'byteLength');
30 assertGetterName('get size', Set.prototype, 'size'); 22 assertGetterName('get size', Set.prototype, 'size');
31 assertGetterName('get size', Map.prototype, 'size'); 23 assertGetterName('get size', Map.prototype, 'size');
32 24
33 25
34 let typedArrays = [ 26 let typedArrays = [
35 Uint8Array, 27 Uint8Array,
36 Int8Array, 28 Int8Array,
37 Uint16Array, 29 Uint16Array,
38 Int16Array, 30 Int16Array,
39 Uint32Array, 31 Uint32Array,
40 Int32Array, 32 Int32Array,
41 Float32Array, 33 Float32Array,
42 Float64Array, 34 Float64Array,
43 Uint8ClampedArray 35 Uint8ClampedArray
44 ]; 36 ];
45 37
46 for (let f of typedArrays) { 38 for (let f of typedArrays) {
47 assertGetterName('get buffer', f.prototype, 'buffer', 1); 39 assertGetterName('get buffer', f.prototype, 'buffer');
48 assertGetterName('get byteOffset', f.prototype, 'byteOffset', 1); 40 assertGetterName('get byteOffset', f.prototype, 'byteOffset');
49 assertGetterName('get byteLength', f.prototype, 'byteLength', 1); 41 assertGetterName('get byteLength', f.prototype, 'byteLength');
50 assertGetterName('get length', f.prototype, 'length', 1); 42 assertGetterName('get length', f.prototype, 'length');
51 assertGetterName('get [Symbol.toStringTag]', f.prototype, Symbol.toStringTag, 1); 43 assertGetterName('get [Symbol.toStringTag]', f.prototype, Symbol.toStringTag);
52 } 44 }
53 45
54 46
55 assertGetterName('get buffer', DataView.prototype, 'buffer'); 47 assertGetterName('get buffer', DataView.prototype, 'buffer');
56 assertGetterName('get byteOffset', DataView.prototype, 'byteOffset'); 48 assertGetterName('get byteOffset', DataView.prototype, 'byteOffset');
57 assertGetterName('get byteLength', DataView.prototype, 'byteLength'); 49 assertGetterName('get byteLength', DataView.prototype, 'byteLength');
58 50
59 51
60 assertGetterName('get __proto__', Object.prototype, '__proto__'); 52 assertGetterName('get __proto__', Object.prototype, '__proto__');
61 assertSetterName('set __proto__', Object.prototype, '__proto__'); 53 assertSetterName('set __proto__', Object.prototype, '__proto__');
OLDNEW
« no previous file with comments | « src/typedarray.js ('k') | test/mjsunit/get-prototype-of.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698