Structured clone for extension messaging

32 views
Skip to first unread message

Justin Lulejian

unread,
4:46 PM (2 hours ago) 4:46 PM
to Chromium Extensions, Oliver Dunk, juraj....@gmail.com

Hi all,

I just published a blog post about a new feature for Chrome Extensions: Unlock Structured Clone for Chrome Extension Messaging.

Starting in Chrome 148, you can opt-in to use the structured clone algorithm for message serialization instead of JSON. This modernization allows you to send more complex data types—like Map, Set, Blob, and File—directly between extension contexts without the need for manual serialization workarounds.

To enable this, simply add the following key and value to your manifest.json:

```
{ "message_serialization": "structured_clone" }
```

We hope this provides more flexibility and power when building extensions!


Thanks,

Justin, on behalf of the Chromium Extensions Team

Cuyler Stuwe

unread,
6:04 PM (1 hour ago) 6:04 PM
to Justin Lulejian, Chromium Extensions, Oliver Dunk, juraj....@gmail.com
Thanks for this!

I think it would be useful to write (here and/or in the blog post) about when and why you’d pick one over the other (especially given that the blog shows that you intend to support both indefinitely).

For example, several years ago, the structured clone implementation seemed to be meaningfully-less performant than serialization for large simple objects across multiple browsers (including Chromium-based browsers). No idea whether this is still the case today. Is it?

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/fbc16591-567f-4d9e-aae7-7578d45931a9n%40chromium.org.
Reply all
Reply to author
Forward
0 new messages