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•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
Assignee | ||
Comment 2•2 years ago
|
||
Depends on D149696
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/b3668b759a13 Support error stacks in main-thread structuredClone(). r=smaug
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/34612 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Comment 7•2 years ago
|
||
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 8•2 years ago
|
||
Depends on D150625
Assignee | ||
Comment 9•2 years 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•2 years ago
|
||
Do we want to support history.pushState() ?
Assignee | ||
Comment 12•2 years 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•2 years ago
|
||
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/1ba46b75162c Support error stacks in window.postMessage. r=smaug
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/34831 for changes under testing/web-platform/tests
Comment 15•2 years ago
|
||
bugherder |
Upstream PR merged by moz-wptsync-bot
Comment 17•2 years 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•2 years ago
|
Comment 18•2 years 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•2 years 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•2 years ago
|
||
Thanks very much. Not removing dev-doc-needed because presumably we'll need to track those other additions.
Updated•1 year ago
|
Updated•1 year ago
|
Assignee | ||
Comment 22•1 year ago
|
||
Comment 23•1 year 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•1 year ago
|
||
bugherder |
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Comment 25•1 year ago
|
||
MDN updates can be tracked here https://github.com/mdn/content/issues/23686
Comment 26•1 year 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•1 year 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•1 year 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
•