From 8068b91d15733eee3f97bb741197a1b6da1550e1 Mon Sep 17 00:00:00 2001 From: littledan Date: Thu, 16 Jul 2015 17:21:11 -0700 Subject: [PATCH] Additional TypedArray tests - Test that TypedArray properties cannot be set in strict mode Properties like %TypedArray%.prototype.length have a getter and no setter. This test verifies that property, which was apparently not true in the past or had no test ensuring throwing in this case. - Test that TypedArray integer indexed properties (array elements) are not configurable Both of these have passed for some time, but there are open bugs against them and apparently no tests verifying that they are fixed. BUG=v8:3048, v8:3799 LOG=N R=adamk Review URL: https://codereview.chromium.org/1232843005 Cr-Commit-Position: refs/heads/master@{#29717} --- test/mjsunit/es6/typedarray.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/mjsunit/es6/typedarray.js b/test/mjsunit/es6/typedarray.js index ef7955c..7b1cc06 100644 --- a/test/mjsunit/es6/typedarray.js +++ b/test/mjsunit/es6/typedarray.js @@ -417,6 +417,7 @@ var typedArrayConstructors = [ function TestPropertyTypeChecks(constructor) { function CheckProperty(name) { + assertThrows(function() { 'use strict'; new constructor(10)[name] = 0; }) var d = Object.getOwnPropertyDescriptor(constructor.prototype, name); var o = {}; assertThrows(function() {d.get.call(o);}, TypeError); @@ -756,3 +757,13 @@ TestArbitrary(new DataView(new ArrayBuffer(256))); // Test direct constructor call assertThrows(function() { ArrayBuffer(); }, TypeError); assertThrows(function() { DataView(new ArrayBuffer()); }, TypeError); + +function TestNonConfigurableProperties(constructor) { + var arr = new constructor([100]) + assertFalse(Object.getOwnPropertyDescriptor(arr,"0").configurable) + assertFalse(delete arr[0]) +} + +for(i = 0; i < typedArrayConstructors.length; i++) { + TestNonConfigurableProperties(typedArrayConstructors[i]); +} -- 2.7.4