Closed Bug 1598613 Opened 5 years ago Closed 4 years ago

Speculative loader should respect the `media` attribute of the <link> tag

Categories

(Core :: DOM: HTML Parser, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox87 --- fixed

People

(Reporter: mayhemer, Assigned: emilio)

References

(Blocks 2 open bugs)

Details

Attachments

(4 files)

HTML link media Attribute
According to the speculative loader code we make requests for stylesheets that don't match the media criteria because the attribute is not at all consulted at the prescan phase.

Blocks: rel=preload
Depends on: 1594449
Assignee: nobody → emilio
Status: NEW → ASSIGNED

Just drive-by cleanup, no behavior change.

There's an using namespace mozilla, so also remove some useless
namespace qualifications while at it.

Depends on D103562

Hah, I noticed the same bug looking at the code today.

Just drive-by cleanup, no behavior change.

Depends on D103563

<link media> applies to both <link rel="stylesheet"> (see
HTMLLinkElement::GetStyleSheetInfo) and all link rel="preload" links,
regardless of as value (see HTMLLinkElement::CheckPreloadAttrs), so pass it
down and check them for all of those cases.

Note that in the <link rel="stylesheet"> case we'd still have to load it, but
it doesn't block rendering and we defer its loading until more important
stylesheets are done (see SheetLoadData::ShouldDefer() which returns false if
the media attribute didn't match). So speculatively loading it seems
counter-productive.

Depends on D103564

Keywords: leave-open
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fa8d88accd56 Remove some useless kNamespaceID_Nones in HTMLLinkElement. r=edgar https://hg.mozilla.org/integration/autoland/rev/58e8fee8294f Fix non-unified build in nsHtml5TreeOpExecutor.cpp. r=edgar https://hg.mozilla.org/integration/autoland/rev/f77537699913 Remove single-caller method in PreloadService. r=edgar
Keywords: leave-open
Blocks: 1689970
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dde9b51dd13b Account for <link media=""> for speculative loads of stylesheet and preload links. r=hsivonen
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/27422 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: