From 631316b8d513d414223de265b157153c032958c2 Mon Sep 17 00:00:00 2001
From: Cameron McCormack
@@ -1863,7 +1863,7 @@
+ The typed array types are
+ Int8Array,
+ Int16Array,
+ Int32Array,
+ Uint8Array,
+ Uint16Array,
+ Uint32Array,
+ Uint8ClampedArray,
+ Float32Array and
+ Float64Array.
+
+ The buffer source types
+ are ArrayBuffer,
+ DataView,
+ and the typed array types.
+
The object type,
all interface types
@@ -5085,20 +5132,21 @@
+ There are a number of types that correspond to sets of all possible non-null
+ references to objects that represent a buffer of data or a view on to a buffer of
+ data. The table below lists these types and the kind of buffer or view they represent.
+ These types all correspond to classes defined in ECMAScript.
+ To detach an ArrayBuffer
+ is to set its buffer pointer to null.
+
+ There is no way to represent a constant value of any of these types in IDL.
+
+ The type name of all
+ of these types is the name of the type itself.
+
+ At the specification prose level, IDL buffer source types
+ are simply references to objects. To inspect or manipulate the bytes inside the buffer,
+ specification prose MUST first either
+ get a reference to the bytes held by the buffer source
+ or get a copy of the bytes held by the buffer source.
+ With a reference to the buffer source’s bytes, specification prose can get or set individual
+ byte values using that reference.
+
+ Extreme care must be taken when writing specification text that gets a reference
+ to the bytes held by a buffer source, as the underyling data can easily be changed
+ by the script author or other APIs at unpredictable times. If you are using a buffer source type
+ as an operation argument to obtain a chunk of binary data that will not be modified,
+ it is strongly recommended to get a copy of the buffer source’s bytes at the beginning
+ of the prose defining the operation.
+
+ Requiring prose to explicitly get a reference to or copy of the bytes is intended to
+ help specification reviewers look for problematic uses of these buffer source types.
+
+ It is recommended to use the ArrayBuffer type rather than
+ Uint8Array to return a buffer of data from an API.
+
+ Attempting to get a reference to or
+ get a copy of the bytes held by a buffer source
+ when the ArrayBuffer has been detached
+ will fail in a language binding-specific manner.
+ See section 4.2.33 below for
+ how interacting with buffer source types works in the ECMAScript language binding. We should include an example of specification text that uses these types and terms.Status of This Document
Table of Contents
- 3.2.1. Constants
"false"[29] FloatLiteral → float
|
"-Infinity"
|
"Infinity"
|
- "NaN"[79] ConstType → PrimitiveType Null
|
+ "NaN"[80] ConstType → PrimitiveType Null
|
identifier Null3.2.3. Operations
"typedef"
|
"unrestricted"
- [90] ReturnType → Type
|
+ [91] ReturnType → Type
|
"void"3.2.4.3. Serializers
identifier Identifiers
|
ε[34] SerializationPatternList → "getter"
|
identifier Identifiers
|
- ε[92] Identifiers → "," identifier Identifiers
|
+ ε[93] Identifiers → "," identifier Identifiers
|
ε3.2.6. Overloading
Date
RegExp
exception types
+ buffer source types
boolean
@@ -3341,6 +3342,7 @@ 3.2.6. Overloading
●
●
●
+ ●
numeric types
@@ -3356,6 +3358,7 @@ 3.2.6. Overloading
●
●
●
+ ●
string types
@@ -3371,6 +3374,7 @@ 3.2.6. Overloading
●
●
●
+ ●
interface
@@ -3386,6 +3390,7 @@ 3.2.6. Overloading
●
●
●
+ ●
object
@@ -3401,6 +3406,7 @@ 3.2.6. Overloading
+
callback function
@@ -3416,6 +3422,7 @@ 3.2.6. Overloading
●
●
●
+ ●
dictionary
@@ -3431,6 +3438,7 @@ 3.2.6. Overloading
●
●
●
+ ●
sequence<T>
@@ -3446,6 +3454,7 @@ 3.2.6. Overloading
●
●
●
+ ●
T[]
@@ -3461,6 +3470,7 @@ 3.2.6. Overloading
●
●
●
+ ●
Date
@@ -3476,6 +3486,7 @@ 3.2.6. Overloading
●
●
+ ●
RegExp
@@ -3491,6 +3502,7 @@ 3.2.6. Overloading
●
+ ●
+ exception types
@@ -3506,6 +3518,23 @@ 3.2.6. Overloading
+ ●
+
+
buffer source types
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -5042,6 +5071,24 @@
3.10. Types
The exception types are
Error and DOMException.
+ 3.10. Types
"Date" TypeSuffix
|
"RegExp" TypeSuffix
|
"Error" TypeSuffix
|
- "DOMException" TypeSuffix[79] ConstType → PrimitiveType Null
|
- identifier Null[80] PrimitiveType → UnsignedIntegerType
|
+ "DOMException" TypeSuffix
|
+ BufferRelatedType TypeSuffix[80] ConstType → PrimitiveType Null
|
+ identifier Null[81] PrimitiveType → UnsignedIntegerType
|
UnrestrictedFloatType
|
"boolean"
|
"byte"
|
- "octet"[81] UnrestrictedFloatType → "unrestricted" FloatType
|
- FloatType[82] FloatType → "float"
|
- "double"[83] UnsignedIntegerType → "unsigned" IntegerType
|
- IntegerType[84] IntegerType → "short"
|
- "long" OptionalLong[85] OptionalLong → "long"
|
- ε[86] PromiseType → "Promise" "<" ReturnType ">" [87] TypeSuffix → "[" "]" TypeSuffix
|
+ "octet"[82] UnrestrictedFloatType → "unrestricted" FloatType
|
+ FloatType[83] FloatType → "float"
|
+ "double"[84] UnsignedIntegerType → "unsigned" IntegerType
|
+ IntegerType[85] IntegerType → "short"
|
+ "long" OptionalLong[86] OptionalLong → "long"
|
+ ε[87] PromiseType → "Promise" "<" ReturnType ">" [88] TypeSuffix → "[" "]" TypeSuffix
|
"?" TypeSuffixStartingWithArray
|
- ε[88] TypeSuffixStartingWithArray → "[" "]" TypeSuffix
|
- ε[89] Null → "?"
|
+ ε[89] TypeSuffixStartingWithArray → "[" "]" TypeSuffix
|
+ ε[90] Null → "?"
|
ε3.10.27. Union types
"Date" TypeSuffix
|
"RegExp" TypeSuffix
|
"Error" TypeSuffix
|
- "DOMException" TypeSuffix
+ "DOMException" TypeSuffix
|
+ BufferRelatedType TypeSuffix
3.10.31. DOMException
DOMException type is “DOMException”.
3.10.32. Buffer source types
+
+
+
+
+ Type Kind of buffer
+ ArrayBuffer An object that holds a pointer (which may be null) to a buffer of a fixed number of bytes
+ DataView A view on to an ArrayBuffer that allows typed access to integers and floating point values stored at arbitrary offsets into the buffer
+
+ Int8Array,
+
+ Int16Array,
+ Int32ArrayA view on to an ArrayBuffer that exposes it as an array of two’s complement signed integers of the given size in bits
+
+ Uint8Array,
+
+ Uint16Array,
+ Uint32ArrayA view on to an ArrayBuffer that exposes it as an array of unsigned integers of the given size in bits
+ Uint8ClampedArray
+ A view on to an ArrayBuffer that exposes it as an array of unsigned 8 bit integers with clamped conversions
+
+ Float32Array,
+
+ Float64ArrayA view on to an ArrayBuffer that exposes it as an array of IEEE 754 floating point numbers of the given size in bits 3.11. Extended attributes
"void"
|
ArgumentNameKeyword
+
|
+ BufferRelatedType
[72] OtherOrComma → Other
|
- ","[91] IdentifierList → identifier Identifiers [92] Identifiers → "," identifier Identifiers
|
- ε[93] ExtendedAttributeNoArgs → identifier [94] ExtendedAttributeArgList → identifier "(" ArgumentList ")" [95] ExtendedAttributeIdent → identifier "=" identifier [96] ExtendedAttributeIdentList → identifier "=" "(" IdentifierList ")"
+ ","[97] ExtendedAttributeNamedArgList → identifier "=" identifier "(" ArgumentList ")" [92] IdentifierList → identifier Identifiers [93] Identifiers → "," identifier Identifiers
|
+ ε[94] ExtendedAttributeNoArgs → identifier [95] ExtendedAttributeArgList → identifier "(" ArgumentList ")" [96] ExtendedAttributeIdent → identifier "=" identifier [97] ExtendedAttributeIdentList → identifier "=" "(" IdentifierList ")" [98] ExtendedAttributeNamedArgList → identifier "=" identifier "(" ArgumentList ")" 4.2.28. Union types
that is a reference to the object V.
+
+
+
+
+
+
+
@@ -8511,6 +8680,102 @@
4.2.32. DOMException
IDL DOMException represents.
+ Values of the IDL buffer source types + are represented by objects of the corresponding ECMAScript class. +
++ An ECMAScript value V is + converted + to an IDL ArrayBuffer value + by running the following algorithm: +
++ An ECMAScript value V is + converted + to an IDL DataView value + by running the following algorithm: +
++ An ECMAScript value V is + converted + to an IDL Int8Array, + Int16Array, + Int32Array, + Uint8Array, + Uint16Array, + Uint32Array, + Uint8ClampedArray, + Float32Array or + Float64Array value + by running the following algorithm: +
++ The result of converting + an IDL value of any buffer source type + to an ECMAScript value is the Object value that represents + a reference to the same object that the IDL value represents. +
++ When getting a reference to + or getting a copy of the bytes held by a buffer source + that is an ECMAScript ArrayBuffer, DataView + or typed array object, these steps MUST be followed: +
++ To detach an ArrayBuffer, + these steps MUST be followed: +
+typedef (Int8Array or Int16Array or Int32Array or
+ Uint8Array or Uint16Array or Uint32Array or Uint8ClampedArray or
+ Float32Array or Float64Array or DataView) ArrayBufferView;
+ The ArrayBufferView typedef is used to represent + objects that provide a view on to an ArrayBuffer. +
+typedef (ArrayBuffer or ArrayBufferView) ArrayBufferData;
typedef (ArrayBufferData or ArrayBuffer) BufferSource;
- The ArrayBufferData typedef is used to represent - data that comes ultimately from an ArrayBuffer. - Specifications should use this typedef rather than duplicating the union type. + The BufferSource typedef is used to represent objects + that are either themselves an ArrayBuffer or which + provide a view on to an ArrayBuffer.
typedef unsigned long long DOMTimeStamp;
@@ -14088,7 +14405,7 @@
callback Function = any (any... arguments);
@@ -14099,7 +14416,7 @@
callback VoidFunction = void ();
@@ -14483,6 +14800,8 @@
The Other @@ -14760,6 +15090,12 @@
+ Added types for ArrayBuffer, DataView + and typed array objects. +
+Added USVString and allowed string literals in IDL to @@ -14884,11 +15220,6 @@
- Added a ArrayBufferData typedef. -
-
Added a way to mark dictionary members as required.
diff --git a/index.xml b/index.xml
index 632c878f..ce316c46 100644
--- a/index.xml
+++ b/index.xml
@@ -119,6 +119,10 @@
href='https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate'/>
+ The typed array types are + Int8Array, + Int16Array, + Int32Array, + Uint8Array, + Uint16Array, + Uint32Array, + Uint8ClampedArray, + Float32Array and + Float64Array. +
++ The buffer source types + are ArrayBuffer, + DataView, + and the typed array types. +
The object type, all interface types @@ -5945,6 +5996,93 @@ interface Person { DOMException type is “DOMException”.
+ There are a number of types that correspond to sets of all possible non-null + references to objects that represent a buffer of data or a view on to a buffer of + data. The table below lists these types and the kind of buffer or view they represent. +
+Type | Kind of buffer |
---|---|
ArrayBuffer | An object that holds a pointer (which may be null) to a buffer of a fixed number of bytes |
DataView | A view on to an ArrayBuffer that allows typed access to integers and floating point values stored at arbitrary offsets into the buffer |
+ Int8Array, + Int16Array, + Int32Array |
+ A view on to an ArrayBuffer that exposes it as an array of two’s complement signed integers of the given size in bits |
+ Uint8Array, + Uint16Array, + Uint32Array |
+ A view on to an ArrayBuffer that exposes it as an array of unsigned integers of the given size in bits |
Uint8ClampedArray | +A view on to an ArrayBuffer that exposes it as an array of unsigned 8 bit integers with clamped conversions |
+ Float32Array, + Float64Array |
+ A view on to an ArrayBuffer that exposes it as an array of IEEE 754 floating point numbers of the given size in bits |
These types all correspond to classes defined in ECMAScript.
++ To detach an ArrayBuffer + is to set its buffer pointer to null. +
++ There is no way to represent a constant value of any of these types in IDL. +
++ The type name of all + of these types is the name of the type itself. +
++ At the specification prose level, IDL buffer source types + are simply references to objects. To inspect or manipulate the bytes inside the buffer, + specification prose MUST first either + get a reference to the bytes held by the buffer source + or get a copy of the bytes held by the buffer source. + With a reference to the buffer source’s bytes, specification prose can get or set individual + byte values using that reference. +
++ Extreme care must be taken when writing specification text that gets a reference + to the bytes held by a buffer source, as the underyling data can easily be changed + by the script author or other APIs at unpredictable times. If you are using a buffer source type + as an operation argument to obtain a chunk of binary data that will not be modified, + it is strongly recommended to get a copy of the buffer source’s bytes at the beginning + of the prose defining the operation. +
++ Requiring prose to explicitly get a reference to or copy of the bytes is intended to + help specification reviewers look for problematic uses of these buffer source types. +
++ It is recommended to use the ArrayBuffer type rather than + Uint8Array to return a buffer of data from an API. +
++ Attempting to get a reference to or + get a copy of the bytes held by a buffer source + when the ArrayBuffer has been detached + will fail in a language binding-specific manner. +
+See section below for + how interacting with buffer source types works in the ECMAScript language binding.
+We should include an example of specification text that uses these types and terms.
++ Values of the IDL buffer source types + are represented by objects of the corresponding ECMAScript class. +
++ An ECMAScript value V is + converted + to an IDL ArrayBuffer value + by running the following algorithm: +
++ An ECMAScript value V is + converted + to an IDL DataView value + by running the following algorithm: +
++ An ECMAScript value V is + converted + to an IDL Int8Array, + Int16Array, + Int32Array, + Uint8Array, + Uint16Array, + Uint32Array, + Uint8ClampedArray, + Float32Array or + Float64Array value + by running the following algorithm: +
++ The result of converting + an IDL value of any buffer source type + to an ECMAScript value is the Object value that represents + a reference to the same object that the IDL value represents. +
++ When getting a reference to + or getting a copy of the bytes held by a buffer source + that is an ECMAScript ArrayBuffer, DataView + or typed array object, these steps MUST be followed: +
++ To detach an ArrayBuffer, + these steps MUST be followed: +
++ The ArrayBufferView typedef is used to represent + objects that provide a view on to an ArrayBuffer. +
+- The ArrayBufferData typedef is used to represent - data that comes ultimately from an ArrayBuffer. - Specifications should use this typedef rather than duplicating the union type. + The BufferSource typedef is used to represent objects + that are either themselves an ArrayBuffer or which + provide a view on to an ArrayBuffer.
+ Added types for ArrayBuffer, DataView + and typed array objects. +
+Added USVString and allowed string literals in IDL to @@ -14710,11 +15035,6 @@ d.type = et; functions, and all interface types.
- Added a ArrayBufferData typedef. -
-Added a way to mark dictionary members as required. diff --git a/v1.html b/v1.html index e49bdd6d..2b7a2603 100644 --- a/v1.html +++ b/v1.html @@ -19,7 +19,7 @@
-Copyright © 2014 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.
- This document is the 3 October 2014 Editor’s Draft of the + This document is the 4 October 2014 Editor’s Draft of the Web IDL specification. Please send comments about this document to @@ -146,7 +146,7 @@
typedef (ArrayBuffer or ArrayBufferView) ArrayBufferData;
- The ArrayBufferData typedef is used to represent - data that comes ultimately from an ArrayBuffer. - Specifications should use this typedef rather than duplicating the union type. -
-typedef unsigned long long DOMTimeStamp;
@@ -11642,7 +11631,7 @@
callback Function = any (any... arguments);
@@ -11653,7 +11642,7 @@
callback VoidFunction = void ();
@@ -12252,11 +12241,6 @@
- Added a ArrayBufferData typedef. -
-Added a way to mark dictionary members as required. diff --git a/v1.xml b/v1.xml index e175af29..80612ccb 100644 --- a/v1.xml +++ b/v1.xml @@ -11449,17 +11449,6 @@ d.type = et; MUST support.
-- The ArrayBufferData typedef is used to represent - data that comes ultimately from an ArrayBuffer. - Specifications should use this typedef rather than duplicating the union type. -
-- Added a ArrayBufferData typedef. -
-Added a way to mark dictionary members as required.