Skip to content

Conversation

@chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Oct 30, 2025

After switching to Blob URL's in CL: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 immediately creates a
module map entry for a style type="module" upon parsing. This entry
can then be immediately queried when referenced from the
shadowrootadoptedstylesheets attribute, avoiding a fetch entirely.
DataURI's still need a fetch to generate the underlying object.

A test was added that failed ~50% of the time without this change.

Bug: 448174611
Change-Id: If50701981f7eaa138fff7d9ca799431c3303fa72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7093679
Commit-Queue: Kurt Catti-Schmidt <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1541305}

@chromium-wpt-export-bot chromium-wpt-export-bot changed the title [CSS Modules] synchronously process blob URLs [CSS Modules] Bypass fetch for Blob URL's Nov 6, 2025
@chromium-wpt-export-bot chromium-wpt-export-bot marked this pull request as ready for review November 6, 2025 18:57
After switching to Blob URL's in CL: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 immediately creates a
module map entry for a <style type="module"> upon parsing. This entry
can then be immediately queried when referenced from the
`shadowrootadoptedstylesheets` attribute, avoiding a fetch entirely.
DataURI's still need a fetch to generate the underlying object.

A test was added that failed ~50% of the time without this change.

Bug: 448174611
Change-Id: If50701981f7eaa138fff7d9ca799431c3303fa72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7093679
Commit-Queue: Kurt Catti-Schmidt <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1541305}
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@jonathan-j-lee jonathan-j-lee reopened this Nov 7, 2025
@chromium-wpt-export-bot chromium-wpt-export-bot merged commit 20e711c into master Nov 7, 2025
36 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-cl-7093679 branch November 7, 2025 02:01
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.

5 participants