michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: 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: function arr() { michael@0: return Object.defineProperty([20, 10, 30], 0, {writable: false}); michael@0: } michael@0: michael@0: assertEq(testLenientAndStrict('var a = arr(); a.sort()', michael@0: raisesException(TypeError), michael@0: raisesException(TypeError)), michael@0: true); michael@0: michael@0: function obj() { michael@0: var o = {0: 20, 1: 10, 2: 30, length: 3}; michael@0: Object.defineProperty(o, 0, {writable: false}); michael@0: return o; michael@0: } michael@0: michael@0: assertEq(testLenientAndStrict('var o = obj(); Array.prototype.sort.call(o)', michael@0: raisesException(TypeError), michael@0: raisesException(TypeError)), michael@0: true); michael@0: michael@0: // The behavior of sort is implementation-defined if the object being michael@0: // sorted is sparse, so I'm not sure how to test its behavior on michael@0: // non-configurable properties. michael@0: michael@0: reportCompare(true, true);