Skip to content

Commit

Permalink
Permit structured serialization of BigInt
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
littledan authored and domenic committed Feb 26, 2018
1 parent 16de123 commit 01bc5df
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3065,7 +3065,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x-href="https://tc39.github.io/ecma262/#table-49">The <var>TypedArray</var> Constructors</dfn> table</li>
</ul>

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

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

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

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

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


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

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

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

<li><p>Otherwise, if <var>value</var> has a [[BigIntData]]
internal slot, then set <var>serialized</var> to { [[Type]]: "BigInt", [[BigIntData]]:
<var>value</var>.[[BigIntData]] }. <ref spec=JSBIGINT></p></li>

<li><p>Otherwise, if <var>value</var> has a [[StringData]] internal slot, then set
<var>serialized</var> to { [[Type]]: "String", [[StringData]]: <var>value</var>.[[StringData]]
}.</p></li>
Expand Down Expand Up @@ -8538,24 +8545,28 @@ o.myself = o;</pre>
<li><p>If <var>serialized</var>.[[Type]] is "primitive", then set <var>value</var> to
<var>serialized</var>.[[Value]].</p>

<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "Boolean", then set <var>value</var> to a new Boolean object in
<var>targetRealm</var> whose [[BooleanData]] internal slot value is
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "Boolean", then set <var>value</var> to a
new Boolean object in <var>targetRealm</var> whose [[BooleanData]] internal slot value is
<var>serialized</var>.[[BooleanData]].</p></li>

<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "Number", then set <var>value</var> to a new Number object in
<var>targetRealm</var> whose [[NumberData]] internal slot value is
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "Number", then set <var>value</var> to a
new Number object in <var>targetRealm</var> whose [[NumberData]] internal slot value is
<var>serialized</var>.[[NumberData]].</p></li>

<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "String", then set <var>value</var> to a new String object in
<var>targetRealm</var> whose [[StringData]] internal slot value is
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "BigInt", then set <var>value</var> to a
new BigInt object in <var>targetRealm</var> whose [[BigIntData]] internal slot value is
<var>serialized</var>.[[BigIntData]]. <ref spec=JSBIGINT></p></li>

<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "String", then set <var>value</var> to a
new String object in <var>targetRealm</var> whose [[StringData]] internal slot value is
<var>serialized</var>.[[StringData]].</p></li>

<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "Date", then set <var>value</var> to a new Date object in
<var>targetRealm</var> whose [[DateValue]] internal slot value is
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "Date", then set <var>value</var> to a new
Date object in <var>targetRealm</var> whose [[DateValue]] internal slot value is
<var>serialized</var>.[[DateValue]].</p></li>

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

<dt id="refsJSBIGINT">[JSBIGINT]</dt>
<dd><cite><a href="https://tc39.github.io/proposal-bigint/">BigInt</a></cite>. Ecma International.</dd>

<dt id="refsJSIMPORT">[JSIMPORT]</dt>
<dd><cite><a href="https://tc39.github.io/proposal-dynamic-import/">import()</a></cite>. Ecma International.</dd>

Expand Down

0 comments on commit 01bc5df

Please sign in to comment.