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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/proxy/testDirectProxyValidateProperty2.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +load(libdir + "asserts.js");
     1.5 +
     1.6 +/*
     1.7 + * Throw a TypeError if the enumerable fields of the current descriptor and the
     1.8 + * descriptor returned by the trap are the boolean negation of each other
     1.9 + */
    1.10 +var target = {};
    1.11 +Object.defineProperty(target, 'foo', {
    1.12 +    configurable: false,
    1.13 +    enumerable: true
    1.14 +});
    1.15 +var caught = false;
    1.16 +assertThrowsInstanceOf(function () { 
    1.17 +    Object.getOwnPropertyDescriptor(new Proxy(target, {
    1.18 +        getOwnPropertyDescriptor: function (target, name) {
    1.19 +            return {
    1.20 +                configurable: false,
    1.21 +                enumerable: false
    1.22 +            };
    1.23 +        }
    1.24 +    }), 'foo');
    1.25 +}, TypeError);
    1.26 +
    1.27 +var target = {};
    1.28 +Object.defineProperty(target, 'foo', {
    1.29 +    configurable: false,
    1.30 +    enumerable: false
    1.31 +});
    1.32 +var caught = false;
    1.33 +assertThrowsInstanceOf(function () { 
    1.34 +    Object.getOwnPropertyDescriptor(new Proxy(target, {
    1.35 +        getOwnPropertyDescriptor: function (target, name) {
    1.36 +            return {
    1.37 +                configurable: false,
    1.38 +                enumerable: true
    1.39 +            };
    1.40 +        }
    1.41 +    }), 'foo');
    1.42 +}, TypeError);

mercurial