From 590b3bb3a44f56809db6bd946bdbd90d90734781 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 2 Jun 2021 17:04:59 -0400 Subject: [PATCH 01/10] Add some operations bridging BufferSources and byte sequences --- index.bs | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/index.bs b/index.bs index 006099a8..a5522149 100644 --- a/index.bs +++ b/index.bs @@ -86,6 +86,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262 text: Set; url: sec-set-objects text: SharedArrayBuffer; url: sec-sharedarraybuffer-objects text: %AsyncIteratorPrototype%; url: sec-asynciteratorprototype + text: %ArrayBuffer%; url: sec-arraybuffer-constructor text: %Array.prototype%; url: sec-properties-of-the-array-prototype-object text: %Error.prototype%; url: sec-properties-of-the-error-prototype-object text: %Function.prototype%; url: sec-properties-of-the-function-prototype-object @@ -116,6 +117,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262 type: argument text: NewTarget; url: sec-built-in-function-objects type: abstract-op + text: AllocateArrayBuffer; url: sec-allocatearraybuffer text: ArrayCreate; url: sec-arraycreate text: Call; url: sec-call text: CanonicalNumericIndexString; url: sec-canonicalnumericindexstring @@ -167,6 +169,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262 text: SetFunctionName; url: sec-setfunctionname text: SetImmutablePrototype; url: sec-set-immutable-prototype text: SetIntegrityLevel; url: sec-setintegritylevel + text: SetValueInBuffer; url: sec-setvalueinbuffer text: ToBigInt; url: #sec-tobigint text: ToBoolean; url: sec-toboolean text: ToInt32; url: sec-toint32 @@ -179,6 +182,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262 text: ToUint16; url: sec-touint16 text: ToUint32; url: sec-touint32 text: Type; url: sec-ecmascript-data-types-and-values + text: TypedArrayCreate; url: typedarray-create text: abs; url: eqn-abs text: floor; url: eqn-floor text: max; url: eqn-max @@ -9019,10 +9023,40 @@ a reference to the same object that the IDL value represents.
- To detach an {{ArrayBuffer}}, these steps must be followed: + To detach an {{ArrayBuffer}} |ab|: - 1. Let |O| be the ECMAScript object that is the {{ArrayBuffer}}. - 1. Perform [=!=] DetachArrayBuffer(|O|). + 1. Perform [=!=] DetachArrayBuffer(|ab|). +
+ +
+ To write a [=byte sequence=] |bytes| into an {{ArrayBuffer}} + |ab|, optionally given a |startingOffset| (default 0): + + 1. Assert: |ab|.\[[ByteLength]] ≥ |startingOffset| + |bytes|'s [=byte sequence/length=]. + 1. For |i| in [=the range=] |startingOffset| to |startingOffset| + |bytes|'s [=byte + sequence/length=] − 1, inclusive, perform [=!=] [$SetValueInBuffer$](|ab|, |i|, Uint8, + |bytes|[|i|], false, Unordered). +
+ +
+ To create an {{ArrayBuffer}} from a [=byte sequence=] + |bytes| in a [=Realm=] |realm|: + + 1. Let |ab| be [=?=] [$AllocateArrayBuffer$](|realm|.\[[Intrinsics]].[[{{%ArrayBuffer%}}]], + |bytes|'s [=byte sequence/length=]). + 1. [=ArrayBuffer/Write=] |bytes| into |ab|. + 1. Return |ab|. +
+ +
+ To create one of the {{ArrayBufferView}} types from a + [=byte sequence=] |bytes| in a [=Realm=] |realm|: + + 1. Let |ab| be the result of [=ArrayBuffer/creating=] an {{ArrayBuffer}} from |bytes| in + |realm|. + 1. Let |constructor| be the appropriate constructor from |realm|.\[[Intrinsics]] for the type + of {{ArrayBufferView}} being created. + 1. Return [=!=] [$TypedArrayCreate$](|constructor|, « |ab| »).
@@ -14285,7 +14319,7 @@ A {{DOMException}} is represented by a
- To [=create=] a [=simple exception=] or {{DOMException}} |E|, with a string giving the + To create a [=simple exception=] or {{DOMException}} |E|, with a string giving the [=error name=] |N| for the {{DOMException}} case and optionally a string giving a user agent-defined message |M|: From 701e3dfa26f96eb27a725ac3465eff59163ef0e4 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Thu, 3 Jun 2021 11:42:44 -0400 Subject: [PATCH 02/10] Review comments --- index.bs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index a5522149..9a06e534 100644 --- a/index.bs +++ b/index.bs @@ -241,6 +241,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262 text: realm; url: realm text: ResolvedBinding Record; url: resolvedbinding-record text: running execution context; url: running-execution-context + text: element size; url: table-the-typedarray-constructors