Commit fe5fa0e
[CSS Modules] Bypass fetch for Blob URL's
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: If50701981f7eaa138fff7d9ca799431c3303fa721 parent 625ad19 commit fe5fa0e
File tree
1 file changed
+36
-0
lines changed- shadow-dom/declarative/tentative/shadowrootadoptedstylesheets
1 file changed
+36
-0
lines changedLines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
0 commit comments