Closed Bug 1973036 Opened 11 months ago Closed 11 months ago

Cache panel seems to be always empty

Categories

(DevTools :: Netmonitor, defect)

defect

Tracking

(firefox-esr115 wontfix, firefox-esr128 wontfix, firefox-esr140 wontfix, firefox139 wontfix, firefox140 wontfix, firefox141 wontfix, firefox142 fixed)

RESOLVED FIXED
142 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 --- wontfix
firefox-esr140 --- wontfix
firefox139 --- wontfix
firefox140 --- wontfix
firefox141 --- wontfix
firefox142 --- fixed

People

(Reporter: ochameau, Assigned: jdescottes)

References

(Blocks 1 open bug)

Details

(Keywords: regression)

Attachments

(2 files)

STR:

  • open some page having cached request, example: bugzilla or phabricator
  • select one of those requests and open the cache panel

The cache panel will be empty on all requests

Mopzregression:
Last good revision: 6aff7acd8390f8d83eb15589a0ceb376cedb2416 (2021-10-28)
First bad revision: c97b176528631e697dc1c1191b1f6b4dc1e0726a (2021-10-29)
Pushlog:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=6aff7acd8390f8d83eb15589a0ceb376cedb2416&tochange=c97b176528631e697dc1c1191b1f6b4dc1e0726a

This comes from:
https://searchfox.org/mozilla-central/rev/beba5cde846f944c4d709e75cbe499d17af880a4/devtools/shared/network-observer/NetworkResponseListener.sys.mjs#476

if (this.#request.fromCache || responseStatus == 304) {

where this.#request is an nsIChannel, which, I think, never exposed such a fromCache boolean.

This precise check seems to have been wrong from day 1, from bug 859051.
But we might have regressed the other condition around responseStatus in bug 1815460.
The panel was most likely only functional thanks to the second condition.

For some reason, the existing test covering this patch triggers a 304 request from JS:
https://searchfox.org/mozilla-central/source/devtools/client/netmonitor/test/browser_net_cache_details.js
and the responseStatus is set to 304, whereas it is always set to 200 in all the websites I use as example.

https://searchfox.org/mozilla-central/rev/beba5cde846f944c4d709e75cbe499d17af880a4/remote/shared/NetworkResponse.sys.mjs#64-70

// For 304 responses, the response will be replaced by the cached response
// between responseStarted and responseCompleted, which will effectively
// change the status and statusMessage.
// Until the issue linked above has been discussed and closed, we will
// cache the status/statusMessage in order to ensure consistent values
// between responseStarted and responseCompleted.
this.#status = this.#isDataURL ? 200 : this.#channel.responseStatus;

We actually had an issue with this in BiDi, and we read the responseStatus early to avoid having it replaced with 200

And yes prior to Bug 1815460, we were reading the status from httpActivity, which was probably populated as early as possible:

  (this.#request.fromCache || this.#httpActivity.responseStatus == 304)
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Blocks: 1973255

This is yet another reason why the cache panel is sometimes blank.
nsICacheStorage.asyncOpenURI would sometime never call DevTool's onCacheEntryCheck/onCacheEntryAvailable listeners.
I don't have precise STR, but reloading many times on wikipedia.org reproduces intermittently.

Pushed by jdescottes@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/6d29415b899a https://hg.mozilla.org/integration/autoland/rev/377035d03764 [devtools] Stop reading the responseStatus dynamically from the channel to fetch cache details r=devtools-reviewers,ochameau https://github.com/mozilla-firefox/firefox/commit/30dbb48109d3 https://hg.mozilla.org/integration/autoland/rev/721a2609a1f0 [devtools] Stop reading nsIChannel.fromCache which doesn't exist r=devtools-reviewers,ochameau
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 142 Branch

The patch landed in nightly and beta is affected.
:jdescottes, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(jdescottes)
Flags: needinfo?(jdescottes)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: