diff --git a/files/en-us/web/api/web_workers_api/structured_clone_algorithm/index.md b/files/en-us/web/api/web_workers_api/structured_clone_algorithm/index.md index 5ffbefd426d4438..2d13fc4a5579d26 100644 --- a/files/en-us/web/api/web_workers_api/structured_clone_algorithm/index.md +++ b/files/en-us/web/api/web_workers_api/structured_clone_algorithm/index.md @@ -30,127 +30,55 @@ It clones by recursing through the input object while maintaining a map of previ ## Supported types - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Object typeNotes
- All primitive types - However, not symbols.
{{jsxref("Boolean")}} objects
{{jsxref("String")}} objects
{{jsxref("Date")}}
{{jsxref("RegExp")}}lastIndex is not preserved.
{{domxref("Blob")}}
{{domxref("File")}}
{{domxref("FileList")}}
{{jsxref("ArrayBuffer")}}
{{jsxref("TypedArray")}}
{{jsxref("DataView")}}
{{domxref("ImageBitmap")}}
{{domxref("ImageData")}}
{{domxref("DOMPoint")}}
{{domxref("DOMPointReadOnly")}}
{{domxref("DOMRect")}}
{{domxref("DOMRectReadOnly")}}
{{domxref("DOMQuad")}}
{{domxref("DOMMatrix")}}
{{domxref("DOMMatrixReadOnly")}}
{{jsxref("Array")}}
{{jsxref("Object")}}Only plain objects (e.g. from object literals)
{{jsxref("Map")}}
{{jsxref("Set")}}
{{domxref("DOMException")}}Browsers must serialize the properties {{domxref("DOMException.name","name")}} and {{domxref("DOMException.message","message")}}. - Other attributes may also be serialized/cloned.
Native Error types -

The error name must be one of: {{jsxref("Error")}}, {{JSxRef("EvalError")}}, {{JSxRef("RangeError")}}, {{JSxRef("ReferenceError")}}, {{JSxRef("SyntaxError")}}, {{JSxRef("TypeError")}}, {{JSxRef("URIError")}} (or will be set to "Error").

-

Browsers must serialize the properties name and message, and are expected to serialize other "interesting" properties of the errors such as stack, cause, etc.

-

{{JSxRef("AggregateError")}} support is expected to be added to the specification in whatwg/html#5749 (and is already supported in some browsers).

-
+### JavaScript types + +- {{jsxref("Array")}} +- {{jsxref("ArrayBuffer")}} +- {{jsxref("Boolean")}} +- {{jsxref("DataView")}} +- {{jsxref("Date")}} +- {{jsxref("Error")}} types (but see [Error types](#error_types) below). +- {{jsxref("Map")}} +- {{jsxref("Object")}} objects: but only plain objects (e.g. from object literals). +- [Primitive types](/en-US/docs/Web/JavaScript/Data_structures#primitive_values), except `symbol`. +- {{jsxref("RegExp")}}: but note that `lastIndex` is not preserved. +- {{jsxref("Set")}} +- {{jsxref("String")}} +- {{jsxref("TypedArray")}} + +#### Error types + +For `Error` types, the error name must be one of: {{jsxref("Error")}}, {{JSxRef("EvalError")}}, {{JSxRef("RangeError")}}, {{JSxRef("ReferenceError")}}, {{JSxRef("SyntaxError")}}, {{JSxRef("TypeError")}}, {{JSxRef("URIError")}} (or will be set to "Error"). + +Browsers must serialize the properties `name` and `message`, and are expected to serialize other "interesting" properties of the errors such as `stack`, `cause`, etc. + +{{JSxRef("AggregateError")}} support is expected to be added to the specification in [whatwg/html#5749](https://github.com/whatwg/html/pull/5749) (and is already supported in some browsers). + +### Web/API types + +- {{domxref("AudioData")}} +- {{domxref("Blob")}} +- {{domxref("CropTarget")}} +- {{domxref("CryptoKey")}} +- {{domxref("DOMException")}}: browsers must serialize the properties {{domxref("DOMException.name","name")}} and {{domxref("DOMException.message","message")}}. Other attributes may also be serialized/cloned. +- {{domxref("DOMMatrix")}} +- {{domxref("DOMMatrixReadOnly")}} +- {{domxref("DOMPoint")}} +- {{domxref("DOMPointReadOnly")}} +- {{domxref("DOMQuad")}} +- {{domxref("DOMRect")}} +- {{domxref("DOMRectReadOnly")}} +- {{domxref("File")}} +- {{domxref("FileList")}} +- {{domxref("FileSystemDirectoryHandle")}} +- {{domxref("FileSystemFileHandle")}} +- {{domxref("FileSystemHandle")}} +- {{domxref("GPUCompilationInfo")}} +- {{domxref("GPUCompilationMessage")}} +- {{domxref("ImageBitmap")}} +- {{domxref("ImageData")}} +- {{domxref("RTCCertificate")}} +- {{domxref("VideoFrame")}} ## See also