summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/DataView/instance-extensibility.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/DataView/instance-extensibility.js')
-rw-r--r--js/src/tests/test262/built-ins/DataView/instance-extensibility.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/DataView/instance-extensibility.js b/js/src/tests/test262/built-ins/DataView/instance-extensibility.js
new file mode 100644
index 0000000000..5c6f0b9486
--- /dev/null
+++ b/js/src/tests/test262/built-ins/DataView/instance-extensibility.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-dataview-buffer-byteoffset-bytelength
+description: >
+ The new instance is extensible
+info: |
+ 24.2.2.1 DataView (buffer, byteOffset, byteLength )
+
+ ...
+ 12. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%DataViewPrototype%",
+ « [[DataView]], [[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]] »).
+ ...
+ 17. Return O.
+
+ 9.1.13 OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ ,
+ internalSlotsList ] )
+
+ ...
+ 3. Return ObjectCreate(proto, internalSlotsList).
+
+ 9.1.12 ObjectCreate (proto [ , internalSlotsList ])
+
+ ...
+ 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,
+});
+
+reportCompare(0, 0);