js/src/jit-test/tests/proxy/testDirectProxyValidateProperty4.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/testDirectProxyValidateProperty4.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,24 @@
     1.4 +load(libdir + "asserts.js");
     1.5 +
     1.6 +/*
     1.7 + * Throw a TypeError if both the current descriptor and the descriptor returned
     1.8 + * by the trap are data descriptors, the current descriptor is non-configurable
     1.9 + * and non-writable, and the descriptor returned by the trap is writable.
    1.10 + */
    1.11 +var target = {};
    1.12 +Object.defineProperty(target, 'foo', {
    1.13 +    value: 'bar',
    1.14 +    writable: false,
    1.15 +    configurable: false
    1.16 +});
    1.17 +assertThrowsInstanceOf(function () { 
    1.18 +    Object.getOwnPropertyDescriptor(new Proxy(target, {
    1.19 +        getOwnPropertyDescriptor: function (target, name) {
    1.20 +            return {
    1.21 +                value: 'bar',
    1.22 +                writable: true,
    1.23 +                configurable: false
    1.24 +            };
    1.25 +        }
    1.26 +    }), 'foo');
    1.27 +}, TypeError);

mercurial