Closed Bug 1827941 Opened 1 year ago Closed 1 year ago

Make @import preload scanner deal well with supports()

Categories

(Core :: CSS Parsing and Computation, task, P3)

task

Tracking

()

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: emilio, Assigned: canadahonk)

References

Details

Attachments

(1 file)

We should consider fixing layout/style/ImportScanner.cpp so that we don't preload @import ... supports() if we don't actually support the relevant feature.

Added evaluating supports() conditions in the import preload scanner
and not emitting URLs if they do not match.

There is no use preloading imports for features we do not support,
as they will never be loaded since supports() conditions cannot
change mid-page.

WIP. Todo:

  • Address TODO comments added
  • Testing/etc

@emilio would you mind looking at the patch when free and seeing if you can tell why 1 new gtest is failing? Can't find a cause myself, thanks!

Flags: needinfo?(emilio)

So you're doing:

if (OptionalSupportsMatches(...)) {
  EmitUrl();
}

But EmitUrl() not only emits the url but also resets the rule state, and you're not doing that if the supports doesn't match.

So it seems you should move the supports() check to EmitUrl(), also so that it gets caught in early-eof.

Flags: needinfo?(emilio)
Attachment #9328468 - Attachment description: WIP: Bug 1827941 - Do not preload nonmatching @import supports() → Bug 1827941 - Do not preload nonmatching @import supports()
Assignee: nobody → oj
Status: NEW → ASSIGNED
Pushed by oj@oojmed.com:
https://hg.mozilla.org/integration/autoland/rev/0a9fbe8c409f
Do not preload nonmatching @import supports() r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/39678 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch
Regressions: 1830050
Upstream PR merged by moz-wptsync-bot
Blocks: 1830779
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: