Home

Awesome

Limited ArrayBuffer

Status

Champion(s): Jack Works

Author(s): Jack Works

Stage: 1

Presentations

Problem to be resolved

All of the following are helpful to archive the minimal permission/information principle.

  1. Cannot make an ArrayBuffer read-only.
  2. Cannot give others a read-only view to the ArrayBuffer and keep the read-write permission internally.
  3. Cannot give others a view that range limited (only a small area of the whole buffer is visible).

Design goal

  1. Freeze the ArrayBuffer.
    1. Like Object.freeze, there is no way back once frozen.
    2. Any TypedArray/DataView to the freezed ArrayBuffer is read-only too.
    3. [Optional] Keep frozen when sent across Realm (HTML intergration).
  2. Read-only TypedArray/DataView to a read-write ArrayBuffer.
    1. Must not be able to construct a read-write view from a read-only view.
  3. [Optional] Range-limited TypedArray/DataView to a read-write ArrayBuffer (CrimsonCodes0's use case on WebAssembly).
    1. Must not be able to construct a bigger view range from a smaller view range.
  4. Not adding too much complexity to the implementor.

Pros

  1. Minimal permission/information principle works on ArrayBuffer.
  2. Embedded JS engines can represent ROMs as read-only ArrayBuffer.

API design

See design.md