8000 LibWeb: Set the initiator type for script-initiated CSS requests by trflynn89 · Pull Request #4625 · LadybirdBrowser/ladybird · GitHub
[go: up one dir, main page]

Skip to content

Conversation

trflynn89
Copy link
Contributor

Similar to other ad-hoc behavior in this method, we need to handle requests which are not associated with a style sheet. For example:

<script>
    const element = document.createElement('div');
    element.style['background'] = 'url(https://foo.com/img.png)';
    document.body.appendChild(element);
</script>

Will not be associated with a style sheet.

This is needed to ensure we fire a PerformanceResourceTiming event for this resource load. This is not currently testable in CI, as this event is also gated by HTTP/S requests.

This fixes the first subtest of https://wpt.fyi/results/css/fetching/fetch-resources.sub.html?label=master&label=experimental&product=ladybird&aligned. We then time out on the second subtest because we don't yet implement shape-outside, thus don't fetch the URL being waited upon.

Similar to other ad-hoc behavior in this method, we need to handle
requests which are not associated with a style sheet. For example:

    <script>
        const element = document.createElement('div');
        element.style['background'] = 'url(https://foo.com/img.png)';
        document.body.appendChild(element);
    </script>

Will not be associated with a style sheet.

This is needed to ensure we fire a PerformanceResourceTiming event for
this resource load. This is not currently testable in CI, as this event
is also gated by HTTP/S requests.
@trflynn89 trflynn89 requested a review from AtkinsSJ as a code owner May 6, 2025 14:30
Copy link
Member
@AtkinsSJ AtkinsSJ left a comment

Choose a reason for hiding this comment

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

👍

Can you make a CSS spec issue about this and tag @noamr in it? (Or mention it in one that I already opened.)

@trflynn89
Copy link
Contributor Author

Yep, planning to add a note to https://github.com/w3c/csswg-drafts/issues/12065, which seems to be the "we don't always have a style sheet" issue.

@AtkinsSJ AtkinsSJ enabled auto-merge (rebase) May 6, 2025 14:40
@AtkinsSJ AtkinsSJ merged commit 0da7441 into LadybirdBrowser:master May 6, 2025
7 checks passed
@trflynn89 trflynn89 deleted the css_fetch branch May 6, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0