Skip to content

Ff115 Sec-Purpose HTTP header plus some related changes in HTML - #27499

Merged
teoli2003 merged 5 commits into
mdn:mainfrom
hamishwillee:ff115_prefetch1
Jun 27, 2023
Merged

teoli2003 merged 5 commits into
mdn:mainfrom
hamishwillee:ff115_prefetch1

Conversation

@hamishwillee

Copy link
Copy Markdown
Collaborator

FF115 adds support for the Sec-Purpose HTTP header, replacing X-moz: prefetch in https://bugzilla.mozilla.org/show_bug.cgi?id=1836328. It is currently only supported by FF115, though Chrome uses Purpose for same reason. It has one directive prefetch which tells a server this is a prefetch originating from a <link> element with rel="prefetch"

The bigger picture of these docs is complicated because while prefetch has been supported forever, it has been done with different headers everywhere. The spec has now stablised and browsers are intending to move there, but none are. FF is closest.

The small picture is complicated because this header affects other header usage. And there is no really good place to include that info. See notes inline

Other docs work can be tracked in #27171

@github-actions github-actions Bot added Content:Glossary Glossary entries Content:HTML Hypertext Markup Language docs Content:HTTP HTTP docs labels Jun 23, 2023
@github-actions

github-actions Bot commented Jun 23, 2023 •

Copy link
Copy Markdown
Contributor

Preview URLs

Flaws (5)

Note! 1 document with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/HTTP/Headers/Sec-Purpose
Title: Sec-Purpose
Flaw count: 1

  • bad_bcd_queries:
    • No BCD data for query: http.headers.Sec-Purpose

URL: /en-US/docs/Web/HTML/Element/link
Title: <link>: The External Resource Link element
Flaw count: 3

  • broken_links:
    • Can't resolve /en-US/docs/Web/CSS/Media_Queries
    • Can't resolve /en-US/docs/Web/CSS/Media_Queries
    • Can't resolve /en-US/docs/Web/CSS/Media_Queries

URL: /en-US/docs/Glossary/Fetch_metadata_request_header
Title: Fetch metadata request header
Flaw count: 1

  • macros:
    • /en-US/docs/Glossary/resource_isolation_policy does not exist
External URLs (1)

URL: /en-US/docs/Web/HTTP/Headers/Sec-Purpose
Title: Sec-Purpose

(comment last updated: 2023-06-27 04:30:58)

- : Indicates the request's destination.
It is a Structured Header whose value is a token with possible values `audio`, `audioworklet`, `document`, `embed`, `empty`, `font`, `image`, `manifest`, `object`, `paintworklet`, `report`, `script`, `serviceworker`, `sharedworker`, `style`, `track`, `video`, `worker`, and `xslt`.

The following request headers are not _strictly_ "fetch metadata request headers", but similarly provide information about the context of how a resource will be used.

@hamishwillee hamishwillee Jun 23, 2023 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure whether or not I can characterize these two as Fetch metadata request headers. They are in a different spec https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-mode-header vs the fetch spec. However they serve a similar purpose, which is to tell the server some context about the way the resource will be used, so it can configure itself appropriately.

I have put them as part of the metadata headers here (and in the glossary) and in the glossary stated that they are in different specs. Is this OK?


- `as`

- : This attribute is only used when `rel="preload"` or `rel="prefetch"` has been set on the `<link>` element.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI This is a complication that we will need to workaround. The spec only allows as in preload. However chrome allows it to specify document and has some off spec special handling. I have matched the spec here, but will need to add a BCD entry for as is ignored in link with rel="prefetch"

Comment on lines +75 to +79
> **Note:** At time of writing FireFox incorrectly sets the `Accept` header as `Accept: */*` for this case.
> This issue can be tracked in [Firefox bug 1836334](https://bugzil.la/1836334).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to note this but I had to fake the example since nothing is compliant (only FF115 implements the header). I figure this makes it easy to regenerate the proper example once something is compliant.

@hamishwillee hamishwillee Jun 23, 2023 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the info about Accept is recorded in BCD as a note for Sec-Purpose.

@hamishwillee
hamishwillee marked this pull request as ready for review June 27, 2023 04:34
@hamishwillee
hamishwillee requested review from a team, chrisdavidmills and teoli2003 and removed request for a team June 27, 2023 04:34

@teoli2003 teoli2003 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@teoli2003
teoli2003 merged commit 5415516 into mdn:main Jun 27, 2023
@hamishwillee
hamishwillee deleted the ff115_prefetch1 branch June 30, 2023 02:01
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Content:Glossary Glossary entries Content:HTML Hypertext Markup Language docs Content:HTTP HTTP docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants