Initial structuredClone implementation (#32960)

* Initial structuredClone implementation

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Rename PostMessageOptions to StructuredSerializeOptions

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Update wpt test 2020 layout result

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Remove dublicated StructuredClone implementation

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Remove comment from StructuredSerializeOptions webidl

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
This commit is contained in:
Taym Haddadi 2024-08-08 12:12:45 +02:00 committed by GitHub
parent f989d3776e
commit 08eb4faf4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 74 additions and 862 deletions

View file

@ -6,7 +6,7 @@
[Global=(Worker,DedicatedWorker), Exposed=DedicatedWorker]
/*sealed*/ interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
[Throws] undefined postMessage(any message, sequence<object> transfer);
[Throws] undefined postMessage(any message, optional PostMessageOptions options = {});
[Throws] undefined postMessage(any message, optional StructuredSerializeOptions options = {});
attribute EventHandler onmessage;
undefined close();

View file

@ -9,7 +9,7 @@
[Exposed=(Window,Worker)]
interface MessagePort : EventTarget {
[Throws] undefined postMessage(any message, sequence<object> transfer);
[Throws] undefined postMessage(any message, optional PostMessageOptions options = {});
[Throws] undefined postMessage(any message, optional StructuredSerializeOptions options = {});
undefined start();
undefined close();
@ -18,6 +18,6 @@ interface MessagePort : EventTarget {
attribute EventHandler onmessageerror;
};
dictionary PostMessageOptions {
dictionary StructuredSerializeOptions {
sequence<object> transfer = [];
};

View file

@ -8,7 +8,7 @@ interface ServiceWorker : EventTarget {
readonly attribute USVString scriptURL;
readonly attribute ServiceWorkerState state;
[Throws] undefined postMessage(any message, sequence<object> transfer);
[Throws] undefined postMessage(any message, optional PostMessageOptions options = {});
[Throws] undefined postMessage(any message, optional StructuredSerializeOptions options = {});
// event
attribute EventHandler onstatechange;

View file

@ -188,6 +188,6 @@ partial interface Window {
[Replaceable] readonly attribute any event; // historical
};
dictionary WindowPostMessageOptions : PostMessageOptions {
dictionary WindowPostMessageOptions : StructuredSerializeOptions {
USVString targetOrigin = "/";
};

View file

@ -28,6 +28,10 @@ interface mixin WindowOrWorkerGlobalScope {
Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options = {});
// Promise<ImageBitmap> createImageBitmap(
// ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options);
// structured cloning
[Throws]
any structuredClone(any value, optional StructuredSerializeOptions options = {});
};
// https://w3c.github.io/hr-time/#the-performance-attribute

View file

@ -15,7 +15,7 @@ interface Worker : EventTarget {
undefined terminate();
[Throws] undefined postMessage(any message, sequence<object> transfer);
[Throws] undefined postMessage(any message, optional PostMessageOptions options = {});
[Throws] undefined postMessage(any message, optional StructuredSerializeOptions options = {});
attribute EventHandler onmessage;
attribute EventHandler onmessageerror;
};