Closed Bug 2075771 Opened 1 month ago Closed 1 month ago

[wpt-sync] Sync PR 62978 - [compression-dictionary] Test how Cache-Control affects dictionary freshness

Categories

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

task

Tracking

()

RESOLVED FIXED
160 Branch
Tracking Status
firefox160 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 62978 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/62978
Details from upstream follow.

Aadharsh Pannirselvam <19518661+oddharsh@users.noreply.github.com> wrote:

[compression-dictionary] Test how Cache-Control affects dictionary freshness

RFC 9842 §2.2.1 says a dictionary has to be "either fresh or allowed to be served stale" to match. The suite currently covers two freshness cases, an expired dictionary and max-age=0, because register-dictionary.py can only send Cache-Control: max-age=N. The directives that decide whether a stale response may be served had no coverage at all.

This PR adds an optional cache-control parameter to register-dictionary.py that replaces the default header, plus six tests:

test Cache-Control expected basis
Stale dictionary within its stale-while-revalidate window is used max-age=0, stale-while-revalidate=3600 used RFC 5861
Dictionary past its stale-while-revalidate window is not used max-age=0, stale-while-revalidate=5 + Age: 10 not used RFC 5861
Fresh dictionary with must-revalidate is used max-age=3600, must-revalidate used RFC 9111 §5.2.2.2 only restricts stale use
Stale dictionary with must-revalidate is not used max-age=0, must-revalidate, stale-while-revalidate=3600 not used RFC 9111 §5.2.2.2
Dictionary with no-cache is not used max-age=3600, no-cache not used RFC 9111 §5.2.2.4
Dictionary with no-store is not registered max-age=3600, no-store not used RFC 9111 §5.2.2.5

The negative tests follow the existing pattern: they match on echo-headers.py and wait on registerAltDictionaryAndWait. The past-the-window case uses the existing age parameter, so there are no sleeps.

One judgment call worth a look: no-cache. A max-age=3600, no-cache response is fresh, but it can't be reused without validation. I read that as not satisfying §2.2.1, and Chrome agrees (it doesn't register one). If the intent is that a dictionary only needs to be fresh, that test should flip.

Testing. All 22 tests in the file pass in Chrome 154.0.8037.58 (three runs) and Canary 156.0.8073.3. Each new test was also checked against a mutated handler, to confirm it can fail:

  • with the cache-control parameter ignored (so everything gets max-age=3600), the four negative tests fail;
  • with no-store prepended, the two positive tests fail.

A note for anyone running this directory locally with wpt serve instead of wptrunner: Chrome drops shared dictionaries when the certificate doesn't chain to a known root, except on localhost (kCompressionDictionaryTransportRequireKnownRootCert, on by default). Under the wpt CA every test in the file fails, including "Simple dictionary registration", and DevTools reports nothing. --disable-features=CompressionDictionaryTransportRequireKnownRootCert fixes it.

cc @pmeenan @fred-wang

Component: web-platform-tests → DOM: Networking
Product: Testing → Core

CI Results

Ran 0 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 8 tests and 8 subtests

Status Summary

Firefox

OK : 8
PASS : 33
FAIL : 6

Chrome

OK : 8
PASS : 39

Safari

OK : 7
PASS : 7
FAIL : 31
TIMEOUT: 2

Links

GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch
You need to log in before you can comment on or make changes to this bug.