Skip to content

[immutable-arraybuffer] ArrayBuffer.prototype.immutable#4541

Merged
gibson042 merged 5 commits into
tc39:mainfrom
gibson042:2025-07-immutable-arraybuffer-arraybuffer-prototype-immutable
May 6, 2026
Merged

[immutable-arraybuffer] ArrayBuffer.prototype.immutable#4541
gibson042 merged 5 commits into
tc39:mainfrom
gibson042:2025-07-immutable-arraybuffer-arraybuffer-prototype-immutable

Conversation

@gibson042

@gibson042 gibson042 commented Jul 18, 2025

Copy link
Copy Markdown
Member

Ref #4509

New ArrayBuffer.prototype properties

  • ArrayBuffer.prototype.immutable
    • getter-only accessor, enumerable false and configurable true
    • name "get immutable" and length 0
    • brand-checking (throws TypeError unless receiver is an ArrayBuffer and not a SharedArrayBuffer)
    • returns true for an immutable receiver and false for a non-immutable one
    • does not throw for a detached receiver

@gibson042
gibson042 requested review from a team as code owners July 18, 2025 16:52
@gibson042
gibson042 force-pushed the 2025-07-immutable-arraybuffer-arraybuffer-prototype-immutable branch 3 times, most recently from 4f01207 to c722f14 Compare July 18, 2025 19:31
Ms2ger
Ms2ger previously requested changes Aug 22, 2025

@Ms2ger Ms2ger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment thread test/built-ins/ArrayBuffer/prototype/immutable/prop-desc.js Outdated
@bakkot

bakkot commented Jan 15, 2026

Copy link
Copy Markdown
Member

@Ms2ger looks like your comment was addressed; should this now be "needs review" instead of "awaiting author"?

@ptomato ptomato left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to have the isHardened thing, and I have a suggestion for avoiding it. Otherwise all looks good.


assert.sameValue(desc.value, undefined);
assert.sameValue(desc.set, undefined);
verifyCallableProperty(desc, "get", "get immutable", 0, { configurable: !isHardened });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we wanted to isolate the accommodations for hardened JS environments (i.e. nonstandard) in the harness files as much as possible. Although verifyPrimordialCallableProperty doesn't seem quite right here, as desc.get isn't primordial.

That said, do we really need to check the configurable flag of desc.get here? If it's set incorrectly that seems more like an implementation issue with Object.getOwnPropertyDescriptor that should be covered in the tests for that API. So maybe assert.sameValue(typeof desc.get, "function") would be sufficient here.

WDYT?

@ptomato
ptomato dismissed Ms2ger’s stale review January 29, 2026 20:17

Comments addressed

gibson042 added a commit to gibson042/test262 that referenced this pull request May 6, 2026
gibson042 added a commit to gibson042/test262 that referenced this pull request May 6, 2026
@gibson042
gibson042 force-pushed the 2025-07-immutable-arraybuffer-arraybuffer-prototype-immutable branch from 177ec70 to 33559cb Compare May 6, 2026 21:58
@gibson042
gibson042 force-pushed the 2025-07-immutable-arraybuffer-arraybuffer-prototype-immutable branch from 33559cb to 906e368 Compare May 6, 2026 22:10
@gibson042
gibson042 merged commit fae11cb into tc39:main May 6, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants