Currently, there are various NeverDestroyed singletons involved in CSS parsing that are not intended to ever be used off of the main thread. A sub-set of CSS parsing is required for full OffscreenCanvas support (colour and font strings), so it'd be good for these singletons to be correctly declared as MainThreadNeverDestroyed so that if they are accidentally ever used off of the main thread, we would start to get test failures in debug mode.
Created attachment 408451 [details] Patch
Note that I changed the RenderTheme singletons for Gtk/Adwaita to MainThread but I haven't touched other platforms as I don't know if they have the same restriction. I expect, perhaps bar iOS, they do, but I'd rather not make the change blind, so if this is accepted, we can open a separate bug/bugs to keep track of other platforms that this doesn't include. I do wonder if NeverDestroyed should default to asserting the creation thread and the exception should be allowing concurrent access, rather than this way round.
Created attachment 408525 [details] Patch
Created attachment 408685 [details] Patch
Committed r267009: <https://trac.webkit.org/changeset/267009> All reviewed patches have been landed. Closing bug and clearing flags on attachment 408685 [details].
<rdar://problem/68838178>