-
Notifications
You must be signed in to change notification settings - Fork 511
[immutable-arraybuffer] TypedArray internal operations #4551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
5e52386
9ddc77e
f01eb9f
7da66e0
cd179fb
4f3ed60
7aa51fb
3b45d8f
2dae60b
4099271
bcb0f2a
c5eea26
9af9c7c
5aa7097
7e0ee2a
69de3a0
6afaaa0
94c4b3d
9509fe3
1957be1
9b0009c
2b74ee6
67ec3f1
a52f22b
5aa89fb
d6bdfb6
bc7d92b
01675ce
795f516
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Copyright (C) 2025 Richard Gibson. All rights reserved. | ||
| // This code is governed by the BSD license found in the LICENSE file. | ||
|
|
||
| /*--- | ||
| esid: sec-typedarray-getownproperty | ||
| description: > | ||
| When the backing buffer is immutable, properties for in-bounds indexes are | ||
| associated with non-configurable non-writable descriptors. | ||
| info: | | ||
| [[GetOwnProperty]] ( P ) | ||
| 1. If P is a String, then | ||
| a. Let numericIndex be CanonicalNumericIndexString(P). | ||
| b. If numericIndex is not undefined, then | ||
| i. Let value be TypedArrayGetElement(O, numericIndex). | ||
| ii. If value is undefined, return undefined. | ||
| iii. Let mutable be true. | ||
| iv. If IsImmutableBuffer(O.[[ViewedArrayBuffer]]) is true, set mutable to false. | ||
| v. Return the PropertyDescriptor { [[Value]]: value, [[Writable]]: true mutable, | ||
| [[Enumerable]]: true, [[Configurable]]: true mutable }. | ||
| features: [TypedArray, immutable-arraybuffer] | ||
| includes: [testTypedArray.js, compareArray.js, propertyHelper.js] | ||
| ---*/ | ||
|
|
||
| testWithAllTypedArrayConstructors(function(TA, makeCtorArg) { | ||
| var sample = new TA(makeCtorArg(["42", "43"])); | ||
|
|
||
| var value0 = sample[0]; | ||
| var value1 = sample[1]; | ||
| assert.compareArray([String(value0), String(value1)], ["42", "43"]); | ||
|
|
||
| verifyProperty(sample, "0", { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that The current version of the test seems to be lucky to pass despite the usage of |
||
| value: value0, | ||
| configurable: false, | ||
| enumerable: true, | ||
| writable: false | ||
| }); | ||
| verifyProperty(sample, "1", { | ||
| value: value1, | ||
| configurable: false, | ||
| enumerable: true, | ||
| writable: false | ||
| }); | ||
| }, null, ["immutable"]); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other tests in the same directory do not test
BigInttyped arrays i.e. usetestWithTypedArrayConstructorsinstead oftestWithAllTypedArrayConstructors(and contain a variant withtestWithBigIntTypedArrayConstructorsinBigIntsub-directory).