Intent to Prototype and Ship: self.structuredClone

270 views
Skip to first unread message

Andreu Botella

unread,
Oct 27, 2021, 2:45:27 PM10/27/21
to blink-dev
Contact emails
and...@andreubotella.com, jbr...@chromium.org, su...@chromium.org

Explainer
https://github.com/whatwg/html/issues/793

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

Summary
Enables using the HTML structured clone algorithm synchronously for cloning and transferring objects within a single realm.

Initial public proposal
https://github.com/whatwg/html/issues/793
https://github.com/whatwg/html/pull/3414

Blink component
Blink>Messaging

TAG review
This is just exposing existing browser functionality, with a two-line spec. It doesn’t seem like there’s much to discuss architecturally, but I’ll file for review if the community thinks it would help.

TAG review status
Not applicable

Risks

Interoperability and Compatibility
Low. There are some differences across the browsers’ implementations of the structured cloning algorithm, but they are very minor and already present in other APIs that use it.

Gecko: Shipped/Shipping (https://bugzilla.mozilla.org/show_bug.cgi?id=1722576)
Edge: No signal
WebKit: Shipped/Shipping (https://bugs.webkit.org/show_bug.cgi?id=228331)

Web developers: Positive (https://github.com/whatwg/html/pull/3414#issuecomment-854051942 and following comments). There seems to be a lot of demand for a built-in deep clone, and while structured clone is not exactly that, it fulfills many of the use cases.

Debuggability
n/a

Is this feature fully tested by web-platform-tests?
Yes

Requires code in //chrome?
False

Tracking bug
https://bugs.chromium.org/p/chromium/issues/detail?id=1233571

Estimated milestones
No milestones specified

Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/5630001077551104

Requesting approval to ship?
Yes. This is a relatively small feature which exposes existing functionality.

Fernando Serboncini

unread,
Oct 27, 2021, 5:12:32 PM10/27/21
to Andreu Botella, blink-dev
This is amazing! :)

I agree it shouldn't block this, but do we have anywhere written what are the browser's differences on structured clone algorithms? Is it a spec issue? Could we add WPT tests for it?

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/e7299674-54df-4f4d-8c30-d922ebf4e47cn%40chromium.org.

Joyee Cheung

unread,
Oct 28, 2021, 6:42:10 AM10/28/21
to blink-dev, fs...@chromium.org, blink-dev, and...@andreubotella.com
This would be a great addition. Node.js also has been shipping this since v17.0.0.

Yoav Weiss

unread,
Oct 28, 2021, 2:56:15 PM10/28/21
to blink-dev, jo...@igalia.com, Fernando Serboncini, blink-dev, and...@andreubotella.com
On Thursday, October 28, 2021 at 12:42:10 PM UTC+2 jo...@igalia.com wrote:
This would be a great addition. Node.js also has been shipping this since v17.0.0.
On Thursday, October 28, 2021 at 5:12:32 AM UTC+8 fs...@chromium.org wrote:
This is amazing! :)

I agree it shouldn't block this, but do we have anywhere written what are the browser's differences on structured clone algorithms? Is it a spec issue? Could we add WPT tests for it?

On Wed, Oct 27, 2021 at 2:45 PM Andreu Botella <and...@andreubotella.com> wrote:

Explainer
https://github.com/whatwg/html/issues/793

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

Summary
Enables using the HTML structured clone algorithm synchronously for cloning and transferring objects within a single realm.

Initial public proposal
https://github.com/whatwg/html/issues/793
https://github.com/whatwg/html/pull/3414

Blink component
Blink>Messaging

TAG review
This is just exposing existing browser functionality, with a two-line spec. It doesn’t seem like there’s much to discuss architecturally, but I’ll file for review if the community thinks it would help.

I agree this doesn't need a TAG review, but for other reasons.
This change has landed in HTML and is shipped in 2 engines, so there's no need for a TAG review for that reason.
 


TAG review status
Not applicable

Risks

Interoperability and Compatibility
Low. There are some differences across the browsers’ implementations of the structured cloning algorithm, but they are very minor and already present in other APIs that use it.

Are there tests that highlight those differences?

Andreu Botella

unread,
Oct 28, 2021, 4:56:04 PM10/28/21
to blink-dev, yoav...@chromium.org, jo...@igalia.com, fs...@chromium.org, blink-dev, Andreu Botella
About the differences in the structured clone algorithm across implementations: I don't think those are listed anywhere. I know there are some because of the failures in https://wpt.fyi/results/html/infrastructure/safe-passing-of-structured-data?label=experimental&label=master&aligned, but there might be others that aren't tested. Although it seems like some of the failures in the shared-array-buffer folder seem to be bugs with the tests rather than with the implementations.

For the record, I recently fixed in https://chromium-review.googlesource.com/c/chromium/src/+/3229544 one of Chromium's failures, where it was throwing a TypeError rather than a DataCloneException in one particular case. And it seems like the RegExp failures in Safari are fixed in the WebKit trunk / master branch.

Andreu Botella

unread,
Oct 28, 2021, 4:56:08 PM10/28/21
to blink-dev, fs...@chromium.org, blink-dev, Andreu Botella
I don't think the differences are listed anywhere. I know there are some because of the failures in https://wpt.fyi/results/html/infrastructure/safe-passing-of-structured-data?label=experimental&label=master&aligned, but there might be others that aren't tested. Although it seems like some of the failures in the shared-array-buffer folder seem to be bugs with the tests rather than with the implementations.

Yoav Weiss

unread,
Oct 29, 2021, 12:56:56 AM10/29/21
to Andreu Botella, blink-dev, fs...@chromium.org
LGTM1

On Thu, Oct 28, 2021 at 10:56 PM Andreu Botella <and...@andreubotella.com> wrote:
I don't think the differences are listed anywhere. I know there are some because of the failures in https://wpt.fyi/results/html/infrastructure/safe-passing-of-structured-data?label=experimental&label=master&aligned, but there might be others that aren't tested. Although it seems like some of the failures in the shared-array-buffer folder seem to be bugs with the tests rather than with the implementations.

OK, as these differences are already exposed, I don't think shipping this significantly increases risk. The fact that they're covered by WPTs makes it more likely we'd (eventually) converge on the specified behavior.

Manuel Rego Casasnovas

unread,
Oct 29, 2021, 3:18:09 AM10/29/21
to Yoav Weiss, Andreu Botella, blink-dev, fs...@chromium.org
LGTM2

On 29/10/2021 06:56, Yoav Weiss wrote:
> LGTM1
>
> On Thu, Oct 28, 2021 at 10:56 PM Andreu Botella
> <and...@andreubotella.com <mailto:and...@andreubotella.com>> wrote:
>
> I don't think the differences are listed anywhere. I know there are
> some because of the failures in
> https://wpt.fyi/results/html/infrastructure/safe-passing-of-structured-data?label=experimental&label=master&aligned
> <https://wpt.fyi/results/html/infrastructure/safe-passing-of-structured-data?label=experimental&label=master&aligned>,
> but there might be others that aren't tested. Although it seems like
> some of the failures in the shared-array-buffer folder seem to be
> bugs with the tests rather than with the implementations.
>
>
> OK, as these differences are already exposed, I don't think shipping
> this significantly increases risk. The fact that they're covered by WPTs
> makes it more likely we'd (eventually) converge on the specified behavior.
>
>
> On Wednesday, October 27, 2021 at 11:12:32 PM UTC+2
> fs...@chromium.org <mailto:fs...@chromium.org> wrote:
>
> This is amazing! :)
>
> I agree it shouldn't block this, but do we have anywhere written
> what are the browser's differences on structured clone
> algorithms? Is it a spec issue? Could we add WPT tests for it?
>
> On Wed, Oct 27, 2021 at 2:45 PM Andreu Botella
> <and...@andreubotella.com> wrote:
>
> *Contact emails*
> and...@andreubotella.com, jbr...@chromium.org,
> su...@chromium.org
>
> *Explainer*
> https://github.com/whatwg/html/issues/793
> <https://github.com/whatwg/html/issues/793>
>
> *Specification*
> https://html.spec.whatwg.org/#structured-cloning
> <https://html.spec.whatwg.org/#structured-cloning>
>
> *Summary*
> Enables using the HTML structured clone algorithm
> synchronously for cloning and transferring objects within a
> single realm.
>
> *Initial public proposal*
> https://github.com/whatwg/html/issues/793
> <https://github.com/whatwg/html/issues/793>
> https://github.com/whatwg/html/pull/3414
> <https://github.com/whatwg/html/pull/3414>
>
> *Blink component*
> Blink>Messaging
> <https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink%3EMessaging>
>
>
> *TAG review*
> This is just exposing existing browser functionality, with a
> two-line spec. It doesn’t seem like there’s much to discuss
> architecturally, but I’ll file for review if the community
> thinks it would help.
>
> *TAG review status*
> Not applicable
>
> *Risks*
>
> *Interoperability and Compatibility*
> Low. There are some differences across the browsers’
> implementations of the structured cloning algorithm, but
> they are very minor and already present in other APIs that
> use it.
>
> Gecko: Shipped/Shipping
> (https://bugzilla.mozilla.org/show_bug.cgi?id=1722576
> <https://bugzilla.mozilla.org/show_bug.cgi?id=1722576>)
> Edge: No signal
> WebKit: Shipped/Shipping
> (https://bugs.webkit.org/show_bug.cgi?id=228331
> <https://bugs.webkit.org/show_bug.cgi?id=228331>)
>
> Web developers: Positive
> (https://github.com/whatwg/html/pull/3414#issuecomment-854051942
> <https://github.com/whatwg/html/pull/3414#issuecomment-854051942>
> and following comments). There seems to be a lot of demand
> for a built-in deep clone, and while structured clone is not
> exactly that, it fulfills many of the use cases.
>
> *Debuggability*
> n/a
>
> *Is this feature fully tested by web-platform-tests
> <https://chromium.googlesource.com/chromium/src/+/master/docs/testing/web_platform_tests.md>?*
> Yes
> <https://wpt.fyi/results/html/webappapis/structured-clone?label=experimental&label=master&aligned>
>
>
> *Requires code in //chrome?*
> False
>
> *Tracking bug*
> https://bugs.chromium.org/p/chromium/issues/detail?id=1233571 <https://bugs.chromium.org/p/chromium/issues/detail?id=1233571>
>
>
> *Estimated milestones*
> No milestones specified
>
> *Link to entry on the Chrome Platform Status*
> https://chromestatus.com/feature/5630001077551104
> <https://chromestatus.com/feature/5630001077551104>
>
> *Requesting approval to ship? *
> Yes. This is a relatively small feature which exposes
> existing functionality.
>
> --
> You received this message because you are subscribed to the
> Google Groups "blink-dev" group.
> To unsubscribe from this group and stop receiving emails
> from it, send an email to blink-dev+...@chromium.org.
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/e7299674-54df-4f4d-8c30-d922ebf4e47cn%40chromium.org
> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/e7299674-54df-4f4d-8c30-d922ebf4e47cn%40chromium.org?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to blink-dev+...@chromium.org
> <mailto:blink-dev+...@chromium.org>.
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/74ab6933-2925-455a-9e24-a95ae08f3cf5n%40chromium.org
> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/74ab6933-2925-455a-9e24-a95ae08f3cf5n%40chromium.org?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to blink-dev+...@chromium.org
> <mailto:blink-dev+...@chromium.org>.
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAL5BFfVnABD048Xi6r3J9%2BGwBmYUX6pM1Auqp6MQSuwJUaNejg%40mail.gmail.com
> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAL5BFfVnABD048Xi6r3J9%2BGwBmYUX6pM1Auqp6MQSuwJUaNejg%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Chris Harrelson

unread,
Oct 29, 2021, 12:41:30 PM10/29/21
to Manuel Rego Casasnovas, Yoav Weiss, Andreu Botella, blink-dev, fs...@chromium.org

Joe Medley

unread,
Oct 29, 2021, 2:47:15 PM10/29/21
to Chris Harrelson, Manuel Rego Casasnovas, Yoav Weiss, Andreu Botella, blink-dev, fs...@chromium.org
Hi,

In which version are you planning to ship?

Joe
Joe Medley | Technical Writer, Chrome DevRel | jme...@google.com | 816-678-7195
If an API's not documented it doesn't exist.


Andreu Botella

unread,
Oct 30, 2021, 3:25:51 AM10/30/21
to blink-dev, Joe Medley, Manuel Rego, yoav...@chromium.org, Andreu Botella, blink-dev, fs...@chromium.org, Chris Harrelson
Hi. The implementation is complete, and the CL just needs some API owner to approve the changes in expectations for virtual/webexposed tests. But since the branch point for M97 is the 4th, it might be better to wait and land it in M98, just in case.

Yoav Weiss

unread,
Oct 31, 2021, 4:54:48 AM10/31/21
to Andreu Botella, blink-dev, Joe Medley, Manuel Rego, fs...@chromium.org, Chris Harrelson
Ok. Feel free to send code reviews my way. (At least for the webexposed part)
Reply all
Reply to author
Forward
0 new messages