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

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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