From 631316b8d513d414223de265b157153c032958c2 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Sat, 4 Oct 2014 18:24:26 +1000 Subject: [PATCH] Add types for ArrayBuffer, DataView and typed array objects. --- WebIDL.css | 3 + WebIDL.xsl | 2 +- index.html | 419 +++++++++++++++++++++++++++++++++++++++++++++++------ index.xml | 344 +++++++++++++++++++++++++++++++++++++++++-- v1.html | 28 +--- v1.xml | 16 -- 6 files changed, 717 insertions(+), 95 deletions(-) diff --git a/WebIDL.css b/WebIDL.css index ac64ed40..ad7fbe8c 100644 --- a/WebIDL.css +++ b/WebIDL.css @@ -330,6 +330,9 @@ iframe { #distinguishable-table td { text-align: center; } +#distinguishable-table th:first-child { + white-space: nowrap; +} .matrix { border-collapse: collapse; margin-left: auto; diff --git a/WebIDL.xsl b/WebIDL.xsl index df60ca9e..48cbdcbf 100644 --- a/WebIDL.xsl +++ b/WebIDL.xsl @@ -60,7 +60,7 @@ - + diff --git a/index.html b/index.html index 7d604662..89e5cf14 100644 --- a/index.html +++ b/index.html @@ -124,7 +124,7 @@

Status of This Document

Table of Contents

-
+
@@ -1279,7 +1279,7 @@

3.2.1. Constants

"false"[29]FloatLiteralfloat
 | "-Infinity"
 | "Infinity"
 | - "NaN"
[79]ConstTypePrimitiveType Null
 | + "NaN"
[80]ConstTypePrimitiveType Null
 | identifier Null
Example

@@ -1863,7 +1863,7 @@

3.2.3. Operations

"typedef"
 | "unrestricted" - [90]ReturnTypeType
 | +
[91]ReturnTypeType
 | "void"
@@ -2529,7 +2529,7 @@
3.2.4.3. Serializers
identifier Identifiers
 | ε[34]SerializationPatternList"getter"
 | identifier Identifiers
 | - ε
[92]Identifiers"," identifier Identifiers
 | + ε
[93]Identifiers"," identifier Identifiers
 | ε
Example
@@ -3326,6 +3326,7 @@

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.

    +

    + 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 @@

    3.10. Types

    "Date" TypeSuffix
     | "RegExp" TypeSuffix
     | "Error" TypeSuffix
     | - "DOMException" TypeSuffix[79]ConstTypePrimitiveType Null
     | - identifier Null
    [80]PrimitiveTypeUnsignedIntegerType
     | + "DOMException" TypeSuffix
     | + BufferRelatedType TypeSuffix
    [80]ConstTypePrimitiveType Null
     | + identifier Null
    [81]PrimitiveTypeUnsignedIntegerType
     | 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"?"
     | ε
    @@ -5969,7 +6017,8 @@

    3.10.27. Union types

    "Date" TypeSuffix
     | "RegExp" TypeSuffix
     | "Error" TypeSuffix
     | - "DOMException" TypeSuffix + "DOMException" TypeSuffix
     | + BufferRelatedType TypeSuffix
    @@ -6050,6 +6099,93 @@

    3.10.31. DOMException

    DOMException type is “DOMException”.

    + +
    +

    3.10.32. Buffer source types

    + +

    + 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. +

    + + + + + + + + + + + + +
    TypeKind of buffer
    ArrayBufferAn object that holds a pointer (which may be null) to a buffer of a fixed number of bytes
    DataViewA 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
    Uint8ClampedArrayA 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
    +
    Note
    +

    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. +

    +
    Warning
    +

    + 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. +

    +
    +
    Note
    +

    + 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. +

    +
    Note
    +

    See section 4.2.33 below for + how interacting with buffer source types works in the ECMAScript language binding.

    +
    +
    Editorial note
    +

    We should include an example of specification text that uses these types and terms.

    +
    +
@@ -8279,6 +8417,37 @@

4.2.28. Union types

that is a reference to the object V. +
  • + If V is an object with an [[ArrayBufferData]] internal slot, then: +
      +
    1. If types includes ArrayBuffer, then return the + result of converting + V to ArrayBuffer.
    2. +
    3. If types includes object, then return the IDL value + that is a reference to the object V.
    4. +
    +
  • +
  • + If V is an object with a [[DataView]] internal slot, then: +
      +
    1. If types includes DataView, then return the + result of converting + V to DataView.
    2. +
    3. If types includes object, then return the IDL value + that is a reference to the object V.
    4. +
    +
  • +
  • + If V is an object with a [[TypedArrayName]] internal slot, then: +
      +
    1. If types includes a typed array type + whose name is the value of V’s [[TypedArrayName]] internal slot, then return the + result of converting + V to that type.
    2. +
    3. If types includes object, then return the IDL value + that is a reference to the object V.
    4. +
    +
  • If IsCallable(V) is true, then:
      @@ -8511,6 +8680,102 @@

      4.2.32. DOMException

      IDL DOMException represents.

      + +
      +

      4.2.33. Buffer source types

      + +

      + 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: +

      +
        +
      1. If Type(V) is not Object, + or V does not have an [[ArrayBufferData]] internal slot, + then throw a TypeError.
      2. +
      3. Return the IDL ArrayBuffer value that is a reference to the same object as V.
      4. +
      +

      + An ECMAScript value V is + converted + to an IDL DataView value + by running the following algorithm: +

      +
        +
      1. If Type(V) is not Object, + or V does not have a [[DataView]] internal slot, + then throw a TypeError.
      2. +
      3. Return the IDL DataView value that is a reference to the same object as V.
      4. +
      +

      + 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: +

      +
        +
      1. Let T be the IDL type V is being converted to.
      2. +
      3. If Type(V) is not Object, + or V does not have a [[TypedArrayName]] internal slot + with a value equal to the name of T, + then throw a TypeError.
      4. +
      5. Return the IDL value of type T that is a reference to the same object as V.
      6. +
      +

      + 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: +

      +
        +
      1. Let O be the ECMAScript object that is the buffer source.
      2. +
      3. Initialize arrayBuffer to O.
      4. +
      5. Initialize offset to 0.
      6. +
      7. Initialize length to 0.
      8. +
      9. If O has a [[ViewedArrayBuffer]] internal slot, then: +
          +
        1. Set arrayBuffer to the value of O’s [[ViewedArrayBuffer]] internal slot.
        2. +
        3. If arrayBuffer is undefined, then + throw a TypeError.
        4. +
        5. Set offset to the value of O’s [[ByteOffset]] internal slot.
        6. +
        7. Set length to the value of O’s [[ByteLength]] internal slot.
        8. +
        +
      10. +
      11. Otherwise, set length to the value of O’s [[ArrayBufferByteLength]] internal slot.
      12. +
      13. If IsDetachedBuffer(O), then + throw a TypeError.
      14. +
      15. Let data be the value of O’s [[ArrayBufferData]] internal slot.
      16. +
      17. Return a reference to or copy of (as required) the length bytes in data + starting at byte offset offset.
      18. +
      +

      + To detach an ArrayBuffer, + these steps MUST be followed: +

      +
        +
      1. Let O be the ECMAScript object that is the ArrayBuffer.
      2. +
      3. DetachArrayBuffer(O).
      4. +
      +
      @@ -10611,6 +10876,46 @@
      4.5.1.1. Interface object [[Call]] method
      then remove from S all other entries. +
    1. + Otherwise: if V is an object with an [[ArrayBufferData]] internal slot and + there is an entry in S that has one of the following types at position i of its type list, + + then remove from S all other entries. +
    2. + +
    3. + Otherwise: if V is an object with a [[DataView]] internal slot and + there is an entry in S that has one of the following types at position i of its type list, + + then remove from S all other entries. +
    4. + +
    5. + Otherwise: if V is an object with a [[TypedArrayName]] internal slot and + there is an entry in S that has one of the following types at position i of its type list, + + then remove from S all other entries. +
    6. +
    7. Otherwise: if IsCallable(V) is true, and there is an entry in S that has one of the following types at position i of its type list, @@ -14064,19 +14369,31 @@

      5. Common definitions

      MUST support.

      -
      -

      5.1. ArrayBufferData

      +
      +

      5.1. ArrayBufferView

      + +
      IDL
      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. +

      +
      + +
      +

      5.2. BufferSource

      -
      IDL
      typedef (ArrayBuffer or ArrayBufferView) ArrayBufferData;
      +
      IDL
      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.

      -

      5.2. DOMTimeStamp

      +

      5.3. DOMTimeStamp

      IDL
      typedef unsigned long long DOMTimeStamp;

      @@ -14088,7 +14405,7 @@

      5.2. DOMTimeStamp

      -

      5.3. Function

      +

      5.4. Function

      IDL
      callback Function = any (any... arguments);

      @@ -14099,7 +14416,7 @@

      5.3. Function

      -

      5.4. VoidFunction

      +

      5.5. VoidFunction

      IDL
      callback VoidFunction = void ();

      @@ -14483,6 +14800,8 @@

      A. IDL grammar

      "void"
       | ArgumentNameKeyword +
       | + BufferRelatedType [71]ArgumentNameKeyword "attribute"
       | "callback"
       | @@ -14528,23 +14847,34 @@

      A. IDL grammar

      "Date" TypeSuffix
       | "RegExp" TypeSuffix
       | "Error" TypeSuffix
       | - "DOMException" TypeSuffix
      [79]ConstTypePrimitiveType Null
       | - identifier Null
      [80]PrimitiveTypeUnsignedIntegerType
       | + "DOMException" TypeSuffix
       | + BufferRelatedType TypeSuffix
      [79]BufferRelatedType"ArrayBuffer"
       | + "DataView"
       | + "Int8Array"
       | + "Int161Array"
       | + "Int32Array"
       | + "Uint8Array"
       | + "Uint16Array"
       | + "Uint32Array"
       | + "Uint8ClampedArray"
       | + "Float32Array"
       | + "Float64Array"
      [80]ConstTypePrimitiveType Null
       | + identifier Null
      [81]PrimitiveTypeUnsignedIntegerType
       | 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"?"
       | - ε
      [90]ReturnTypeType
       | - "void"
      [91]IdentifierListidentifier Identifiers[92]Identifiers"," identifier Identifiers
       | - ε
      [93]ExtendedAttributeNoArgsidentifier[94]ExtendedAttributeArgListidentifier "(" ArgumentList ")"[95]ExtendedAttributeIdentidentifier "=" identifier[96]ExtendedAttributeIdentListidentifier "=" "(" IdentifierList ")"[97]ExtendedAttributeNamedArgListidentifier "=" identifier "(" ArgumentList ")" + ε[89]TypeSuffixStartingWithArray"[" "]" TypeSuffix
       | + ε
      [90]Null"?"
       | + ε
      [91]ReturnTypeType
       | + "void"
      [92]IdentifierListidentifier Identifiers[93]Identifiers"," identifier Identifiers
       | + ε
      [94]ExtendedAttributeNoArgsidentifier[95]ExtendedAttributeArgListidentifier "(" ArgumentList ")"[96]ExtendedAttributeIdentidentifier "=" identifier[97]ExtendedAttributeIdentListidentifier "=" "(" IdentifierList ")"[98]ExtendedAttributeNamedArgListidentifier "=" identifier "(" ArgumentList ")"
      Note

      The Other @@ -14760,6 +15090,12 @@

      C. Changes

      Current editor’s draft
        +
      • +

        + Added types for ArrayBuffer, DataView + and typed array objects. +

        +
      • Added USVString and allowed string literals in IDL to @@ -14884,11 +15220,6 @@

        C. Changes

        functions, and all interface types.

      • -
      • -

        - 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'/> + + @@ -3281,6 +3285,7 @@ partial interface A { Date RegExp exception types + buffer source types boolean @@ -3296,6 +3301,7 @@ partial interface A { ● ● ● + ● numeric types @@ -3311,6 +3317,7 @@ partial interface A { ● ● ● + ● string types @@ -3326,6 +3333,7 @@ partial interface A { ● ● ● + ● interface @@ -3341,6 +3349,7 @@ partial interface A { ● ● ● + ● object @@ -3356,6 +3365,7 @@ partial interface A { + callback function @@ -3371,6 +3381,7 @@ partial interface A { ● ● ● + ● dictionary @@ -3386,6 +3397,7 @@ partial interface A { ● ● ● + ● sequence<T> @@ -3401,6 +3413,7 @@ partial interface A { ● ● ● + ● T[] @@ -3416,6 +3429,7 @@ partial interface A { ● ● ● + ● Date @@ -3431,6 +3445,7 @@ partial interface A { ● ● + ● RegExp @@ -3446,6 +3461,7 @@ partial interface A { ● + ● exception types @@ -3461,6 +3477,23 @@ partial interface A { + ● + + + buffer source types + + + + + + + + + + + + +

          @@ -4981,6 +5014,24 @@ interface Person { The exception types are Error and DOMException.

          +

          + 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”.

      + +
      +

      Buffer source types

      + +

      + 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. +

      + + + + + + + + + + + + +
      TypeKind of buffer
      ArrayBufferAn object that holds a pointer (which may be null) to a buffer of a fixed number of bytes
      DataViewA 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
      Uint8ClampedArrayA 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.

      +
      +
      @@ -8110,6 +8248,37 @@ results.numbers.length; // So this still evaluates t that is a reference to the object V.
  • +
  • + If V is an object with an [[ArrayBufferData]] internal slot, then: +
      +
    1. If types includes ArrayBuffer, then return the + result of converting + V to ArrayBuffer.
    2. +
    3. If types includes object, then return the IDL value + that is a reference to the object V.
    4. +
    +
  • +
  • + If V is an object with a [[DataView]] internal slot, then: +
      +
    1. If types includes DataView, then return the + result of converting + V to DataView.
    2. +
    3. If types includes object, then return the IDL value + that is a reference to the object V.
    4. +
    +
  • +
  • + If V is an object with a [[TypedArrayName]] internal slot, then: +
      +
    1. If types includes a typed array type + whose name is the value of V’s [[TypedArrayName]] internal slot, then return the + result of converting + V to that type.
    2. +
    3. If types includes object, then return the IDL value + that is a reference to the object V.
    4. +
    +
  • If IsCallable(V) is true, then:
      @@ -8343,6 +8512,102 @@ results.numbers.length; // So this still evaluates t IDL DOMException represents.

      + +
      +

      Buffer source types

      + +

      + 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: +

      +
        +
      1. If Type(V) is not Object, + or V does not have an [[ArrayBufferData]] internal slot, + then throw a TypeError.
      2. +
      3. Return the IDL ArrayBuffer value that is a reference to the same object as V.
      4. +
      +

      + An ECMAScript value V is + converted + to an IDL DataView value + by running the following algorithm: +

      +
        +
      1. If Type(V) is not Object, + or V does not have a [[DataView]] internal slot, + then throw a TypeError.
      2. +
      3. Return the IDL DataView value that is a reference to the same object as V.
      4. +
      +

      + 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: +

      +
        +
      1. Let T be the IDL type V is being converted to.
      2. +
      3. If Type(V) is not Object, + or V does not have a [[TypedArrayName]] internal slot + with a value equal to the name of T, + then throw a TypeError.
      4. +
      5. Return the IDL value of type T that is a reference to the same object as V.
      6. +
      +

      + 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: +

      +
        +
      1. Let O be the ECMAScript object that is the buffer source.
      2. +
      3. Initialize arrayBuffer to O.
      4. +
      5. Initialize offset to 0.
      6. +
      7. Initialize length to 0.
      8. +
      9. If O has a [[ViewedArrayBuffer]] internal slot, then: +
          +
        1. Set arrayBuffer to the value of O’s [[ViewedArrayBuffer]] internal slot.
        2. +
        3. If arrayBuffer is undefined, then + throw a TypeError.
        4. +
        5. Set offset to the value of O’s [[ByteOffset]] internal slot.
        6. +
        7. Set length to the value of O’s [[ByteLength]] internal slot.
        8. +
        +
      10. +
      11. Otherwise, set length to the value of O’s [[ArrayBufferByteLength]] internal slot.
      12. +
      13. If IsDetachedBuffer(O), then + throw a TypeError.
      14. +
      15. Let data be the value of O’s [[ArrayBufferData]] internal slot.
      16. +
      17. Return a reference to or copy of (as required) the length bytes in data + starting at byte offset offset.
      18. +
      +

      + To detach an ArrayBuffer, + these steps MUST be followed: +

      +
        +
      1. Let O be the ECMAScript object that is the ArrayBuffer.
      2. +
      3. DetachArrayBuffer(O).
      4. +
      +
      @@ -10443,6 +10708,46 @@ with (thing) { then remove from S all other entries. +
    1. + Otherwise: if V is an object with an [[ArrayBufferData]] internal slot and + there is an entry in S that has one of the following types at position i of its type list, + + then remove from S all other entries. +
    2. + +
    3. + Otherwise: if V is an object with a [[DataView]] internal slot and + there is an entry in S that has one of the following types at position i of its type list, + + then remove from S all other entries. +
    4. + +
    5. + Otherwise: if V is an object with a [[TypedArrayName]] internal slot and + there is an entry in S that has one of the following types at position i of its type list, + + then remove from S all other entries. +
    6. +
    7. Otherwise: if IsCallable(V) is true, and there is an entry in S that has one of the following types at position i of its type list, @@ -13899,14 +14204,26 @@ d.type = et; MUST support.

      -
      -

      ArrayBufferData

      +
      +

      ArrayBufferView

      + + 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. +

      +
      + +
      +

      BufferSource

      - 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.

      @@ -14285,6 +14602,7 @@ d.type = et; | "long" | "null" | "object" | "octet" | "or" | "optional" | "sequence" | "short" | "true" | "unsigned" | "void" | ArgumentNameKeyword + | BufferRelatedType "attribute" | "callback" | "const" | "creator" | "deleter" | "dictionary" @@ -14299,7 +14617,8 @@ d.type = et; "(" UnionMemberType "or" UnionMemberType UnionMemberTypes ")" NonAnyType | UnionType TypeSuffix | "any" "[" "]" TypeSuffix "or" UnionMemberType UnionMemberTypes | ε - PrimitiveType TypeSuffix | PromiseType Null | "ByteString" TypeSuffix | "DOMString" TypeSuffix | "USVString" TypeSuffix | identifier TypeSuffix | "sequence" "<" Type ">" Null | "object" TypeSuffix | "Date" TypeSuffix | "RegExp" TypeSuffix | "Error" TypeSuffix | "DOMException" TypeSuffix + PrimitiveType TypeSuffix | PromiseType Null | "ByteString" TypeSuffix | "DOMString" TypeSuffix | "USVString" TypeSuffix | identifier TypeSuffix | "sequence" "<" Type ">" Null | "object" TypeSuffix | "Date" TypeSuffix | "RegExp" TypeSuffix | "Error" TypeSuffix | "DOMException" TypeSuffix | BufferRelatedType TypeSuffix + "ArrayBuffer" | "DataView" | "Int8Array" | "Int161Array" | "Int32Array" | "Uint8Array" | "Uint16Array" | "Uint32Array" | "Uint8ClampedArray" | "Float32Array" | "Float64Array" PrimitiveType Null | identifier Null UnsignedIntegerType | UnrestrictedFloatType | "boolean" | "byte" | "octet" "unrestricted" FloatType | FloatType @@ -14586,6 +14905,12 @@ d.type = et;
      Current editor’s draft