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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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