Closed Bug 1839315 Opened 1 year ago Closed 11 months ago

Add "fetchpriority" attribute to <link> element and `Link` headers, first parts

Categories

(Core :: Networking, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
121 Branch
Tracking Status
firefox121 --- fixed

People

(Reporter: mbrodesser-Igalia, Assigned: mbrodesser-Igalia)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(8 files, 9 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
Whiteboard: [necko-triaged]
Priority: -- → P2

The standard defines multiple link types (https://html.spec.whatwg.org/multipage/semantics.html#attr-link-rel), so perhaps this requires updating more loader functions than the ones mentioned in https://bugzilla.mozilla.org/show_bug.cgi?id=1797715#c2.

When implementing this, grep the code for references to this bug (e.g. grep -i "Bug <bugnumber>").

Assignee: nobody → mbrodesser
Status: NEW → ASSIGNED
Depends on: 1852740
Depends on: 1852754
Summary: Add "fetchpriority" attribute to <link> element → Add "fetchpriority" attribute to <link> element and `Link` headers

Setting the internal priority depending on the fetchPriority will be
implemented in a following part.

Depends on D189935

Keywords: leave-open
Depends on: 1856942
Attachment #9356374 - Attachment description: Bug 1839315: part 1) Lift code for `fetchpriority` attribute from `HTMLScriptElement` to `nsGenericHTMLElement`. r=#necko → Bug 1839315: part 1) Lift code for `fetchpriority` attribute from `HTMLScriptElement` to `nsGenericHTMLElementWithFetchPriorityAttribute`. r=smaug
Attachment #9356376 - Attachment description: Bug 1839315: part 2) Add `fetchPriority` attribute to HTMLLinkElement's DOM interface. r=#necko → Bug 1839315: part 2) Add `fetchPriority` attribute to HTMLLinkElement's DOM interface. r=saschanaz
Attachment #9356539 - Attachment description: Bug 1839315: part 3) Remove no-op method `PreloaderBase::PrioritizeAsPreload`. r=#necko → Bug 1839315: part 3) Remove no-op method `PreloaderBase::PrioritizeAsPreload`. r=valentin

Otherwise it's hard to understand what's supposed to happen there.

Depends on D190666

Pushed by mbrodesser@igalia.com: https://hg.mozilla.org/integration/autoland/rev/2598def65c5c part 3) Remove no-op method `PreloaderBase::PrioritizeAsPreload`. r=necko-reviewers,valentin
Pushed by mbrodesser@igalia.com: https://hg.mozilla.org/integration/autoland/rev/c66a394ad061 part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
Pushed by mbrodesser@igalia.com: https://hg.mozilla.org/integration/autoland/rev/9cafd79c8405 part 5) Add links to spec for parsing the Link header fields a HTTP header contains. r=necko-reviewers,valentin

The function is more than 250 lines long
(https://searchfox.org/mozilla-central/rev/5ad226c7379b0564c76dc3b54b44985356f94c5a/netwerk/base/nsNetUtil.cpp#3448-3703)
and will be extended in a following part.
This refactoring allows to extend the new, simpler function instead.

Pushed by mbrodesser@igalia.com: https://hg.mozilla.org/integration/autoland/rev/0b6c07041133 part 7) Factor updating an attribute out of `net::ParseLinkHeader`. r=necko-reviewers,jesup

Setting the value currently has no user-observable effect. It will be
used in a following part.

Attachment #9359313 - Attachment description: Bug 1839315: part 8) Store the `fetchpriority` value from Link header fields in the `LinkHeader` struct. r=#necko → Bug 1839315: part 8) Store the `fetchpriority` value from Link header fields in the `LinkHeader` struct. r=manuel
Pushed by mbrodesser@igalia.com: https://hg.mozilla.org/integration/autoland/rev/75b27b040343 part 1) Lift code for `fetchpriority` attribute from `HTMLScriptElement` to `nsGenericHTMLElementWithFetchPriorityAttribute`. r=smaug https://hg.mozilla.org/integration/autoland/rev/7621c3c4c268 part 2) Add `fetchPriority` attribute to HTMLLinkElement's DOM interface. r=necko-reviewers,webidl,saschanaz,valentin https://hg.mozilla.org/integration/autoland/rev/9cf48ec99a06 part 6) Lift code for `fetchpriority` attribute from `nsGenericHTMLElementWithFetchPriorityAttribute` to `nsGenericHTMLElement`. r=smaug
Depends on: 1860568
Pushed by mbrodesser@igalia.com: https://hg.mozilla.org/integration/autoland/rev/8d15361d7639 part 8) Store the `fetchpriority` value from Link header fields in the `LinkHeader` struct. r=manuel

Includes only support for dynamically loading style sheets from <link>
elements and Link header fields.
The remaining support, including preloading, will be added in other
patches.

This is allows enabling the style tests in a following part. The other
tests can be separated when needed.

Depends on D191745

Depends on: 1862185

Allows passing the separated tests once as=fetch is supported, which
will happen in a following part.

For interoperability the expectations for as=fetch are adapted too
(https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/http/tests/priority-hints/link-preload-initial-load.html;l=39-52;drc=a7b04c9f4d4083e8e1a9d3ba15ba8030fe819719).

Depends on D192331

Allows the separate tests to pass. Otherwise passes are shadowed by
failures. The next parts make use of that.

The tests for images might be adapted in a following part to match the
priorities at
https://web.dev/articles/fetch-priority#browser_priority_and_fetchpriority.

Tests existing behavior. It differs from Chromium's, which assigns
highest priority instead of high.

The test is added for the fetchpriority feature because loading a
font-face font has overlapping code with linking fonts via <link rel=preload as=font> in FontPreloader
(https://searchfox.org/mozilla-central/rev/d6576544301cacc0e393fbc919c53e4e6b0d46ec/layout/style/FontPreloader.h#25).

Test is added for the same reason as the one for part 15:
in Gecko FontPreloader code is called.

Attachment #9363497 - Attachment description: Bug 1839315: part 15) Add test for internally assigned priority of font-face font. r=emilio → Bug 1839315: part 15) Add test for internally assigned priority of font-face. r=emilio
Attachment #9363690 - Attachment description: Bug 1839315: part 16) Add test for internally assigned priority of font-face font loaded from a worker. r=emilio → Bug 1839315: part 16) Add test for internally assigned priority of font-face loaded from a worker. r=emilio
Depends on: 1864861
Attachment #9363497 - Attachment description: Bug 1839315: part 15) Add test for internally assigned priority of font-face. r=emilio → Bug 1839315: part 15) Add test for internally assigned priority of font-face loaded from `<head>`. r=dholbert
Attachment #9363690 - Attachment description: Bug 1839315: part 16) Add test for internally assigned priority of font-face loaded from a worker. r=emilio → Bug 1839315: part 16) Add test for internally assigned priority of font-face loaded from a worker. r=dholbert
Attachment #9363872 - Attachment description: Bug 1839315: part 17) Add test for internally assigned priority of font-face loaded from a document. r=dholbert → Bug 1839315: part 17) Add test for internally assigned priority of font-face loaded from a script. r=dholbert

Comment on attachment 9356374 [details]
Bug 1839315: part 1) Lift code for fetchpriority attribute from HTMLScriptElement to nsGenericHTMLElementWithFetchPriorityAttribute. r=smaug

Revision D189935 was moved to bug 1865610. Setting attachment 9356374 [details] to obsolete.

Attachment #9356374 - Attachment is obsolete: true
Attachment #9356374 - Attachment is obsolete: false

Comment on attachment 9360017 [details]
Bug 1839315: part 9) Add partial support for the "fetchpriority" attribute for loading style sheets from <link> elements or Link header fields. r=smaug,emilio

Revision D191745 was moved to bug 1865610. Setting attachment 9360017 [details] to obsolete.

Attachment #9360017 - Attachment is obsolete: true
Blocks: 1865610

Comment on attachment 9360018 [details]
Bug 1839315: part 10) Separate tests for <link rel=preload as=style> and corresponding Link header tests from other as= tests. r=emilio

Revision D191746 was moved to bug 1865610. Setting attachment 9360018 [details] to obsolete.

Attachment #9360018 - Attachment is obsolete: true

Comment on attachment 9360234 [details]
Bug 1839315: part 11) Add fetchpriority attribute support for preloaded stylesheets. r=smaug,emilio,#necko-reviewers

Revision D191866 was moved to bug 1865610. Setting attachment 9360234 [details] to obsolete.

Attachment #9360234 - Attachment is obsolete: true

Comment on attachment 9361204 [details]
Bug 1839315: part 12) Add fetchpriority attribute support for rel=modulepreload and rel=preload as=script. r=smaug,valentin

Revision D192331 was moved to bug 1865610. Setting attachment 9361204 [details] to obsolete.

Attachment #9361204 - Attachment is obsolete: true

Comment on attachment 9361205 [details]
Bug 1839315: part 13) Separate tests for <link rel=preload as=fetch> from other <link rel=preload> tests. r=valentin

Revision D192332 was moved to bug 1865610. Setting attachment 9361205 [details] to obsolete.

Attachment #9361205 - Attachment is obsolete: true

Comment on attachment 9363277 [details]
Bug 1839315: part 14) Separate tests for <link rel=preload as=font> from other preload tests. r=valentin

Revision D193435 was moved to bug 1865610. Setting attachment 9363277 [details] to obsolete.

Attachment #9363277 - Attachment is obsolete: true

Comment on attachment 9363497 [details]
Bug 1839315: part 15) Add test for internally assigned priority of font-face loaded from <head>. r=dholbert

Revision D193550 was moved to bug 1865610. Setting attachment 9363497 [details] to obsolete.

Attachment #9363497 - Attachment is obsolete: true

Comment on attachment 9363690 [details]
Bug 1839315: part 16) Add test for internally assigned priority of font-face loaded from a worker. r=dholbert

Revision D193657 was moved to bug 1865610. Setting attachment 9363690 [details] to obsolete.

Attachment #9363690 - Attachment is obsolete: true

Comment on attachment 9363872 [details]
Bug 1839315: part 17) Add test for internally assigned priority of font-face loaded from a script. r=dholbert

Revision D193766 was moved to bug 1865610. Setting attachment 9363872 [details] to obsolete.

Attachment #9363872 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Keywords: leave-open
Resolution: --- → FIXED
Summary: Add "fetchpriority" attribute to <link> element and `Link` headers → Add "fetchpriority" attribute to <link> element and `Link` headers, first parts
Target Milestone: --- → 121 Branch
Blocks: 1877152
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: