js/src/jit-test/tests/proxy/testDirectProxyValidateProperty2.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 enumerable fields of the current descriptor and the
     5  * descriptor returned by the trap are the boolean negation of each other
     6  */
     7 var target = {};
     8 Object.defineProperty(target, 'foo', {
     9     configurable: false,
    10     enumerable: true
    11 });
    12 var caught = false;
    13 assertThrowsInstanceOf(function () { 
    14     Object.getOwnPropertyDescriptor(new Proxy(target, {
    15         getOwnPropertyDescriptor: function (target, name) {
    16             return {
    17                 configurable: false,
    18                 enumerable: false
    19             };
    20         }
    21     }), 'foo');
    22 }, TypeError);
    24 var target = {};
    25 Object.defineProperty(target, 'foo', {
    26     configurable: false,
    27     enumerable: false
    28 });
    29 var caught = false;
    30 assertThrowsInstanceOf(function () { 
    31     Object.getOwnPropertyDescriptor(new Proxy(target, {
    32         getOwnPropertyDescriptor: function (target, name) {
    33             return {
    34                 configurable: false,
    35                 enumerable: true
    36             };
    37         }
    38     }), 'foo');
    39 }, TypeError);

mercurial