Closed Bug 2080083 Opened 1 month ago Closed 21 days ago

Use a keepalive fetch to unblock the in-flight prefetch in speculation-rules no-vary-search/prefetch-single-with-hint.https.html

Categories

(Core :: DOM: Networking, task, P2)

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: smayya, Assigned: smayya, NeedInfo)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged], [wptsync upstream])

Attachments

(1 external file)

speculation-rules/prefetch/no-vary-search/prefetch-single-with-hint.https.html checks that a navigation uses a prefetch that is still in flight, matched by the speculation rule's No-Vary-Search hint.

Test results: https://wpt.fyi/results/speculation-rules/prefetch/no-vary-search?label=master&label=experimental&aligned&q=prefetch-single-with-hint.https.html

The server script prefetch_nvs_hint.py holds the prefetch response until it receives an unblock request. The test sends that request with a plain fetch() from the source page's onbeforeunload handler, expecting it to reach the server while the navigation is waiting for the prefetch.

In Firefox the new navigation cancels the source page's in-flight requests, so the unblock request is aborted right after it is sent (HttpChannelParent::RecvCancel, reason=navigation, NS_BINDING_ABORTED). The prefetch therefore never completes, the navigation stops waiting after dom.speculation_rules.wait_timeout_ms (bug 2071485) and falls back to a normal fetch, and every "use the in-flight prefetch" case fails or times out regardless of whether waiting for an in-flight prefetch works.

Sending the unblock request with fetch(unblock_url, {keepalive: true}) lets it outlive the page, which is what keepalive is for, and does not change what the test checks. With that change and the patch for bug 2071485 applied locally, 25 of the 28 variants pass (17 of them are currently expected to fail). The remaining failures are the non-ASCII key cases:

  • ?25-25 and ?26-26 ("Don't vary the response on the non-ASCII key") still do not use the prefetch, as already expected.
  • ?27-27 ("Vary the response on the non-ASCII key") now uses the prefetch when it should not, the same problem as bug 2076692 in prefetch-single.https.html.

The test change should be upstreamed to web-platform-tests, and the expectations in prefetch-single-with-hint.https.html.ini updated to match.

Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged][necko-priority-next]
Assignee: nobody → smayya
No longer blocks: speculation-rules-prefetch
Severity: S3 → N/A
Whiteboard: [necko-triaged][necko-priority-next] → [necko-triaged]

Firefox cancels the page's in-flight requests when a navigation starts, so the
plain fetch sent from onbeforeunload never reached the server and the in-flight
prefetch was never released.

Attachment #9660741 - Attachment description: Bug 2080083 - Use a keepalive fetch to unblock the in-flight prefetch in prefetch-single-with-hint.https.html. r=#necko → WIP: Bug 2080083 - Use a keepalive fetch to unblock the in-flight prefetch in prefetch-single-with-hint.https.html. r=#necko
Attachment #9660741 - Attachment description: WIP: Bug 2080083 - Use a keepalive fetch to unblock the in-flight prefetch in prefetch-single-with-hint.https.html. r=#necko → Bug 2080083 - Use a keepalive fetch to unblock the in-flight prefetch in prefetch-single-with-hint.https.html. r=#necko
Pushed by smayya@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/c605673f3fa9 https://hg.mozilla.org/integration/autoland/rev/4da9faefaeda Use a keepalive fetch to unblock the in-flight prefetch in prefetch-single-with-hint.https.html. r=necko-reviewers,valentin
Pushed by asilaghi@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/7ca388f545a7 https://hg.mozilla.org/integration/autoland/rev/9aaffb4eecbc Revert "Bug 2080083, Bug 2082095, Bug 2077601, Bug 2082099 - Use a keepalive fetch to unblock the in-flight prefetch in prefetch-single-with-hint.https.html. r=necko-reviewers,valentin" for causing wpt tests failures at flight prefetch

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/64803 for changes under testing/web-platform/tests

Whiteboard: [necko-triaged] → [necko-triaged], [wptsync upstream]

Backed out for causing wpt and TV tests failures at flight prefetch
Backout Link
Push with failures
Failure Log
Failure line TEST-UNEXPECTED-PASS | /speculation-rules/prefetch/no-vary-search/prefetch-single-with-hint.https.html?26-26 | Use the in-flight prefetch. Non-ASCII key - 2 UTF-8 code units. Don't vary the response on the non-ASCII key. - expected FAIL

Flags: needinfo?(smayya)

Upstream PR was closed without merging

Pushed by smayya@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/ca24710d4156 https://hg.mozilla.org/integration/autoland/rev/79a987bc0211 Use a keepalive fetch to unblock the in-flight prefetch in prefetch-single-with-hint.https.html. r=necko-reviewers,valentin
Status: NEW → RESOLVED
Closed: 21 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch

Upstream PR merged by moz-wptsync-bot

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

Creator:
Created:
Updated:
Size: