Skip to content

Terminology "empty array" is incorrect for BufferSource #592

@xhwang-chromium

Description

@xhwang-chromium

Created with the help of AI.

Problem Description:
Throughout the specification, algorithms checking for zero-length BufferSource parameters (such as ArrayBuffer or Uint8Array) use the phrase "is an empty array". This is technically incorrect and inconsistent with WebIDL and modern specification standards.

A BufferSource is a union type of (ArrayBufferView or ArrayBuffer). Neither of these types are technically "arrays" in WebIDL or JavaScript. They do not have an "empty" state in the way a sequence or a JS Array might; rather, they are defined by their content length (byte length). Referring to them as "empty arrays" is confusing and technically inaccurate.

Affected Locations:

  1. Section 5.1 setServerCertificate() Step 2:

    "If serverCertificate is an empty array, return a promise rejected with a new a newly created TypeError."

  2. Section 6.2 generateRequest() Step 5:

    "If initData is an empty array, return a promise rejected with a newly created TypeError."

  3. Section 6.2 update() Step 3:

    "If response is an empty array, return a promise rejected with a newly created TypeError."

Historical Context
BufferSource was introduced to EME in
0666263. However, the "empty array" terminology existed before this change.

Reference to Standards:
Modern specifications handle BufferSource inputs by utilizing the Web IDL algorithm for getting a copy of the bytes held by the buffer source. This converts the input into an Infra byte sequence, which can then be checked for "emptiness."

Suggested Fix:
Update the identified steps to use the standard Web IDL terminology for processing BufferSource data:

  1. Let buffer be the result of getting a copy of the bytes held by the [parameter name] parameter.
  2. If buffer is empty, return a promise rejected with a newly created TypeError.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions