structured clone algorithm (`structuredClone`, `History.prototype.replaceState` etc) refuses to clone `Error` object(s)
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: armen.michaeli, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0
Steps to reproduce:
Called structuredClone
with new DOMException("Hello world", "AbortError")
. Alternatively, called the former with new Error("Hello")
.
Actual results:
The method threw a "DataCloneError" error of class DOMException
with the message "The object could not be cloned.".
Expected results:
I would expect structurally cloning relatively simple Error
objects (or some/all of their subclasses, like DOMException
) to succeed. Granted, I am not sure HTML 5 specifically mandates Error
objects be cloned or not -- https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal puts in a way where it might depend on implementation -- for example if Firefox considers Error
to be serializable in the first place. Steps 17, 19 and 20 in the list describing the algorithm, may be relevant.
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•2 years ago
|
Reporter | ||
Comment 3•2 years ago
|
||
Thanks Tom. I couldn't find the duplicate issue (Bugzilla listed something it found but the one you linked wasn't listed).
Description
•