summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength')
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/invoked-as-accessor.js20
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/invoked-as-func.js26
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/length.js35
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/name.js27
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/prop-desc.js28
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/return-maxbytelength-growable.js30
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/return-maxbytelength-non-growable.js27
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/this-has-no-arraybufferdata-internal.js42
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/this-is-arraybuffer.js36
-rw-r--r--js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/this-is-not-object.js51
12 files changed, 322 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/browser.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/browser.js
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/invoked-as-accessor.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/invoked-as-accessor.js
new file mode 100644
index 0000000000..a0827878f2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/invoked-as-accessor.js
@@ -0,0 +1,20 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-sharedarraybuffer.prototype.maxbytelength
+description: Requires this value to have a [[ArrayBufferData]] internal slot
+info: |
+ get SharedArrayBuffer.prototype.maxByteLength
+
+ 1. Let O be the this value.
+ 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).
+ [...]
+features: [SharedArrayBuffer, resizable-arraybuffer]
+---*/
+
+assert.throws(TypeError, function() {
+ SharedArrayBuffer.prototype.maxByteLength;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/invoked-as-func.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/invoked-as-func.js
new file mode 100644
index 0000000000..4ddb9dc47c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/invoked-as-func.js
@@ -0,0 +1,26 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-sharedarraybuffer.prototype.maxbytelength
+description: Throws a TypeError exception when invoked as a function
+info: |
+ get SharedArrayBuffer.prototype.maxByteLength
+
+ 1. Let O be the this value.
+ 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).
+ [...]
+features: [SharedArrayBuffer, resizable-arraybuffer]
+---*/
+
+var getter = Object.getOwnPropertyDescriptor(
+ SharedArrayBuffer.prototype, 'maxByteLength'
+).get;
+
+assert.sameValue(typeof getter, 'function');
+
+assert.throws(TypeError, function() {
+ getter();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/length.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/length.js
new file mode 100644
index 0000000000..def0904c0e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/length.js
@@ -0,0 +1,35 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-sharedarraybuffer.prototype.maxbytelength
+description: >
+ get SharedArrayBuffer.prototype.maxByteLength.length is 0.
+info: |
+ get SharedArrayBuffer.prototype.maxByteLength
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [SharedArrayBuffer, resizable-arraybuffer]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, 'maxByteLength');
+
+verifyProperty(desc.get, 'length', {
+ value: 0,
+ enumerable: false,
+ writable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/name.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/name.js
new file mode 100644
index 0000000000..da6c9f3069
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/name.js
@@ -0,0 +1,27 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-sharedarraybuffer.prototype.maxbytelength
+description: >
+ get SharedArrayBuffer.prototype.maxByteLength
+
+ 17 ECMAScript Standard Built-in Objects
+
+ Functions that are specified as get or set accessor functions of built-in
+ properties have "get " or "set " prepended to the property name string.
+
+includes: [propertyHelper.js]
+features: [SharedArrayBuffer, resizable-arraybuffer]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, 'maxByteLength');
+
+verifyProperty(desc.get, 'name', {
+ value: 'get maxByteLength',
+ enumerable: false,
+ writable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/prop-desc.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/prop-desc.js
new file mode 100644
index 0000000000..d64176a81a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/prop-desc.js
@@ -0,0 +1,28 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-sharedarraybuffer.prototype.maxbytelength
+description: >
+ "maxByteLength" property of SharedArrayBuffer.prototype
+info: |
+ SharedArrayBuffer.prototype.maxByteLength is an accessor property whose set
+ accessor function is undefined.
+
+ Section 17: Every accessor property described in clauses 18 through 26 and in
+ Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
+includes: [propertyHelper.js]
+features: [SharedArrayBuffer, resizable-arraybuffer]
+---*/
+
+var desc = Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, 'maxByteLength');
+
+assert.sameValue(desc.set, undefined);
+assert.sameValue(typeof desc.get, 'function');
+
+verifyProperty(SharedArrayBuffer.prototype, 'maxByteLength', {
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/return-maxbytelength-growable.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/return-maxbytelength-growable.js
new file mode 100644
index 0000000000..c417ca9bd5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/return-maxbytelength-growable.js
@@ -0,0 +1,30 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-sharedarraybuffer.prototype.maxbytelength
+description: Return value from [[ArrayBufferMaxByteLength]] internal slot
+info: |
+ 24.1.4.1 get SharedArrayBuffer.prototype.maxByteLength
+
+ 1. Let O be the this value.
+ 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).
+ 3. If IsSharedArrayBuffer(O) is false, throw a TypeError exception.
+ 4. If IsResizableArrayBuffer(O) is true, then
+ a. Let length be O.[[ArrayBufferMaxByteLength]].
+ 5. Else,
+ [...]
+ 6. Return 𝔽(length).
+features: [SharedArrayBuffer, resizable-arraybuffer]
+---*/
+
+var ab1 = new SharedArrayBuffer(0, { maxByteLength: 0 });
+assert.sameValue(ab1.maxByteLength, 0);
+
+var ab2 = new SharedArrayBuffer(0, { maxByteLength: 23 });
+assert.sameValue(ab2.maxByteLength, 23);
+
+var ab3 = new SharedArrayBuffer(42, { maxByteLength: 42 });
+assert.sameValue(ab3.maxByteLength, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/return-maxbytelength-non-growable.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/return-maxbytelength-non-growable.js
new file mode 100644
index 0000000000..279088bff4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/return-maxbytelength-non-growable.js
@@ -0,0 +1,27 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-sharedarraybuffer.prototype.maxbytelength
+description: Return value from [[ArrayBufferByteLength]] internal slot
+info: |
+ 24.1.4.1 get SharedArrayBuffer.prototype.maxByteLength
+
+ 1. Let O be the this value.
+ 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).
+ 3. If IsSharedArrayBuffer(O) is false, throw a TypeError exception.
+ 4. If IsResizableArrayBuffer(O) is true, then
+ [...]
+ 5. Else,
+ a. Let length be O.[[ArrayBufferByteLength]].
+ 6. Return 𝔽(length).
+features: [SharedArrayBuffer, resizable-arraybuffer]
+---*/
+
+var ab1 = new SharedArrayBuffer(0);
+assert.sameValue(ab1.maxByteLength, 0);
+
+var ab2 = new SharedArrayBuffer(42);
+assert.sameValue(ab2.maxByteLength, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/shell.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/shell.js
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/this-has-no-arraybufferdata-internal.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/this-has-no-arraybufferdata-internal.js
new file mode 100644
index 0000000000..e692194ce2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/this-has-no-arraybufferdata-internal.js
@@ -0,0 +1,42 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-sharedarraybuffer.prototype.maxbytelength
+description: >
+ Throws a TypeError exception when `this` does not have a [[ArrayBufferData]]
+ internal slot
+info: |
+ get SharedArrayBuffer.prototype.maxByteLength
+
+ 1. Let O be the this value.
+ 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).
+ [...]
+features: [DataView, SharedArrayBuffer, TypedArray, resizable-arraybuffer]
+---*/
+
+var getter = Object.getOwnPropertyDescriptor(
+ SharedArrayBuffer.prototype, "maxByteLength"
+).get;
+
+assert.sameValue(typeof getter, "function");
+
+assert.throws(TypeError, function() {
+ getter.call({});
+});
+
+assert.throws(TypeError, function() {
+ getter.call([]);
+});
+
+var ta = new Int8Array(8);
+assert.throws(TypeError, function() {
+ getter.call(ta);
+});
+
+var dv = new DataView(new SharedArrayBuffer(8), 0);
+assert.throws(TypeError, function() {
+ getter.call(dv);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/this-is-arraybuffer.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/this-is-arraybuffer.js
new file mode 100644
index 0000000000..ebd09399ff
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/this-is-arraybuffer.js
@@ -0,0 +1,36 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-sharedarraybuffer.prototype.maxbytelength
+description: Throws a TypeError exception when `this` is an ArrayBuffer
+info: |
+ get SharedArrayBuffer.prototype.maxByteLength
+
+ 1. Let O be the this value.
+ 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).
+ 3. If IsSharedArrayBuffer(O) is false, throw a TypeError exception.
+ [...]
+features: [ArrayBuffer, SharedArrayBuffer, resizable-arraybuffer]
+---*/
+
+var maxByteLength = Object.getOwnPropertyDescriptor(
+ SharedArrayBuffer.prototype, "maxByteLength"
+);
+
+var getter = maxByteLength.get;
+var ab = new ArrayBuffer(4);
+
+assert.sameValue(typeof getter, "function");
+
+assert.throws(TypeError, function() {
+ getter.call(ab);
+}, "`this` cannot be an ArrayBuffer");
+
+Object.defineProperties(ab, { maxByteLength: maxByteLength });
+
+assert.throws(TypeError, function() {
+ ab.maxByteLength;
+}, "`this` cannot be an ArrayBuffer");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/this-is-not-object.js b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/this-is-not-object.js
new file mode 100644
index 0000000000..0fd8c2a6c7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/SharedArrayBuffer/prototype/maxByteLength/this-is-not-object.js
@@ -0,0 +1,51 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-get-sharedarraybuffer.prototype.maxbytelength
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ get SharedArrayBuffer.prototype.maxByteLength
+
+ 1. Let O be the this value.
+ 2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).
+ [...]
+features: [SharedArrayBuffer, Symbol, resizable-arraybuffer]
+---*/
+
+var getter = Object.getOwnPropertyDescriptor(
+ SharedArrayBuffer.prototype, "maxByteLength"
+).get;
+
+assert.sameValue(typeof getter, "function");
+
+assert.throws(TypeError, function() {
+ getter.call(undefined);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ getter.call(null);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ getter.call(42);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ getter.call("1");
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ getter.call(true);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ getter.call(false);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ getter.call(s);
+}, "this is a Symbol");
+
+reportCompare(0, 0);