tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

testDirectProxyValidateProperty2.js (1048B)


      1 load(libdir + "asserts.js");
      2 
      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);
     23 
     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);