[CSS Modules] synchronously process blob URLs #55779
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After switching to Blob URL's in C:7075691, I noticed that the fetched
stylesheet is not always available immediately in a fully declarative
scenario (where both the style tag is a module and
shadowrootadoptedstylesheets references it), which wasn't the case for
dataURI's. Typically, the first n fetches fail to fetch, where n is
random.
I discovered that dataURI's were always synchronously returned from
ResourceFetcher via CreateResourceForStaticData.
To match this behavior with Blob URL's, this CL adds a new parameter to
synchronously fetch Blob URL's when initiated via
shadowrootadoptedstylesheets. Blob URL's remain async in all otherscenarios.
This behavior won't cause the same undesirable issues that synchronous
XHR faced because Blob URL's are typically local (and will always be
in-memory when generated via Declarative CSS Modules).
A test was added that failed ~50% of the time without this change.
This change will address the current undesirable behavior, but I'll
investigate what this would look like to make fully async with a
callback. This will take some time and will need input from the WHATWG
so for now this change will make the current design usable.
Bug: 448174611
Change-Id: If50701981f7eaa138fff7d9ca799431c3303fa72
Reviewed-on: https://chromium-review.googlesource.com/7093679
WPT-Export-Revision: 4d14e64b3eeb0a61bbb466b20be7df8bc0305b82