Support structured cloning of Error stacks
Categories
(Core :: DOM: Core & HTML, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox110 | --- | fixed |
People
(Reporter: evilpie, Assigned: evilpie)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete)
Attachments
(3 files, 2 obsolete files)
Internally the stack of an Error object is represented using SavedFrames. These SavedFrames have an associated principal to make sure that we don't leak cross-origin stack frames or allow other unprivileged accesses. This is a problem because principals currently don't work well off-the-main-thread. We can "write" (clone) principals on Worker or Worklet threads, but we can only "read" and "write" principals on the main thread.
For example that means we can support sending Error stacks from a Worker to the main script, but not in reverse.
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 1•1 year ago
|
||
Assignee | ||
Comment 2•1 year ago
|
||
Depends on D149696
Updated•1 year ago
|
Assignee | ||
Updated•11 months ago
|
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/b3668b759a13 Support error stacks in main-thread structuredClone(). r=smaug
Comment 4•11 months ago
|
||
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/34612 for changes under testing/web-platform/tests
Comment 6•11 months ago
|
||
Upstream PR merged by moz-wptsync-bot
Comment 7•11 months ago
|
||
Assignee | ||
Updated•11 months ago
|
Assignee | ||
Comment 8•11 months ago
|
||
Depends on D150625
Assignee | ||
Comment 9•11 months ago
|
||
Could you take a look at my patch in comment 8 and tell me if that approach makes any sense? We can only read principals on the main thread, so I am trying to only allow postMessaging when the target is the main thread.
Comment 11•11 months ago
|
||
Do we want to support history.pushState() ?
Assignee | ||
Comment 12•11 months ago
|
||
(In reply to Olli Pettay [:smaug] from comment #11)
Do we want to support history.pushState() ?
I don't think anything speaks against it. This seems to be a Window (main-thread) only API.
So far I have mostly been trying to just work on what I think is important.
Could you also look at the Worker patch, I would like to make some progress there.
Comment 13•11 months ago
|
||
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/1ba46b75162c Support error stacks in window.postMessage. r=smaug
Comment 14•11 months ago
|
||
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/34831 for changes under testing/web-platform/tests
Comment 15•11 months ago
|
||
bugherder |
Comment 16•11 months ago
|
||
Upstream PR merged by moz-wptsync-bot
Comment 17•11 months ago
•
|
||
Docs note:
My understanding is that this is to go into FF104. This is a tracking note so we remember to update the docs (in particular the release note). BCD will already include this information from the update in https://github.com/mdn/browser-compat-data/pull/17008
I also added dev-doc-needed so we can track this.
Updated•11 months ago
|
Comment 18•10 months ago
|
||
FF104 docs for this can be tracked in https://github.com/mdn/content/issues/18998
Tom, this is marked as "leave open" . Is there anything that will change about this feature?
The BCD already has this note:
"Version 104 additionally supports serialization of
stack
inwindow.postMessage()
andstructuredClone()
.
I think all we need to do is add a docs release note that says much the same thing.
Assignee | ||
Comment 19•10 months ago
|
||
Is there anything that will change about this feature?
We are going to add stack
cloning support to other APIs like worker's postMessage.
For now the documentation looks good.
Comment 20•10 months ago
|
||
Thanks very much. Not removing dev-doc-needed because presumably we'll need to track those other additions.
Updated•6 months ago
|
Updated•6 months ago
|
Assignee | ||
Comment 22•6 months ago
|
||
Comment 23•6 months ago
|
||
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/8732c83f62f8 Always allow cloning error stacks. r=nika,sfink,smaug
Comment 24•6 months ago
|
||
bugherder |
Assignee | ||
Updated•6 months ago
|
Assignee | ||
Updated•6 months ago
|
Assignee | ||
Updated•6 months ago
|
Comment 25•5 months ago
|
||
MDN updates can be tracked here https://github.com/mdn/content/issues/23686
Comment 26•4 months ago
•
|
||
Support for structured cloning of native types in FF104 (Bugzilla #1556604 "Allow structured cloning of native error types") was added for serializing stack in window.postMessage()
and structuredCloned()
. This resulted in addition of compatibility notes as shown here: https://github.com/mdn/browser-compat-data/pull/17008
Comment 19 above says:
We are going to add stack cloning support to other APIs like worker's postMessage.
- Can you confirm that this was what is delivered by this bug fix? Anything else?
- My assumption is that this can just be added as another note to the compatibility data like the ones in the issue linked above (i.e. it is not that the implementation was partially spec compliant and is fully compliant now - since the spec just says "serialize interesting data").
Assignee | ||
Comment 27•4 months ago
|
||
Can you confirm that this was what is delivered by this bug fix? Anything else?
Yeah. Cloning native error stacks now works for everything that uses the structured clone algorithm. e.g. postMessage, structuredClone in Workers etc.
The only related missing thing is now bug 1777321.
Comment 28•4 months ago
|
||
Thanks very much. FYI only, I've updated the browser compatibility as indicated and added an MDN release note (see status here). I don't think anything else is needed.
Description
•