[Webkit-unassigned] [Bug 241704] New: Preparser does not download stylesheets before running inline scripts

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jun 16 15:31:12 PDT 2022


            Bug ID: 241704
           Summary: Preparser does not download stylesheets before running
                    inline scripts
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKit Misc.
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: nlawson at salesforce.com

Created attachment 460277

  --> https://bugs.webkit.org/attachment.cgi?id=460277&action=review

Screenshot showing behavior in Chrome, Firefox, and Safari

The speculative HTML preparser in WebKit does not seem to eagerly download stylesheets in the HTML that follow an inline script, whereas Firefox and Chrome do.

A simple test:

  const start = Date.now()
  while (Date.now() - start < 2000) {
    // block rendering
<link rel="stylesheet" href="./one.css">
<link rel="stylesheet" href="./two.css">

In this case, Safari (and WebKit Nightly 25167) will not start downloading the CSS until the 2000ms render-blocking script is run. Whereas Firefox and Chrome start eagerly downloading both CSS files before the script finishes.

Incidentally, the same behavior can be seen for inline @imports:

    @import './one.css';
    @import './two.css';

(I.e. imports behave the same as links in all three browsers.)

Here are live repros to demonstrate:

- Links: https://bl.ocks.org/nolanlawson/raw/871eced59d144dbe4bec242c1e45c8f1/links.html
- Imports: https://bl.ocks.org/nolanlawson/raw/871eced59d144dbe4bec242c1e45c8f1/imports.html

Note that Safari takes >2000ms to start downloading the CSS files, as reported by the performance resource timings, whereas Firefox and Chrome take much less than 2000ms.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220616/a469924b/attachment-0001.htm>

More information about the webkit-unassigned mailing list