1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/proxy/testDirectProxyValidateProperty6.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,28 @@ 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 accessor descriptors, the current descriptor is 1.9 + * non-configurable, and the descriptor returned by the trap has a different 1.10 + * setter. 1.11 + */ 1.12 +var target = {}; 1.13 +Object.defineProperty(target, 'foo', { 1.14 + set: function (value) {i 1.15 + target.foo = 'bar'; 1.16 + }, 1.17 + configurable: false 1.18 +}); 1.19 +var caught = false; 1.20 +assertThrowsInstanceOf(function () { 1.21 + Object.getOwnPropertyDescriptor(new Proxy(target, { 1.22 + getOwnPropertyDescriptor: function (target, name) { 1.23 + return { 1.24 + set: function (value) { 1.25 + target.foo = 'baz'; 1.26 + }, 1.27 + configurable: false 1.28 + }; 1.29 + } 1.30 + }), 'foo'); 1.31 +}, TypeError);