Limited ArrayBuffer
Status
Champion(s): Jack Works
Author(s): Jack Works
Stage: 1
Presentations
Problem
All of the following are helpful to archive the minimal permission/information principle.
- Cannot make an
ArrayBuffer
read-only. - Cannot give others a read-only view to the
ArrayBuffer
and keep the read-write permission internally. - Cannot give others a view that range limited (only a small area of the whole buffer is visible).
Design goal
- Freeze the
ArrayBuffer
.- Like
Object.freeze
, there is no way back once frozen. - Any
TypedArray
/DataView
to the freezedArrayBuffer
is read-only too. - [Optional] Keep frozen when sent across Realm (HTML intergration).
- Like
- Read-only
TypedArray
/DataView
to a read-writeArrayBuffer
.- Must not be able to construct a read-write view from a read-only view.
- [Optional] Range-limited
TypedArray
/DataView
to a read-writeArrayBuffer
(CrimsonCodes0's use case on WebAssembly).- Must not be able to construct a bigger view range from a smaller view range.
- Not adding too much complexity to the implementor.
Pros
- Minimal permission/information principle works on
ArrayBuffer
. - Embedded JS engines can represent ROMs as read-only
ArrayBuffer
.
Possible API design
TBD.
Need re-design to integrate with read-only collections proposal.