Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 8d7f44f

Browse files
committed
Bug 1966355 - Part 21: Import Immutable ArrayBuffer test262 tests. r=spidermonkey-reviewers,dminor
Test262 PR: <tc39/test262#4445>. Roughly half of the spec proposal is still missing coverage, see the review notes at <tc39/test262#4445 (review)>. Differential Revision: https://phabricator.services.mozilla.com/D249415
1 parent 0f494f9 commit 8d7f44f

File tree

117 files changed

+4481
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+4481
-0
lines changed

js/src/tests/test262/prs/4445/browser.js

Whitespace-only changes.

js/src/tests/test262/prs/4445/built-ins/ArrayBuffer/browser.js

Whitespace-only changes.

js/src/tests/test262/prs/4445/built-ins/ArrayBuffer/prototype/browser.js

Whitespace-only changes.

js/src/tests/test262/prs/4445/built-ins/ArrayBuffer/prototype/immutable/browser.js

Whitespace-only changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// |reftest| shell-option(--enable-arraybuffer-immutable) skip-if(!ArrayBuffer.prototype.sliceToImmutable||!xulRuntime.shell) -- immutable-arraybuffer is not enabled unconditionally, requires shell-options
2+
// Copyright (C) 2025 Moddable Tech, Inc. All rights reserved.
3+
// This code is governed by the BSD license found in the LICENSE file.
4+
/*---
5+
description: verify immutable property of ArrayBuffer
6+
esid: sec-get-arraybuffer.prototype.immutable
7+
features: [ArrayBuffer, immutable-arraybuffer]
8+
---*/
9+
10+
var ab = new ArrayBuffer(1);
11+
12+
assert.sameValue(ab.immutable, false);
13+
14+
ab = ab.transferToImmutable();
15+
16+
assert.sameValue(ab.immutable, true);
17+
18+
ab = new ArrayBuffer(1, { maxByteLength: 2 });
19+
20+
assert.sameValue(ab.immutable, false);
21+
22+
ab = ab.transferToImmutable();
23+
24+
assert.sameValue(ab.immutable, true);
25+
26+
reportCompare(0, 0);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// |reftest| shell-option(--enable-arraybuffer-immutable) skip-if(!ArrayBuffer.prototype.sliceToImmutable||!xulRuntime.shell) -- immutable-arraybuffer is not enabled unconditionally, requires shell-options
2+
// Copyright (C) 2025 Moddable Tech, Inc. All rights reserved.
3+
// This code is governed by the BSD license found in the LICENSE file.
4+
/*---
5+
description: verify immutable property requires ArrayBuffer receiver
6+
esid: sec-get-arraybuffer.prototype.immutable
7+
features: [ArrayBuffer, immutable-arraybuffer]
8+
---*/
9+
10+
assert.throws(TypeError, function() {
11+
ArrayBuffer.prototype.immutable;
12+
});
13+
14+
reportCompare(0, 0);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// |reftest| shell-option(--enable-arraybuffer-immutable) skip-if(!ArrayBuffer.prototype.sliceToImmutable||!xulRuntime.shell) -- immutable-arraybuffer is not enabled unconditionally, requires shell-options
2+
// Copyright (C) 2025 Moddable Tech, Inc. All rights reserved.
3+
// This code is governed by the BSD license found in the LICENSE file.
4+
/*---
5+
description: verify immutable property is implemented by an accessor
6+
esid: sec-get-arraybuffer.prototype.immutable
7+
features: [ArrayBuffer, immutable-arraybuffer]
8+
---*/
9+
10+
var getter = Object.getOwnPropertyDescriptor(
11+
ArrayBuffer.prototype, 'immutable'
12+
).get;
13+
14+
assert.sameValue(typeof getter, 'function');
15+
16+
assert.throws(TypeError, function() {
17+
getter();
18+
});
19+
20+
reportCompare(0, 0);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// |reftest| shell-option(--enable-arraybuffer-immutable) skip-if(!ArrayBuffer.prototype.sliceToImmutable||!xulRuntime.shell) -- immutable-arraybuffer is not enabled unconditionally, requires shell-options
2+
// Copyright (C) 2025 Moddable Tech, Inc. All rights reserved.
3+
// This code is governed by the BSD license found in the LICENSE file.
4+
/*---
5+
description: verify immutable getter's length property attributes and value
6+
esid: sec-get-arraybuffer.prototype.immutable
7+
includes: [propertyHelper.js]
8+
features: [ArrayBuffer, immutable-arraybuffer]
9+
---*/
10+
11+
var desc = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'immutable');
12+
13+
verifyProperty(desc.get, 'length', {
14+
value: 0,
15+
enumerable: false,
16+
writable: false,
17+
configurable: true
18+
});
19+
20+
reportCompare(0, 0);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// |reftest| shell-option(--enable-arraybuffer-immutable) skip-if(!ArrayBuffer.prototype.sliceToImmutable||!xulRuntime.shell) -- immutable-arraybuffer is not enabled unconditionally, requires shell-options
2+
// Copyright (C) 2025 Moddable Tech, Inc. All rights reserved.
3+
// This code is governed by the BSD license found in the LICENSE file.
4+
/*---
5+
description: verify immutable getter's name property attributes and value
6+
esid: sec-get-arraybuffer.prototype.immutable
7+
includes: [propertyHelper.js]
8+
features: [ArrayBuffer, immutable-arraybuffer]
9+
---*/
10+
11+
var desc = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'immutable');
12+
13+
verifyProperty(desc.get, 'name', {
14+
value: 'get immutable',
15+
enumerable: false,
16+
writable: false,
17+
configurable: true
18+
});
19+
20+
reportCompare(0, 0);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// |reftest| shell-option(--enable-arraybuffer-immutable) skip-if(!ArrayBuffer.prototype.sliceToImmutable||!xulRuntime.shell) -- immutable-arraybuffer is not enabled unconditionally, requires shell-options
2+
// Copyright (C) 2025 Moddable Tech, Inc. All rights reserved.
3+
// This code is governed by the BSD license found in the LICENSE file.
4+
/*---
5+
description: immutable property has no setter
6+
esid: sec-get-arraybuffer.prototype.immutable
7+
includes: [propertyHelper.js]
8+
features: [ArrayBuffer, immutable-arraybuffer]
9+
---*/
10+
11+
var desc = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'immutable');
12+
13+
assert.sameValue(desc.set, undefined);
14+
assert.sameValue(typeof desc.get, 'function');
15+
16+
verifyProperty(ArrayBuffer.prototype, 'immutable', {
17+
enumerable: false,
18+
configurable: true
19+
});
20+
21+
reportCompare(0, 0);

0 commit comments

Comments
 (0)