Skip to content

Conversation

@chromium-wpt-export-bot
Copy link
Collaborator

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 other
scenarios.

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

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 other
scenarios.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants