Commit 8068b91d authored by littledan's avatar littledan Committed by Commit bot

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}
parent f76dfee9
......@@ -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]);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment