Skip to content

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

Open
gibson042 wants to merge 2 commits intotc39:mainfrom
gibson042:2025-07-immutable-arraybuffer-arraybuffer-prototype-immutable
Open

[immutable-arraybuffer] ArrayBuffer.prototype.immutable#4541
gibson042 wants to merge 2 commits intotc39:mainfrom
gibson042:2025-07-immutable-arraybuffer-arraybuffer-prototype-immutable

Conversation

@gibson042
Copy link
Copy Markdown
Member

@gibson042 gibson042 commented Jul 18, 2025

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 2 times, most recently from d334aad to 4f01207 Compare July 18, 2025 19:26
@gibson042 gibson042 force-pushed the 2025-07-immutable-arraybuffer-arraybuffer-prototype-immutable branch from 4f01207 to c722f14 Compare July 18, 2025 19:31
Ms2ger
Ms2ger previously requested changes Aug 22, 2025
Copy link
Copy Markdown
Contributor

@Ms2ger Ms2ger left a comment

Choose a reason for hiding this comment

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

Thanks!

@bakkot
Copy link
Copy Markdown
Member

bakkot commented Jan 15, 2026

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

Copy link
Copy Markdown
Contributor

@ptomato ptomato left a comment

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

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