Closed Bug 1854077 Opened 1 year ago Closed 22 days ago

Enable "fetchpriority" feature by default

Categories

(Core :: Networking, task, P3)

task

Tracking

()

RESOLVED FIXED
132 Branch
Tracking Status
relnote-firefox --- 132+
firefox132 --- fixed

People

(Reporter: mbrodesser-Igalia, Assigned: valentin)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, Whiteboard: [necko-triaged])

Attachments

(1 file)

Setting as P2 for pref flipping on nightly. Release status unclear ATM

Severity: -- → N/A
Priority: -- → P2
Whiteboard: [necko-triaged][necko-priority-new]

Valentin, what do you think?

Flags: needinfo?(valentin.gosu)
Whiteboard: [necko-triaged][necko-priority-new] → [necko-triaged][necko-priority-review]

As a side note, once we're happy with this behaviour in nightly, I would really love to see a performance experiment run with this feature.
I believe this was called "PriortyHints" and looks to be growing in popularity recently, via the ChromeStatus view, about 12.5% of sites in August.

As far as I can tell we only implement fetch priority for script elements at the moment.
I don't think there's any risk to shipping this without supporting it for all elements, but I do expect some of the performance benefits won't be visible until we do so.

Flags: needinfo?(valentin.gosu)

(In reply to Valentin Gosu [:valentin] (he/him) from comment #4)

As far as I can tell we only implement fetch priority for script elements at the moment.

Yes. The implementation for other elements is in progress, see the dependent bugs of https://bugzilla.mozilla.org/show_bug.cgi?id=1797715.

I don't think there's any risk to shipping this without supporting it for all elements, but I do expect some of the performance benefits won't be visible until we do so.

The fetchpriority implementation for all elements is guarded behind the same pref. Each implementation will be landed in a separate patch or patches, in order to avoid local bit rotting. Therefore suggesting to enable the feature by default only once all implementations have landed.

Priority: P2 → P3
Whiteboard: [necko-triaged][necko-priority-review] → [necko-triaged]

Currently, the DOM part for fetchpriority is essentially complete.

At the end, we decided a safer approach for the "implementation-defined" part i.e. instead of following https://web.dev/articles/fetch-priority?hl=en#browser_priority_and_fetchpriority we are trying to keep Gecko's current behavior and we introduced network.fetchpriority.adjustments.* preferences so that we can more easily experiment how we want to map fetchpriority to internal priorities.

For now enabling the flag will only affect internal priority when fetchpriority=high/low is specified and for HTTP/2 requests.

I think it makes sense to try to enable the flag with the current implementation and then refine later the handling of priority mapping and network headers.

Anyway, for now I'll open a separate bug to enable the flag in nightly so we can start experimenting it a bit more.

Depends on: 1882548
Depends on: 1900555
Assignee: nobody → valentin.gosu
Status: NEW → ASSIGNED
Pushed by valentin.gosu@gmail.com: https://hg.mozilla.org/integration/autoland/rev/3810455b1b3c Enable "fetchpriority" feature by default r=acreskey

Do you plan to send an intent to ship email to dev-platform@mozilla.org or should I send one ?

Flags: needinfo?(valentin.gosu)

Hi Frédéric, I wouldn't mind if you sent it.
Here's the template: https://wiki.mozilla.org/ExposureGuidelines#Intent_to_ship
Thanks!

Flags: needinfo?(valentin.gosu)

And we should flag this one for release notes too.

I can take care of getting https://caniuse.com/ updated.

Status: ASSIGNED → RESOLVED
Closed: 22 days ago
Resolution: --- → FIXED
Target Milestone: --- → 132 Branch

(In reply to Andrew Creskey [:acreskey] from comment #12)

And we should flag this one for release notes too.

I think setting dev-doc-needed is enough? Someone from MDN will take care of updating the BCD info, MDN articles, and Firefox release notes.

I can take care of getting https://caniuse.com/ updated.

Thanks!

(In reply to Frédéric Wang (:fredw) from comment #14)

(In reply to Andrew Creskey [:acreskey] from comment #12)

And we should flag this one for release notes too.

I think setting dev-doc-needed is enough? Someone from MDN will take care of updating the BCD info, MDN articles, and Firefox release notes.

Yes, I believe that is the case, but let's watch it carefully.

I can take care of getting https://caniuse.com/ updated.
This feature on caniuse is pulled from browser-compat-data/
https://github.com/mdn/browser-compat-data/pull/24518

Please add a relnote-firefox request on this when you get a chance.

Flags: needinfo?(valentin.gosu)

I'll take care of the relnote since I did the intent to ship (I guess valentin is ok with that)

Flags: needinfo?(valentin.gosu)

Release Note Request (optional, but appreciated)

[Why is this notable]: New attributes on img/script/link, RequestInit and Link HTTP headers, affecting timing of resource loading.

[Suggested wording]: The fetchpriority attribute enables web developers to optimize resource loading by specifying the relative priority of resources to be fetched by the browser. It accepts three values: auto (default priority), low (lower priority), high (higher priority). It can be specified on script, link, img elements, on the RequestInit parameter of the fetch() method and Link response headers. The HTML specification leaves the detailed interpretation of this attribute up to implementers. Firefox will typically use it to increase or decrease the urgency parameter of HTTP/2 and HTTP/3 requests.

[Links (documentation, blog post, etc)]:

https://web.dev/articles/fetch-priority
https://notes.igalia.com/s/dGX-j1_7O#
https://frederic-wang.fr/2024/09/05/my-recent-contributions-to-gecko-fetch-priority/
https://firefox-source-docs.mozilla.org/networking/http/prioritization.html (bug 1915852)
https://html.spec.whatwg.org/#fetch-priority-attribute
https://html.spec.whatwg.org/#the-img-element:fetch-priority-attribute
https://html.spec.whatwg.org/#the-script-element:fetch-priority-attribute
https://html.spec.whatwg.org/#the-link-element:fetch-priority-attribute
https://fetch.spec.whatwg.org/#enumdef-requestpriority
https://html.spec.whatwg.org/#processing-link-headers:fetch-priority-attribute
https://www.rfc-editor.org/rfc/rfc9218.html#section-4.1

relnote-firefox: --- → ?

(In reply to Andrew Creskey [:acreskey] from comment #15)

I can take care of getting https://caniuse.com/ updated.
This feature on caniuse is pulled from browser-compat-data/
https://github.com/mdn/browser-compat-data/pull/24518

OK cool that will be less effort (that's what I meant by BCD, sorry). I checked on MDN/BCD and I think we might need to document a bit more. At least fetchattribute is not mentioned on the Link HTTP header https://github.com/mdn/browser-compat-data/pull/24518#pullrequestreview-2330188832 ; also found https://github.com/mdn/browser-compat-data/issues/20590 (bug 1847712).

(In reply to Frédéric Wang (:fredw) from comment #14)

(In reply to Andrew Creskey [:acreskey] from comment #12)

And we should flag this one for release notes too.

I think setting dev-doc-needed is enough? Someone from MDN will take care of updating the BCD info, MDN articles, and Firefox release notes.

I can take care of getting https://caniuse.com/ updated.

Just to be clear, setting dev-doc-needed is an indicator for the MDN team to update the info on the MDN website, while the relnote-firefox flag is meant for the release notes team to add the feature to the https://www.mozilla.org/en-US/firefox/*/releasenotes/ page. And as far as I know, those two teams work independently from each other. (Someone please correct me if I'm wrong here!)
So, dev-doc-needed should be added for all web features that require documentation for website authors. And relnote-firefox should be requested if you believe it's worth to be mentioned in the general Firefox release notes.

Sebastian

Added to the Fx132 relnotes.

(In reply to Frédéric Wang (:fredw) from comment #18)

[Suggested wording]: The fetchpriority attribute enables web developers to optimize resource loading by specifying the relative priority of resources to be fetched by the browser. It accepts three values: auto (default priority), low (lower priority), high (higher priority). It can be specified on script, link, img elements, on the RequestInit parameter of the fetch() method and Link response headers. The HTML specification leaves the detailed interpretation of this attribute up to implementers. Firefox will typically use it to increase or decrease the urgency parameter of HTTP/2 and HTTP/3 requests.

If we could ensure that we highlight the pageload performance impacts, I think our users would like to hear it :)
Something like:

"The fetchpriority attribute lets developers prioritize resource loading, ensuring that important assets load faster, improving page speed.
...
"

MDN docs work for this can be tracked in https://github.com/mdn/content/issues/36121

(:sebo) - you are correct (entirely) in https://bugzilla.mozilla.org/show_bug.cgi?id=1854077#c20 - dev-doc-needed is the MDN flag, and the teams are independent. That won't stop me reusing some of the release note information. We replace that with dev-doc-complete when the work is done so you know we think that it has been handled.

I don't know enough yet to useful comment on what I will be doing for this, but I may be back with questions after looking at the spec.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: