tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

length.js (1030B)


      1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 es6id: 22.1.4.1
      5 description: >
      6  Instances has the own property length
      7 info: |
      8  22.1.4.1 length
      9 
     10  The length property of an Array instance is a data property whose value is
     11  always numerically greater than the name of every configurable own property
     12  whose name is an array index.
     13 
     14  The length property initially has the attributes { [[Writable]]: true,
     15  [[Enumerable]]: false, [[Configurable]]: false }.
     16 ---*/
     17 
     18 class Ar extends Array {}
     19 
     20 var arr = new Ar('foo', 'bar');
     21 
     22 assert.sameValue(arr[0], 'foo');
     23 assert.sameValue(arr[1], 'bar');
     24 
     25 var arrDesc = Object.getOwnPropertyDescriptor(arr, 'length');
     26 
     27 assert.sameValue(arrDesc.writable, true);
     28 assert.sameValue(arrDesc.enumerable, false);
     29 assert.sameValue(arrDesc.configurable, false);
     30 
     31 assert.sameValue(arr[1], 'bar');
     32 
     33 arr.length = 1;
     34 
     35 assert.sameValue(arr[0], 'foo');
     36 assert.sameValue(arr[1], undefined);
     37 
     38 reportCompare(0, 0);