Intent to prototype and ship: Implement self.structuredClone()

81 views
Skip to first unread message

Tom Schuster

unread,
Oct 1, 2021, 5:00:54 AM10/1/21
to dev-platform
(Sorry for not sending this earlier)

Summary: The structuredClone function directly exposes the structured
cloning mechanism to allow (deep) cloning of values/objects.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1722576

Standard: https://html.spec.whatwg.org/#structured-cloning

Platform coverage: All

Preference: None

DevTools bug: N/A

Other browsers: Not yet in any other browser.

web-platform-tests:
https://github.com/web-platform-tests/wpt/tree/master/html/webappapis/structured-clone

Gijs Kruitbosch

unread,
Oct 1, 2021, 6:46:01 AM10/1/21
to Tom Schuster, dev-platform
Is there a bug on file to replace privileged code calling Cu.cloneInto()
with a dummy scope/sandbox argument (ie using that as a cheap way to do
a structured clone) and similar workarounds with this standards-based
one? And in what release cycle would it be safe to start using this in
privileged code? (we normally wait a cycle or two, I think)

~ Gijs

Tom Schuster

unread,
Oct 4, 2021, 8:25:56 AM10/4/21
to Gijs Kruitbosch, dev-platform
On Fri, Oct 1, 2021 at 12:45 PM Gijs Kruitbosch <gkrui...@mozilla.com> wrote:
>
> Is there a bug on file to replace privileged code calling Cu.cloneInto()
> with a dummy scope/sandbox argument (ie using that as a cheap way to do
> a structured clone) and similar workarounds with this standards-based
> one?

Not that I am aware of yet. Mike opened a bug for replacing the
`JSON.parse(JSON.stringify(x))` pattern:
https://bugzilla.mozilla.org/show_bug.cgi?id=1733813

>And in what release cycle would it be safe to start using this in
> privileged code? (we normally wait a cycle or two, I think)
>

We are shipping this everywhere in 94, considering we have to wait for
the soft freeze, 95 should be fine.

-Tom
Reply all
Reply to author
Forward
0 new messages