michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: */ michael@0: michael@0: var gTestfile = 'proxy-array-target-length-definition.js'; michael@0: var BUGNUMBER = 905947; michael@0: var summary = michael@0: "Redefining an array's |length| property when redefining the |length| " + michael@0: "property on a proxy with an array as target"; michael@0: michael@0: print(BUGNUMBER + ": " + summary); michael@0: michael@0: /************** michael@0: * BEGIN TEST * michael@0: **************/ michael@0: michael@0: var arr = []; michael@0: var p = new Proxy(arr, {}); michael@0: michael@0: // This really should throw a TypeError, but we're buggy just yet, and this michael@0: // silently does nothing. michael@0: Object.defineProperty(p, "length", { value: 17, configurable: true }); michael@0: michael@0: // Same here. michael@0: Object.defineProperty(p, "length", { value: 42, enumerable: true }); michael@0: michael@0: // But at least we can check the property went unchanged. michael@0: var pd = Object.getOwnPropertyDescriptor(p, "length"); michael@0: assertEq(pd.value, 0); michael@0: assertEq(pd.writable, true); michael@0: assertEq(pd.enumerable, false); michael@0: assertEq(pd.configurable, false); michael@0: michael@0: var ad = Object.getOwnPropertyDescriptor(arr, "length"); michael@0: assertEq(ad.value, 0); michael@0: assertEq(ad.writable, true); michael@0: assertEq(ad.enumerable, false); michael@0: assertEq(ad.configurable, false); michael@0: michael@0: /******************************************************************************/ michael@0: michael@0: if (typeof reportCompare === "function") michael@0: reportCompare(true, true); michael@0: michael@0: print("Tests complete");