Closed Bug 2085889 Opened 1 month ago Closed 15 days ago

Speculation-rules prefetch requests omit the Sec-Speculation-Tags header

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: sning, Assigned: sning)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [fxpe])

Attachments

(1 external file)

Speculation-rules prefetch requests omit the Sec-Speculation-Tags
header, even though the parsed tags are carried into the prefetch record.

In the Firefox 161.0a1 WPT run from 2026-10-26, both of these tests
successfully use the prefetched response, then fail when checking the tags:

  • speculation-rules/speculation-tags/prefetch-eagerness-pointer-down.https.html
    Expected: "conservative", "moderate"
    Actual: __no_tags__
  • speculation-rules/speculation-tags/prefetch-eagerness-pointer-hover.https.html
    Expected: "moderate"
    Actual: __no_tags__

The failure is therefore no longer a missing eagerness trigger or a failure
to reuse the prefetched response.

Expected:
Send Sec-Speculation-Tags with the applicable collected tags, following
the serialization and cross-site restrictions in the specification.

Implementation notes:
SpeculationRulesManager already passes the tags to PrefetchRecordParent,
which stores them in mTags. The request setup currently sets Sec-Purpose,
but does not appear to set Sec-Speculation-Tags.

Tests:
https://tests.firefox.dev/test.html?test=speculation-rules/speculation-tags/prefetch-eagerness-pointer-down.https.html
https://tests.firefox.dev/test.html?test=speculation-rules/speculation-tags/prefetch-eagerness-pointer-hover.https.html

Specification:
https://html.spec.whatwg.org/multipage/speculative-loading.html#the-sec-speculation-tags-header

Component: DOM: Content Processes → DOM: Core & HTML
Severity: -- → S3

The header is re-evaluated on every redirect and only sent to destinations that
are same-site with the referring document, as the speculation-tags WPTs expect.
The prefetch spec compares with the prefetch record's URL instead, which would
also tag cross-site prefetches.

Whiteboard: [fxpe]
Attachment #9671859 - Attachment description: WIP: Bug 2085889 - Send Sec-Speculation-Tags on speculation-rules prefetch requests. r?#necko-reviewers,sunil → Bug 2085889 - Send Sec-Speculation-Tags on speculation-rules prefetch requests. r?#necko-reviewers,sunil
Pushed by sning@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/139ac237e57d https://hg.mozilla.org/integration/autoland/rev/e7e822b7b2d5 Send Sec-Speculation-Tags on speculation-rules prefetch requests. r=necko-reviewers,sunil
Status: ASSIGNED → RESOLVED
Closed: 15 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
QA Whiteboard: [qa-triage-done-c163/b162]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: