From 17ff03e02eea5ec71a20f6e237fb36ba648ca99f Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Sat, 17 Feb 2018 22:22:45 +0100 Subject: [PATCH] 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 https://github.com/w3c/web-platform-tests/pull/9565 --- source | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source b/source index 98127220d93..6158514cb93 100644 --- a/source +++ b/source @@ -8127,7 +8127,7 @@ interface DOMStringList {
  • Let deep be false.

  • If Type(value) is Undefined, Null, Boolean, - String, or Number, then return { [[Type]]: "primitive", [[Value]]: value }.

  • + Number, BigInt, or String, then return { [[Type]]: "primitive", [[Value]]: value }.

  • If Type(value) is Symbol, then throw a "DataCloneError" DOMException.

  • @@ -8141,6 +8141,10 @@ interface DOMStringList { serialized to { [[Type]]: "Number", [[NumberData]]: value.[[NumberData]] }.

    +
  • Otherwise, if value has a [[BigIntValue]] internal slot, then set + serialized to { [[Type]]: "BigInt", [[BigIntValue]]: value.[[BigIntValue]] + }.

  • +
  • Otherwise, if value has a [[StringData]] internal slot, then set serialized to { [[Type]]: "String", [[StringData]]: value.[[StringData]] }.

  • @@ -8546,6 +8550,10 @@ o.myself = o; targetRealm whose [[NumberData]] internal slot value is serialized.[[NumberData]].

    +
  • Otherwise, if serialized.[[Type]] is "BigInt", then set value to a new BigInt object in + targetRealm whose [[BigIntValue]] internal slot value is + serialized.[[BigIntValue]].

  • +
  • Otherwise, if serialized.[[Type]] is "String", then set value to a new String object in targetRealm whose [[StringData]] internal slot value is serialized.[[StringData]].