Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3047,6 +3047,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-isconstructor">IsConstructor</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-isdatadescriptor">IsDataDescriptor</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-isdetachedbuffer">IsDetachedBuffer</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-isimmutablebuffer">IsImmutableBuffer</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-issharedarraybuffer">IsSharedArrayBuffer</dfn> abstract operation</li>
<li>The <dfn data-x="js-NewObjectEnvironment" data-x-href="https://tc39.es/ecma262/#sec-newobjectenvironment">NewObjectEnvironment</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-normalcompletion">NormalCompletion</dfn> abstract operation</li>
Expand Down Expand Up @@ -9744,6 +9745,24 @@ interface <dfn interface>DOMStringList</dfn> {
</ol>
</li>

<li>
<p>Otherwise, if <span>IsImmutableBuffer</span>(<var>value</var>) is true, then:</p>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>Otherwise, if <span>IsImmutableBuffer</span>(<var>value</var>) is true, then:</p>
<p>Otherwise, if <span>IsImmutableBuffer</span>(<var>value</var>) is true:</p>


<ol>
<li>
<p>Set <var>serialized</var> to { [[Type]]: "ImmutableArrayBuffer", [[ArrayBufferData]]:
<var>value</var>.[[ArrayBufferData]], [[ArrayBufferByteLength]]:
<var>value</var>.[[ArrayBufferByteLength]] }.</p>

<p class="note">To support deserialization by independent processes at arbitrary points in
the future, the <em>contents</em> of <var>value</var>.[[ArrayBufferData]]
<!--non-normative-->must be preserved when <var>forStorage</var> is true. But otherwise, a
Comment thread
gibson042 marked this conversation as resolved.
Outdated
pointer <em>referencing</em> <var>value</var>.[[ArrayBufferData]] is expected to
suffice.</p>
</li>
</ol>
</li>

<li>
<p>Otherwise:</p>

Expand Down Expand Up @@ -9791,7 +9810,8 @@ interface <dfn interface>DOMStringList</dfn> {
<var>memory</var>).</p></li>

<li><p><span>Assert</span>: <var>bufferSerialized</var>.[[Type]] is "ArrayBuffer",
"ResizableArrayBuffer", "SharedArrayBuffer", or "GrowableSharedArrayBuffer".</p></li>
"ImmutableArrayBuffer", "ResizableArrayBuffer", "SharedArrayBuffer", or
"GrowableSharedArrayBuffer".</p></li>

<li><p>If <var>value</var> has a [[DataView]] internal slot, then set <var>serialized</var> to
{ [[Type]]: "ArrayBufferView", [[Constructor]]: "DataView", [[ArrayBufferSerialized]]:
Expand Down Expand Up @@ -10186,6 +10206,20 @@ o.myself = o;</code></pre>
</ol>
</li>

<li>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>Otherwise, if <var>serialized</var>.[[Type]] is "ImmutableArrayBuffer", then:</p>
<p>Otherwise, if <var>serialized</var>.[[Type]] is "ImmutableArrayBuffer":</p>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would the pattern used for type "ImmutableArrayBuffer" differ from the pattern used for types "SharedArrayBuffer" and "GrowableSharedArrayBuffer"?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we need to do a more general pass to remove these.

<p>Otherwise, if <var>serialized</var>.[[Type]] is "ImmutableArrayBuffer", then:</p>

<ol>
<li><p>Set <var>value</var> to a new ArrayBuffer object in <var>targetRealm</var> whose
[[ArrayBufferData]] internal slot value is <var>serialized</var>.[[ArrayBufferData]], whose
[[ArrayBufferByteLength]] internal slot value is
<var>serialized</var>.[[ArrayBufferByteLength]], and whose [[ArrayBufferIsImmutable]] internal
slot is present.</p></li>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for a slot to not have a value in this way?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically yes, but it's obviously not great and I see now that things are moving away from it. I've updated accordingly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But for the record, the document.all HTMLAllCollection seems to be another example—it has an [[IsHTMLDDA]] internal slot for which no value is ever specified AFAICT.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And in ECMAScript, Object Internal Methods and Internal Slots defines the initial value of an internal slot to be undefined.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True although see also tc39/ecma262#3399


<li><p><span>Assert</span>: <span>IsImmutableBuffer</span>(<var>value</var>) is true.</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>serialized</var>.[[Type]] is "ArrayBuffer", then set <var>value</var> to a
new ArrayBuffer object in <var>targetRealm</var> whose [[ArrayBufferData]] internal slot value
Expand Down Expand Up @@ -10463,7 +10497,8 @@ o.myself = o;</code></pre>
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>If <var>transferable</var> has an [[ArrayBufferData]] internal slot and
<span>IsSharedArrayBuffer</span>(<var>transferable</var>) is true, then throw a
<span>IsSharedArrayBuffer</span>(<var>transferable</var>) is true or
either <span>IsImmutableBuffer</span>(<var>transferable</var>) is true, then throw a
Comment thread
gibson042 marked this conversation as resolved.
Outdated
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>If <var>memory</var>[<var>transferable</var>] <span data-x="map exists">exists</span>,
Expand Down