js/src/jit-test/tests/proxy/testDirectProxyValidateProperty3.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 load(libdir + "asserts.js");
     3 /*
     4  * Throw a TypeError if the current descriptor is a data descriptor and the
     5  * descriptor returned by the trap is not, or vice versa, and the current
     6  * descriptor is non-configurable
     7  */
     8 var target = {};
     9 Object.defineProperty(target, 'foo', {
    10     value: 'bar',
    11     configurable: false
    12 });
    13 var caught = false;
    14 assertThrowsInstanceOf(function () { 
    15     Object.getOwnPropertyDescriptor(new Proxy(target, {
    16         getOwnPropertyDescriptor: function (target, name) {
    17             return {
    18                 get: function () {
    19                     return 'bar';
    20                 },
    21                 configurable: false
    22             };
    23         }
    24     }), 'foo');
    25 }, TypeError);
    27 var target = {};
    28 Object.defineProperty(target, 'foo', {
    29     value: function () {
    30         return 'bar';
    31     },
    32     configurable: false
    33 });
    34 assertThrowsInstanceOf(function () { 
    35     Object.getOwnPropertyDescriptor(new Proxy(target, {
    36         getOwnPropertyDescriptor: function (target, name) {
    37             return {
    38                 value: 'bar',
    39                 configurable: false
    40             };
    41         }
    42     }), 'foo');
    43 }, TypeError);

mercurial