js/src/jit-test/tests/proxy/testDirectProxyGetOwnPropertyNames8.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 // Return the names returned by the trap
     2 var target = {};
     3 Object.defineProperty(target, 'foo', {
     4     configurable: true
     5 });
     6 var names = Object.getOwnPropertyNames(new Proxy(target, {
     7     getOwnPropertyNames : function (target) {
     8         return [ 'bar' ];
     9     }
    10 }));
    11 assertEq(names.length, 1);
    12 assertEq(names[0], 'bar');
    14 var names = Object.getOwnPropertyNames(new Proxy(Object.create(Object.create(null, {
    15     a: {
    16         enumerable: true,
    17         configurable: true
    18     },
    19     b: {
    20         enumerable: false,
    21         configurable: true
    22     }
    23 }), {
    24     c: {
    25         enumerable: true,
    26         configurable: true
    27     },
    28     d: {
    29         enumerable: false,
    30         configurable: true
    31     }
    32 }), {
    33     getOwnPropertyNames: function (target) {
    34         return [ 'c', 'e' ];
    35     }
    36 }));
    37 assertEq(names.length, 2);
    38 assertEq(names[0], 'c');
    39 assertEq(names[1], 'e');

mercurial