tor-browser

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

not-extensible-missing-keys-throws.js (825B)


      1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
      5 description: >
      6    If target is not extensible, the result must contain all the keys of the own
      7    properties of the target object.
      8 info: |
      9    [[OwnPropertyKeys]] ( )
     10 
     11    ...
     12    19. For each key that is an element of targetConfigurableKeys, do
     13        a. If key is not an element of uncheckedResultKeys, throw a TypeError
     14        exception.
     15 features: [Proxy]
     16 ---*/
     17 
     18 var target = {
     19  foo: 1,
     20  bar: 2
     21 };
     22 
     23 var p = new Proxy(target, {
     24  ownKeys: function() {
     25    return ["foo"];
     26  }
     27 });
     28 
     29 Object.preventExtensions(target);
     30 
     31 assert.throws(TypeError, function() {
     32  Object.keys(p);
     33 });
     34 
     35 reportCompare(0, 0);