@@ -41,6 +41,10 @@ urlPrefix: http://www.unicode.org/glossary/; spec: UNICODE
4141    type: dfn
4242        text: Unicode scalar value; url: unicode_scalar_value
4343urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262
44+     type: interface; for: ECMAScript
45+         text: ArrayBuffer; url: sec-arraybuffer-objects
46+         text: DataView; url: sec-dataview-objects
47+         text: SharedArrayBuffer; url: sec-sharedarraybuffer-objects
4448    type: dfn
4549        text: NumericLiteral; url: sec-literals-numeric-literals
4650        text: ECMAScript error objects; url: sec-error-objects
@@ -110,6 +114,7 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262
110114        text: CreateDataProperty; url: sec-createdataproperty
111115        text: DetachArrayBuffer; url: sec-detacharraybuffer
112116        text: IsDetachedBuffer; url: sec-isdetachedbuffer
117+         text: IsSharedArrayBuffer; url: sec-issharedarraybuffer
113118        text: SetIntegrityLevel; url: sec-setintegritylevel
114119        url: sec-array-iterator-objects
115120            text: array iterator object
@@ -7799,34 +7804,44 @@ ECMAScript <emu-val>Object</emu-val> values.
77997804<h4 id="es-buffer-source-types">Buffer source types</h4>
78007805
78017806Values of the IDL [=buffer source types=]
7802- are represented by objects of the corresponding ECMAScript class.
7807+ are represented by objects of the corresponding ECMAScript class, with the additional restriction
7808+ that unless the type is [=extended attributes associated with|associated with=] the
7809+ [{{AllowShared}}] extended attribute, they can only be backed by ECMAScript
7810+ {{ECMAScript/ArrayBuffer}} objects, and not {{ECMAScript/SharedArrayBuffer}} objects.
78037811
7804- <div id="es-to-buffer-source" algorithm="convert an ECMAScript value to buffer source ">
7812+ <div id="es-to-buffer-source" algorithm="convert an ECMAScript value to IDL ArrayBuffer ">
78057813
78067814    An ECMAScript value |V| is [=converted to an IDL value|converted=]
78077815    to an IDL {{ArrayBuffer}} value by running the following algorithm:
78087816
78097817    1.  If [=Type=](|V|) is not Object,
78107818        or |V| does not have an \[[ArrayBufferData]] [=internal slot=],
7811-         or [=IsDetachedBuffer=](|V|) is true,
78127819        then [=ECMAScript/throw=] a <emu-val>TypeError</emu-val>.
7820+     1.  If the conversion is not to an IDL type
7821+         [=extended attributes associated with|associated with=] the [{{AllowShared}}]
7822+         [=extended attribute=], and [=IsSharedArrayBuffer=](|V|) is true, then [=ECMAScript/throw=]
7823+         a <emu-val>TypeError</emu-val>.
78137824    1.  Return the IDL {{ArrayBuffer}} value that is a reference
78147825        to the same object as |V|.
78157826</div>
78167827
7817- <div id="buffer-source-to-es" algorithm="convert a buffer source  to an ECMAScript value ">
7828+ <div id="buffer-source-to-es" algorithm="convert an ECMAScript value  to IDL DataView ">
78187829
78197830    An ECMAScript value |V| is [=converted to an IDL value|converted=]
78207831    to an IDL {{DataView}} value by running the following algorithm:
78217832
78227833    1.  If [=Type=](|V|) is not Object,
78237834        or |V| does not have a \[[DataView]] [=internal slot=],
78247835        then [=ECMAScript/throw=] a <emu-val>TypeError</emu-val>.
7836+     1.  If the conversion is not to an IDL type
7837+         [=extended attributes associated with|associated with=] the [{{AllowShared}}]
7838+         [=extended attribute=], and [=IsSharedArrayBuffer=](|V|.\[[ViewedArrayBuffer]]) is true,
7839+         then [=ECMAScript/throw=] a <emu-val>TypeError</emu-val>.
78257840    1.  Return the IDL {{DataView}} value that is a reference
78267841        to the same object as |V|.
78277842</div>
78287843
7829- <div algorithm="convert an ECMAScript value to buffer source type ">
7844+ <div algorithm="convert an ECMAScript value to IDL typed array ">
78307845
78317846    An ECMAScript value |V| is
78327847    [=converted to an IDL value|converted=]
@@ -7842,9 +7857,15 @@ are represented by objects of the corresponding ECMAScript class.
78427857    by running the following algorithm:
78437858
78447859    1.  Let |T| be the IDL type |V| is being converted to.
7860+     1.  Let |typedArrayName| be the [=type name|name=] of |T|'s [=annotated types/inner type=] if
7861+         |T| is an [=annotated type=], or the [=type name|name=] of |T| otherwise.
78457862    1.  If [=Type=](|V|) is not Object,
78467863        or |V| does not have a \[[TypedArrayName]] [=internal slot=]
7847-         with a value equal to the name of |T|,
7864+         with a value equal to |typedArrayName|,
7865+         then [=ECMAScript/throw=] a <emu-val>TypeError</emu-val>.
7866+     1.  If the conversion is not to an IDL type
7867+         [=extended attributes associated with|associated with=] the [{{AllowShared}}]
7868+         [=extended attribute=], and [=IsSharedArrayBuffer=](|V|.\[[ViewedArrayBuffer]]) is true,
78487869        then [=ECMAScript/throw=] a <emu-val>TypeError</emu-val>.
78497870    1.  Return the IDL value of type |T| that is a reference to the same object as |V|.
78507871</div>
@@ -7858,7 +7879,7 @@ a reference to the same object that the IDL value represents.
78587879
78597880    When [=get a reference to the buffer source|getting a reference to=]
78607881    or [=get a copy of the buffer source|getting a copy of the bytes held by a buffer source=]
7861-     that is an ECMAScript <emu-val>ArrayBuffer</emu-val>, <emu-val>DataView</emu-val> 
7882+     that is an ECMAScript {{ECMAScript/ArrayBuffer}}, {{ECMAScript/DataView}} 
78627883    or typed array object, these steps must be followed:
78637884
78647885    1.  Let |O| be the ECMAScript object that is the buffer source.
@@ -7945,6 +7966,38 @@ This section defines a number of
79457966whose presence affects only the ECMAScript binding.
79467967
79477968
7969+ <h4 id="AllowShared" extended-attribute lt="AllowShared">[AllowShared]</h4>
7970+ 
7971+ If the [{{AllowShared}}] [=extended attribute=] appears on one of the [=buffer source types=], it
7972+ creates a new IDL type that allows the buffer source type to be backed by an ECMAScript
7973+ {{ECMAScript/SharedArrayBuffer}}, instead of only by a non-shared {{ECMAScript/ArrayBuffer}}.
7974+ 
7975+ The [{{AllowShared}}] extended attribute must [=takes no arguments|take no arguments=].
7976+ 
7977+ A type that is not a [=buffer source type=] must not be
7978+ [=extended attributes associated with|associated with=] the [{{AllowShared}}] extended attribute.
7979+ 
7980+ See the rules for converting ECMAScript values to IDL [=buffer source types=] in
7981+ [[#es-buffer-source-types]] for the specific requirements that the use of [{{AllowShared}}] entails.
7982+ 
7983+ <div class="example">
7984+     In the following [=IDL fragment=], one operation's argument uses the [{{AllowShared}}] extended
7985+     attribute, while the other does not:
7986+ 
7987+     <pre highlight="webidl">
7988+         interface RenderingContext {
7989+           void readPixels(long width, long height, BufferSource pixels);
7990+           void readPixelsShared(long width, long height, [AllowShared] BufferSource pixels);
7991+         };
7992+     </pre>
7993+ 
7994+     With this definition, a call to <code>readPixels</code> with an {{ECMAScript/SharedArrayBuffer}}
7995+     instance, or any typed array or {{ECMAScript/DataView}} backed by one, will throw a
7996+     {{TypeError}} exception. In contrast, a call to <code>readPixelsShared</code> will allow such
7997+     objects as input.
7998+ </div>
7999+ 
8000+ 
79488001<h4 id="Clamp" extended-attribute lt="Clamp">[Clamp]</h4>
79498002
79508003If the [{{Clamp}}] [=extended attribute=] appears on one of the [=integer types=], it creates a new
@@ -7962,7 +8015,7 @@ attribute. A type must not be [=extended attributes associated with|associated w
79628015not be [=extended attributes associated with|associated with=] the [{{Clamp}}] extended attribute.
79638016
79648017See the rules for converting ECMAScript values to the various IDL integer
7965- types in [[#es-type-mapping ]]
8018+ types in [[#es-integer-types ]]
79668019for the specific requirements that the use of
79678020[{{Clamp}}] entails.
79688021
@@ -7981,7 +8034,7 @@ for the specific requirements that the use of
79818034        };
79828035    </pre>
79838036
7984-     In an ECMAScript implementation of the IDL, a  call to setColorClamped with
8037+     A  call to <code> setColorClamped</code>  with
79858038    <emu-val>Number</emu-val> values that are out of range for an
79868039    {{octet}} are clamped to the range [0, 255].
79878040
0 commit comments