michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: * Contributor: michael@0: * Jeff Walden michael@0: */ michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 866700; michael@0: var summary = "Assertion redefining non-writable length to a non-numeric value"; michael@0: michael@0: print(BUGNUMBER + ": " + summary); michael@0: michael@0: /************** michael@0: * BEGIN TEST * michael@0: **************/ michael@0: michael@0: var count = 0; michael@0: michael@0: var convertible = michael@0: { michael@0: valueOf: function() michael@0: { michael@0: count++; michael@0: if (count > 2) michael@0: return 0; michael@0: throw new SyntaxError("fnord"); michael@0: } michael@0: }; michael@0: michael@0: var arr = []; michael@0: Object.defineProperty(arr, "length", { value: 0, writable: false }); michael@0: michael@0: try michael@0: { michael@0: Object.defineProperty(arr, "length", michael@0: { michael@0: value: convertible, michael@0: writable: true, michael@0: configurable: true, michael@0: enumerable: true michael@0: }); michael@0: throw new Error("didn't throw"); michael@0: } michael@0: catch (e) michael@0: { michael@0: assertEq(e instanceof SyntaxError, true, "expected SyntaxError, got " + e); michael@0: } michael@0: michael@0: assertEq(count, 1); michael@0: assertEq(arr.length, 0); michael@0: michael@0: /******************************************************************************/ michael@0: michael@0: if (typeof reportCompare === "function") michael@0: reportCompare(true, true); michael@0: michael@0: print("Tests complete");