Assert extensibility of dataview objects

This commit is contained in:
Leo Balter 2018-09-06 13:16:23 -04:00 committed by Rick Waldron
parent 97a54fc7a0
commit 93635ca3b2
3 changed files with 36 additions and 4 deletions

View File

@ -1,4 +0,0 @@
//@ runDefault
// This test passes if it does not crash.
let x = new DataView(new ArrayBuffer(1));
Object.defineProperty(x, 'foo', {});

View File

@ -28,9 +28,27 @@ info: |
5. Set the [[Extensible]] internal slot of obj to true.
...
features: [SharedArrayBuffer]
includes: [propertyHelper.js]
---*/
var buffer = new SharedArrayBuffer(8);
var sample = new DataView(buffer, 0);
assert(Object.isExtensible(sample));
Object.defineProperty(sample, 'baz', {});
assert(sample.hasOwnProperty('baz'), 'confirms extensibility adding a new property');
Object.defineProperty(sample, 'foo', {
value: 'bar',
writable: true,
configurable: true,
enumerable: false,
});
verifyProperty(sample, 'foo', {
value: 'bar',
writable: true,
configurable: true,
enumerable: false,
});

View File

@ -26,9 +26,27 @@ info: |
...
5. Set the [[Extensible]] internal slot of obj to true.
...
includes: [propertyHelper.js]
---*/
var buffer = new ArrayBuffer(8);
var sample = new DataView(buffer, 0);
assert(Object.isExtensible(sample));
Object.defineProperty(sample, 'baz', {});
assert(sample.hasOwnProperty('baz'), 'confirms extensibility adding a new property');
Object.defineProperty(sample, 'foo', {
value: 'bar',
writable: true,
configurable: true,
enumerable: false,
});
verifyProperty(sample, 'foo', {
value: 'bar',
writable: true,
configurable: true,
enumerable: false,
});