Skip to content

Commit a187207

Browse files
committed
Normative: Permit serialization of BigInt wrappers
The goal of this PR is to integrate BigInt with HTML serialization. This patch - Adds BigInt to the "safe list" of primitives permitted for serialization. - Adds serialization of BigInt wrappers, analogous to other wrappers. Note that BigInt, like (the unserializable) Symbol does not have a new-able constructor: use of wrappers is explicitly discouraged by the specification. Nevertheless, this patch adds serialization support for consistency with other wrappers. web-platform-tests against postMessage on BigInt are out for review in web-platform-tests/wpt#9565
1 parent fc82f4f commit a187207

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

source

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8127,7 +8127,7 @@ interface <dfn>DOMStringList</dfn> {
81278127
<li><p>Let <var>deep</var> be false.</p></li>
81288128

81298129
<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>
8130+
String, BigInt, or Number, then return { [[Type]]: "primitive", [[Value]]: <var>value</var> }.</p></li>
81318131

81328132
<li><p>If <span data-x="js-Type">Type</span>(<var>value</var>) is Symbol, then throw a
81338133
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li>
@@ -8149,6 +8149,10 @@ interface <dfn>DOMStringList</dfn> {
81498149
<var>serialized</var> to { [[Type]]: "Date", [[DateValue]]: <var>value</var>.[[DateValue]]
81508150
}.</p></li>
81518151

8152+
<li><p>Otherwise, if <var>value</var> has a [[BigIntValue]] internal slot, then set
8153+
<var>serialized</var> to { [[Type]]: "BigInt", [[BigIntValue]]: <var>value</var>.[[BigIntValue]]
8154+
}.</p></li>
8155+
81528156
<li><p>Otherwise, if <var>value</var> has a [[RegExpMatcher]] internal slot, then set
81538157
<var>serialized</var> to { [[Type]]: "RegExp", [[RegExpMatcher]]:
81548158
<var>value</var>.[[RegExpMatcher]], [[OriginalSource]]: <var>value</var>.[[OriginalSource]],
@@ -8554,6 +8558,10 @@ o.myself = o;</pre>
85548558
<var>targetRealm</var> whose [[DateValue]] internal slot value is
85558559
<var>serialized</var>.[[DateValue]].</p></li>
85568560

8561+
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "BigInt", then set <var>value</var> to a new BigInt object in
8562+
<var>targetRealm</var> whose [[BigIntValue]] internal slot value is
8563+
<var>serialized</var>.[[BigIntValue]].</p></li>
8564+
85578565
<li><p>Otherwise, if <var>serialized</var>.[[Type]] is "RegExp", then set <var>value</var> to a new RegExp object in
85588566
<var>targetRealm</var> whose [[RegExpMatcher]] internal slot value is
85598567
<var>serialized</var>.[[RegExpMatcher]], whose [[OriginalSource]] internal slot value is

0 commit comments

Comments
 (0)