Skip to content

Commit 01bc5df

Browse files
littledandomenic
authored andcommitted
Permit structured serialization of BigInt
* Adds BigInt to the safelist of primitives permitted for serialization * Adds serialization of BigInt wrappers, analogous to other wrappers Tests: web-platform-tests/wpt#9565
1 parent 16de123 commit 01bc5df

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

source

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3065,7 +3065,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
30653065
<li><dfn data-x-href="https://tc39.github.io/ecma262/#table-49">The <var>TypedArray</var> Constructors</dfn> table</li>
30663066
</ul>
30673067

3068-
<p>Users agents that support JavaScript must also implement the <cite>import()</cite> proposal.
3068+
<p>User agents that support JavaScript must also implement the <cite>import()</cite> proposal.
30693069
The following terms are defined there, and used in this specification: <ref spec=JSIMPORT></p>
30703070

30713071
<ul class="brief">
@@ -3074,14 +3074,16 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
30743074
<li>The <dfn data-x-href="https://tc39.github.io/proposal-dynamic-import/#sec-finishdynamicimport">FinishDynamicImport</dfn> abstract operation</li>
30753075
</ul>
30763076

3077-
<p>Users agents that support JavaScript must also implement the <cite>import.meta</cite>
3077+
<p>User agents that support JavaScript must also implement the <cite>import.meta</cite>
30783078
proposal. The following term is defined there, and used in this specification: <ref
30793079
spec=JSIMPORTMETA></p>
30803080

30813081
<ul class="brief">
30823082
<li>The <dfn data-x="js-HostGetImportMetaProperties" data-x-href="https://tc39.github.io/proposal-import-meta/#sec-hostgetimportmetaproperties">HostGetImportMetaProperties</dfn> abstract operation</li>
30833083
</ul>
30843084

3085+
<p>User agents that support JavaScript must also implement the <cite>BigInt</cite> proposal. <ref
3086+
spec=JSBIGINT></p>
30853087
</dd>
30863088

30873089

@@ -8127,7 +8129,8 @@ interface <dfn>DOMStringList</dfn> {
81278129
<li><p>Let <var>deep</var> be false.</p></li>
81288130

81298131
<li><p>If <span data-x="js-Type">Type</span>(<var>value</var>) is Undefined, Null, Boolean,
8130-
String, or Number, then return { [[Type]]: "primitive", [[Value]]: <var>value</var> }.</p></li>
8132+
Number, BigInt, or String, then return { [[Type]]: "primitive",
8133+
[[Value]]: <var>value</var> }. <ref spec=JSBIGINT></p></li>
81318134

81328135
<li><p>If <span data-x="js-Type">Type</span>(<var>value</var>) is Symbol, then throw a
81338136
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li>
@@ -8141,6 +8144,10 @@ interface <dfn>DOMStringList</dfn> {
81418144
<var>serialized</var> to { [[Type]]: "Number", [[NumberData]]: <var>value</var>.[[NumberData]]
81428145
}.</p></li>
81438146

8147+
<li><p>Otherwise, if <var>value</var> has a [[BigIntData]]
8148+
internal slot, then set <var>serialized</var> to { [[Type]]: "BigInt", [[BigIntData]]:
8149+
<var>value</var>.[[BigIntData]] }. <ref spec=JSBIGINT></p></li>
8150+
81448151
<li><p>Otherwise, if <var>value</var> has a [[StringData]] internal slot, then set
81458152
<var>serialized</var> to { [[Type]]: "String", [[StringData]]: <var>value</var>.[[StringData]]
81468153
}.</p></li>
@@ -8538,24 +8545,28 @@ o.myself = o;</pre>
85388545
<li><p>If <var>serialized</var>.[[Type]] is "primitive", then set <var>value</var> to
85398546
<var>serialized</var>.[[Value]].</p>
85408547

8541-
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "Boolean", then set <var>value</var> to a new Boolean object in
8542-
<var>targetRealm</var> whose [[BooleanData]] internal slot value is
8548+
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "Boolean", then set <var>value</var> to a
8549+
new Boolean object in <var>targetRealm</var> whose [[BooleanData]] internal slot value is
85438550
<var>serialized</var>.[[BooleanData]].</p></li>
85448551

8545-
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "Number", then set <var>value</var> to a new Number object in
8546-
<var>targetRealm</var> whose [[NumberData]] internal slot value is
8552+
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "Number", then set <var>value</var> to a
8553+
new Number object in <var>targetRealm</var> whose [[NumberData]] internal slot value is
85478554
<var>serialized</var>.[[NumberData]].</p></li>
85488555

8549-
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "String", then set <var>value</var> to a new String object in
8550-
<var>targetRealm</var> whose [[StringData]] internal slot value is
8556+
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "BigInt", then set <var>value</var> to a
8557+
new BigInt object in <var>targetRealm</var> whose [[BigIntData]] internal slot value is
8558+
<var>serialized</var>.[[BigIntData]]. <ref spec=JSBIGINT></p></li>
8559+
8560+
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "String", then set <var>value</var> to a
8561+
new String object in <var>targetRealm</var> whose [[StringData]] internal slot value is
85518562
<var>serialized</var>.[[StringData]].</p></li>
85528563

8553-
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "Date", then set <var>value</var> to a new Date object in
8554-
<var>targetRealm</var> whose [[DateValue]] internal slot value is
8564+
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "Date", then set <var>value</var> to a new
8565+
Date object in <var>targetRealm</var> whose [[DateValue]] internal slot value is
85558566
<var>serialized</var>.[[DateValue]].</p></li>
85568567

8557-
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "RegExp", then set <var>value</var> to a new RegExp object in
8558-
<var>targetRealm</var> whose [[RegExpMatcher]] internal slot value is
8568+
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "RegExp", then set <var>value</var> to a
8569+
new RegExp object in <var>targetRealm</var> whose [[RegExpMatcher]] internal slot value is
85598570
<var>serialized</var>.[[RegExpMatcher]], whose [[OriginalSource]] internal slot value is
85608571
<var>serialized</var>.[[OriginalSource]], and whose [[OriginalFlags]] internal slot value is
85618572
<var>serialized</var>.[[OriginalFlags]].</p></li>
@@ -120209,6 +120220,9 @@ INSERT INTERFACES HERE
120209120220
<dt id="refsJPEG">[JPEG]</dt>
120210120221
<dd><cite><a href="https://www.w3.org/Graphics/JPEG/jfif3.pdf">JPEG File Interchange Format</a></cite>, E. Hamilton.</dd>
120211120222

120223+
<dt id="refsJSBIGINT">[JSBIGINT]</dt>
120224+
<dd><cite><a href="https://tc39.github.io/proposal-bigint/">BigInt</a></cite>. Ecma International.</dd>
120225+
120212120226
<dt id="refsJSIMPORT">[JSIMPORT]</dt>
120213120227
<dd><cite><a href="https://tc39.github.io/proposal-dynamic-import/">import()</a></cite>. Ecma International.</dd>
120214120228

0 commit comments

Comments
 (0)