Created attachment 446576 [details] layered imports not preloaded Test case: https://purring-various-felidae.glitch.me/css-import-preload-layer.html It tests if the following CSS imports are preloaded: <style> @import url('/stylesheet?delay=1001'); @import url('/stylesheet?delay=1002') layer; @import url('/stylesheet?delay=1003') layer(foo); </style> (Here delay=foo means the request takes foo ms to finish) All the three should be preloaded, but as I tested in Safari Technology Preview Release 135 (Safari 15.4, WebKit 17613.1.7.3), the two layered imports are not preloaded. They start loading only after the parser-blocking script have finished, as shown by the attached screenshot. This will hurt the loading performance when using cascade layers, since @import is currently the only way to add an external stylesheet into a layer.
<rdar://problem/86586969>
Created attachment 449326 [details] Patch
Created attachment 449328 [details] Patch
Created attachment 449330 [details] Patch
Committed r288099 (246113@main): <https://commits.webkit.org/246113@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 449330 [details].